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