source: Daodan/src/makefile@ 1165

Last change on this file since 1165 was 1165, checked in by rossy, 3 years ago

Daodan: Add AE package creation to makefile

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1# If SRC or TARGET is a folder it must end in a slash "/"
2SRC =
3TARGET = ../build/
4DIST_TARGET = ../dist/00020DaodanWin
5SUBFOLDERS = Patches beaengine
6
7DEF = BEA_ENGINE_STATIC
8INCLUDEPATHS = .
9GCCFLAGS = -std=gnu99 -ggdb -O0 -Wall -fomit-frame-pointer -Wextra -Wno-pragmas -Wno-unused-variable $(addprefix -I,$(INCLUDEPATHS)) -Wno-unused-parameter $(addprefix -D,$(DEF))
10LINKFLAGS = -O0 -Wall -fomit-frame-pointer -mdll
11LOCALE = LC_MESSAGES=C
12
13LIBDIRS =
14LIBS = -lgdi32 -lwsock32
15OBJS = $(SRC)binkw32.def
16OUT = $(TARGET)binkw32.dll
17
18FILES := _DLLInfo.rc $(foreach dir,. $(SUBFOLDERS),$(wildcard $(SRC)$(dir)/*.c))
19
20DIST_OUT = $(DIST_TARGET)/plain/win_only/binkw32.dll
21DIST_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)
26DIST = $(DIST_TARGET).zip
27
28###################################################
29# #
30# Should not be required to change anything below #
31# #
32###################################################
33
34UNAME := $(shell uname -s)
35ifeq ("Linux","$(UNAME)")
36 GCC := i686-w64-mingw32-gcc
37 WINDRES := i686-w64-mingw32-windres
38else
39 GCC := gcc
40 WINDRES := windres
41endif
42
43DESTFOLDERS = $(addprefix $(TARGET),$(SUBFOLDERS))
44DEST = $(patsubst $(SRC)%.rc,$(TARGET)%.o,$(patsubst $(SRC)%.c,$(TARGET)%.o,$(FILES)))
45
46all: $(OUT)
47.PHONY: all
48
49$(OUT): $(DESTFOLDERS) $(DEST) $(OBJS)
50 @echo "Linking"
51 $(LOCALE) $(GCC) $(LINKFLAGS) -o $(OUT) $(DEST) $(OBJS) $(LIBDIRS) $(LIBS)
52
53clean:
54 -rm -f $(DEST)
55 -rm -Rf $(DESTFOLDERS)
56 -rm -f $(OUT)
57 -rm -f $(DIST) $(DIST_OUT)
58.PHONY: clean
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
73$(DIST): $(DIST_FILES)
74 bsdtar -acf $@ --strip-components 2 $(DIST_FILES)
75
76$(DIST_OUT): $(OUT)
77 cp -f $< $@
78
79dist: $(DIST)
80.PHONY: dist
Note: See TracBrowser for help on using the repository browser.