-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (60 loc) · 2.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
include setup.mk
CFLAGS = -Ofast -Wall -Wno-switch -DEXTLIB=210 -DNDEBUG -I src/
LDFLAGS := -lm -pthread
SOURCE_C = $(shell find src/* -type f -name '*.c')
SOURCE_DATA := $(shell find datafiles/* -type f)
SOURCE_O_LINUX := $(foreach f,$(SOURCE_C:.c=.o),bin/linux/$f) $(foreach f,$(SOURCE_DATA:%=%.data.o),bin/linux/$f)
SOURCE_O_WIN32 := $(foreach f,$(SOURCE_C:.c=.o),bin/win32/$f) $(foreach f,$(SOURCE_DATA:%=%.data.o),bin/win32/$f)
RELEASE_EXECUTABLE_LINUX := app_linux/genhdr
RELEASE_EXECUTABLE_WIN32 := app_win32/genhdr.exe
# Make build directories
$(shell mkdir -p bin/ $(foreach dir, \
$(dir $(SOURCE_O_WIN32)) \
$(dir $(SOURCE_O_LINUX)) \
$(dir $(RELEASE_EXECUTABLE_LINUX)) \
$(dir $(RELEASE_EXECUTABLE_WIN32)) \
, $(dir)))
.PHONY: default \
linux \
win32 \
clean
default: linux
all: linux win32
linux: $(RELEASE_EXECUTABLE_LINUX)
win32: $(RELEASE_EXECUTABLE_WIN32)
test: $(RELEASE_EXECUTABLE_LINUX)
@./$< --i ../oot_decomp_latest/ --o test/ --verbose
clean:
rm -rf bin
rm -rf test/include
rm -f $(RELEASE_EXECUTABLE_LINUX)
rm -f $(RELEASE_EXECUTABLE_WIN32)
include $(PATH_EXTLIB)ext_lib.mk
# # # # # # # # # # # # # # # # # # # #
# LINUX BUILD #
# # # # # # # # # # # # # # # # # # # #
-include $(SOURCE_O_LINUX:.o=.d)
bin/linux/%.data.o: %
@echo "$(PRNT_RSET)[$(PRNT_GREN)g$(ASSET_FILENAME)$(PRNT_RSET)]"
$(DataFileCompiler) --cc gcc --i $< --o $@
bin/linux/%.o: %.c
@echo "$(PRNT_RSET)[$(PRNT_PRPL)$(notdir $@)$(PRNT_RSET)]"
@gcc -c -o $@ $< $(CFLAGS)
$(GD_LINUX)
$(RELEASE_EXECUTABLE_LINUX): $(SOURCE_O_LINUX) $(ExtLib_Linux_O)
@echo "$(PRNT_RSET)[$(PRNT_PRPL)$(notdir $@)$(PRNT_RSET)] [$(PRNT_PRPL)$(notdir $^)$(PRNT_RSET)]"
@gcc -o $@ $^ $(XFLAGS) $(CFLAGS)
# # # # # # # # # # # # # # # # # # # #
# WIN32 BUILD #
# # # # # # # # # # # # # # # # # # # #
-include $(SOURCE_O_WIN32:.o=.d)
bin/win32/%.data.o: %
@echo "$(PRNT_RSET)[$(PRNT_GREN)g$(ASSET_FILENAME)$(PRNT_RSET)]"
$(DataFileCompiler) --cc i686-w64-mingw32.static-gcc --i $< --o $@
bin/win32/%.o: %.c
@echo "$(PRNT_RSET)[$(PRNT_PRPL)$(notdir $@)$(PRNT_RSET)]"
@i686-w64-mingw32.static-gcc -c -o $@ $< $(CFLAGS) -D_WIN32
$(GD_WIN32)
$(RELEASE_EXECUTABLE_WIN32): $(SOURCE_O_WIN32) $(ExtLib_Win32_O)
@echo "$(PRNT_RSET)[$(PRNT_PRPL)$(notdir $@)$(PRNT_RSET)] [$(PRNT_PRPL)$(notdir $^)$(PRNT_RSET)]"
@i686-w64-mingw32.static-gcc -o $@ $^ $(XFLAGS) $(CFLAGS) -D_WIN32