SRC = src TARGET = build SUBFOLDERS = patches beaengine DEF = BEA_ENGINE_STATIC INCLUDEPATHS = src GCCFLAGS = -std=c99 -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 := src/_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