# If SRC or TARGET is a folder it must end in a slash "/" SRC = TARGET = ../build/ DIST_TARGET = ../dist/00020DaodanWin SUBFOLDERS = Patches beaengine DEF = BEA_ENGINE_STATIC INCLUDEPATHS = . GCCFLAGS = -std=gnu99 -ggdb -O0 -Wall -fomit-frame-pointer -Wextra -Wno-pragmas -Wno-unused-variable $(addprefix -I,$(INCLUDEPATHS)) -Wno-unused-parameter $(addprefix -D,$(DEF)) LINKFLAGS = -O0 -Wall -fomit-frame-pointer -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)) DIST_OUT = $(DIST_TARGET)/plain/win_only/binkw32.dll DIST_FILES := $(DIST_TARGET)/Mod_Info.cfg \ $(DIST_TARGET)/plain/win_only/realbink.dll \ $(DIST_TARGET)/plain/win_only/run_full.bat \ $(DIST_TARGET)/plain/win_only/run_wind.bat \ $(DIST_OUT) DIST = $(DIST_TARGET).zip ################################################### # # # 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: $(OUT) .PHONY: all $(OUT): $(DESTFOLDERS) $(DEST) $(OBJS) @echo "Linking" $(LOCALE) $(GCC) $(LINKFLAGS) -o $(OUT) $(DEST) $(OBJS) $(LIBDIRS) $(LIBS) clean: -rm -f $(DEST) -rm -Rf $(DESTFOLDERS) -rm -f $(OUT) -rm -f $(DIST) $(DIST_OUT) .PHONY: clean $(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 $(DIST): $(DIST_FILES) bsdtar -acf $@ --strip-components 2 $(DIST_FILES) $(DIST_OUT): $(OUT) cp -f $< $@ dist: $(DIST) .PHONY: dist