# If SRC or TARGET is a folder it must end in a slash "/" SRC = TARGET = ../build/ SUBFOLDERS = Patches beaengine DEF = BEA_ENGINE_STATIC INCLUDEPATHS = . GCCFLAGS = -std=gnu99 -O0 -Wall -fomit-frame-pointer -fpack-struct -Wextra -Wno-pragmas -Wno-unused-variable $(addprefix -I,$(INCLUDEPATHS)) -Wno-unused-parameter $(addprefix -D,$(DEF)) LINKFLAGS = -O0 -Wall -fomit-frame-pointer -fpack-struct -s -mdll LOCALE = LC_MESSAGES=C LIBDIRS = LIBS = -lgdi32 -lwsock32 OBJS = $(SRC)binkw32.def OUT = $(TARGET)binkw32.dll FILES := _DLLInfo.rc $(foreach dir,. $(SUBFOLDERS),$(wildcard $(SRC)$(dir)/*.c)) ################################################### # # # Should not be required to change anything below # # # ################################################### UNAME := $(shell uname -s) ifeq ("Linux","$(UNAME)") GCC := i686-w64-mingw32-gcc WINDRES := i686-w64-mingw32-windres else GCC := gcc WINDRES := windres endif DESTFOLDERS = $(addprefix $(TARGET),$(SUBFOLDERS)) DEST = $(patsubst $(SRC)%.rc,$(TARGET)%.o,$(patsubst $(SRC)%.c,$(TARGET)%.o,$(FILES))) ALL: $(DESTFOLDERS) $(DEST) $(OBJS) @echo "Linking" $(LOCALE) $(GCC) $(LINKFLAGS) -o $(OUT) $(DEST) $(OBJS) $(LIBDIRS) $(LIBS) clean: rm -f $(DEST) rm -Rf $(DESTFOLDERS) rm -f $(OUT) $(DESTFOLDERS): mkdir -p $@ $(TARGET)%.o: $(SRC)%.c @echo "Compiling $<" $(LOCALE) $(GCC) $(GCCFLAGS) -c -o $@ $< @echo $(TARGET)%.o: $(SRC)%.rc @echo "Assembling resource $<" $(WINDRES) -i $< -o $@ @echo