1 | SRC = src
|
---|
2 | TARGET = build
|
---|
3 | SUBFOLDERS = patches flatline beaengine
|
---|
4 |
|
---|
5 | DEF = BEA_ENGINE_STATIC
|
---|
6 | INCLUDEPATHS = src
|
---|
7 | 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))
|
---|
8 | LINKFLAGS = -O0 -Wall -fomit-frame-pointer -fpack-struct -s -mdll
|
---|
9 | LOCALE = LC_MESSAGES=C
|
---|
10 |
|
---|
11 | LIBDIRS =
|
---|
12 | LIBS = -lgdi32 -lwsock32
|
---|
13 | OBJS = $(SRC)/binkw32.def
|
---|
14 | OUT = $(TARGET)/binkw32.dll
|
---|
15 |
|
---|
16 | FILES := src/_DLLInfo.rc $(foreach dir,. $(SUBFOLDERS),$(wildcard $(SRC)/$(dir)/*.c))
|
---|
17 |
|
---|
18 | ###################################################
|
---|
19 | # #
|
---|
20 | # Should not be required to change anything below #
|
---|
21 | # #
|
---|
22 | ###################################################
|
---|
23 |
|
---|
24 | UNAME := $(shell uname -s)
|
---|
25 | ifeq ("Linux","$(UNAME)")
|
---|
26 | GCC := i686-w64-mingw32-gcc
|
---|
27 | WINDRES := i686-w64-mingw32-windres
|
---|
28 | else
|
---|
29 | GCC := gcc
|
---|
30 | WINDRES := windres
|
---|
31 | endif
|
---|
32 |
|
---|
33 | DESTFOLDERS = $(addprefix $(TARGET)/,$(SUBFOLDERS))
|
---|
34 | DEST = $(patsubst $(SRC)/%.rc,$(TARGET)/%.o,$(patsubst $(SRC)/%.c,$(TARGET)/%.o,$(FILES)))
|
---|
35 |
|
---|
36 | ALL: $(DESTFOLDERS) $(DEST) $(OBJS)
|
---|
37 | @echo "Linking"
|
---|
38 | $(LOCALE) $(GCC) $(LINKFLAGS) -o $(OUT) $(DEST) $(OBJS) $(LIBDIRS) $(LIBS)
|
---|
39 |
|
---|
40 | clean:
|
---|
41 | rm -f $(DEST)
|
---|
42 | rm -Rf $(DESTFOLDERS)
|
---|
43 | rm -f $(OUT)
|
---|
44 |
|
---|
45 | $(DESTFOLDERS):
|
---|
46 | mkdir -p $@
|
---|
47 |
|
---|
48 | $(TARGET)/%.o: $(SRC)/%.c
|
---|
49 | @echo "Compiling $<"
|
---|
50 | $(LOCALE) $(GCC) $(GCCFLAGS) -c -o $@ $<
|
---|
51 | @echo
|
---|
52 |
|
---|
53 | $(TARGET)/%.o: $(SRC)/%.rc
|
---|
54 | @echo "Assembling resource $<"
|
---|
55 | $(WINDRES) -i $< -o $@
|
---|
56 | @echo
|
---|
57 |
|
---|