[994] | 1 | # If SRC or TARGET is a folder it must end in a slash "/"
|
---|
| 2 | SRC =
|
---|
| 3 | TARGET = ../build/
|
---|
[1165] | 4 | DIST_TARGET = ../dist/00020DaodanWin
|
---|
[994] | 5 | SUBFOLDERS = Patches beaengine
|
---|
| 6 |
|
---|
| 7 | DEF = BEA_ENGINE_STATIC
|
---|
| 8 | INCLUDEPATHS = .
|
---|
[1163] | 9 | GCCFLAGS = -std=gnu99 -ggdb -O0 -Wall -fomit-frame-pointer -Wextra -Wno-pragmas -Wno-unused-variable $(addprefix -I,$(INCLUDEPATHS)) -Wno-unused-parameter $(addprefix -D,$(DEF))
|
---|
| 10 | LINKFLAGS = -O0 -Wall -fomit-frame-pointer -mdll
|
---|
[994] | 11 | LOCALE = LC_MESSAGES=C
|
---|
| 12 |
|
---|
| 13 | LIBDIRS =
|
---|
| 14 | LIBS = -lgdi32 -lwsock32
|
---|
| 15 | OBJS = $(SRC)binkw32.def
|
---|
| 16 | OUT = $(TARGET)binkw32.dll
|
---|
| 17 |
|
---|
| 18 | FILES := _DLLInfo.rc $(foreach dir,. $(SUBFOLDERS),$(wildcard $(SRC)$(dir)/*.c))
|
---|
| 19 |
|
---|
[1165] | 20 | DIST_OUT = $(DIST_TARGET)/plain/win_only/binkw32.dll
|
---|
| 21 | DIST_FILES := $(DIST_TARGET)/Mod_Info.cfg \
|
---|
| 22 | $(DIST_TARGET)/plain/win_only/realbink.dll \
|
---|
| 23 | $(DIST_TARGET)/plain/win_only/run_full.bat \
|
---|
| 24 | $(DIST_TARGET)/plain/win_only/run_wind.bat \
|
---|
| 25 | $(DIST_OUT)
|
---|
| 26 | DIST = $(DIST_TARGET).zip
|
---|
| 27 |
|
---|
[994] | 28 | ###################################################
|
---|
| 29 | # #
|
---|
| 30 | # Should not be required to change anything below #
|
---|
| 31 | # #
|
---|
| 32 | ###################################################
|
---|
| 33 |
|
---|
| 34 | UNAME := $(shell uname -s)
|
---|
| 35 | ifeq ("Linux","$(UNAME)")
|
---|
| 36 | GCC := i686-w64-mingw32-gcc
|
---|
| 37 | WINDRES := i686-w64-mingw32-windres
|
---|
| 38 | else
|
---|
| 39 | GCC := gcc
|
---|
| 40 | WINDRES := windres
|
---|
| 41 | endif
|
---|
| 42 |
|
---|
| 43 | DESTFOLDERS = $(addprefix $(TARGET),$(SUBFOLDERS))
|
---|
| 44 | DEST = $(patsubst $(SRC)%.rc,$(TARGET)%.o,$(patsubst $(SRC)%.c,$(TARGET)%.o,$(FILES)))
|
---|
| 45 |
|
---|
[1165] | 46 | all: $(OUT)
|
---|
| 47 | .PHONY: all
|
---|
| 48 |
|
---|
| 49 | $(OUT): $(DESTFOLDERS) $(DEST) $(OBJS)
|
---|
[994] | 50 | @echo "Linking"
|
---|
| 51 | $(LOCALE) $(GCC) $(LINKFLAGS) -o $(OUT) $(DEST) $(OBJS) $(LIBDIRS) $(LIBS)
|
---|
| 52 |
|
---|
| 53 | clean:
|
---|
[1165] | 54 | -rm -f $(DEST)
|
---|
| 55 | -rm -Rf $(DESTFOLDERS)
|
---|
| 56 | -rm -f $(OUT)
|
---|
| 57 | -rm -f $(DIST) $(DIST_OUT)
|
---|
| 58 | .PHONY: clean
|
---|
[994] | 59 |
|
---|
| 60 | $(DESTFOLDERS):
|
---|
| 61 | mkdir -p $@
|
---|
| 62 |
|
---|
| 63 | $(TARGET)%.o: $(SRC)%.c
|
---|
| 64 | @echo "Compiling $<"
|
---|
| 65 | $(LOCALE) $(GCC) $(GCCFLAGS) -c -o $@ $<
|
---|
| 66 | @echo
|
---|
| 67 |
|
---|
| 68 | $(TARGET)%.o: $(SRC)%.rc
|
---|
| 69 | @echo "Assembling resource $<"
|
---|
| 70 | $(WINDRES) -i $< -o $@
|
---|
| 71 | @echo
|
---|
| 72 |
|
---|
[1165] | 73 | $(DIST): $(DIST_FILES)
|
---|
| 74 | bsdtar -acf $@ --strip-components 2 $(DIST_FILES)
|
---|
| 75 |
|
---|
| 76 | $(DIST_OUT): $(OUT)
|
---|
| 77 | cp -f $< $@
|
---|
| 78 |
|
---|
| 79 | dist: $(DIST)
|
---|
| 80 | .PHONY: dist
|
---|