##
## GCC Makefile
##
.SUFFIXES:

.PHONY: clean all

# GetFirmwareType is declared in i686-w64-mingw32\include\winbase.h
#      only if  _WIN32_WINNT >= 0x0602
# on mingw in MSYS2 it is implemented !!!only in libkernel32.a in mingw64!!!
# not in mingw32's libkernel32.a !!!
CFLAGS = -Wall -O3 -D_WIN32_WINNT=0x0602 -I.
CPPFLAGS = -DNDEBUG -D_LARGEFILE64_SOURCE=1
# kernel32 is implicitly linked at all times so -lkernel32 not needed
#example
#  g++ -O3 -s -m32 -static  cb2emf.cpp -o cb2emf -lgdi32 -lshlwapi

#ifeq ($(OS),Windows_NT)
#  LDFLAGS += -static -s
#  ifeq ($(CC),cc)
    #CC = gcc
    CC = g++
#  endif
#endif

#objs := efi-windows.o main.o reboot-windows.o wincommon.o
objs := $(patsubst %.c,%.o,$(wildcard *.c))

target = efireboot-cli.exe

all: $(target)

%.o : %.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

efireboot-cli.exe: $(objs)
	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
	strip $(target)

clean:
	$(RM) $(objs) $(target) 
