Repository navigation
Expand file tree
/
Copy pathMakefile.dj
More file actions
113 lines (89 loc) · 2.25 KB
/
Copy pathMakefile.dj
File metadata and controls
113 lines (89 loc) · 2.25 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
BUILD ?= release
src = $(wildcard src/*.c) $(wildcard src/3dgfx/*.c) $(wildcard src/rt/*.c) \
$(wildcard src/scr/*.c) $(wildcard src/dos/*.c)
asmsrc = $(wildcard src/*.asm) $(wildcard src/scr/*.asm) $(wildcard src/dos/*.asm)
ssrc = $(wildcard src/dos/*.s)
obj = $(src:.c=.odj) $(asmsrc:.asm=.odj) $(ssrc:.s=.odj)
dep = $(src:.c=.d)
bin = djdemo.exe
asmsrc += cspr/dbgfont.asm cspr/confont.asm
bindata = data/loading.img
ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM)
hostsys = dos
else
hostsys = unix
TOOLPREFIX = i586-pc-msdosdjgpp-
endif
inc = -Isrc -Isrc/3dgfx -Isrc/rt -Isrc/scr -Isrc/dos -Ilibs \
-Ilibs/imago/src -Ilibs/anim/src -Ilibs/midas -Ilibs/goat3d/include
opt = -O3 -ffast-math -fno-strict-aliasing
warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable -Wno-unknown-pragmas
ifeq ($(BUILD), release)
def = -DNDEBUG
else
dbg = -g
endif
#prof = -pg
CC = $(TOOLPREFIX)gcc
AR = $(TOOLPREFIX)ar
CFLAGS = -march=pentium $(warn) -MMD $(dbg) $(opt) $(prof) $(inc) $(def)
LDFLAGS = libs/imago/imago.dja libs/anim/anim.dja libs/goat3d/goat3d.dja \
libs/assfile/assfile.dja libs/midas/libmidas.a
ifneq ($(hostsys), dos)
.PHONY: all
all: data $(bin)
endif
$(bin): $(obj) imago anim goat3d assfile
$(CC) -o $@ -Wl,-Map=ld.map $(prof) $(obj) $(LDFLAGS)
%.odj: %.asm
nasm -f coff -o $@ $<
src/data.odj: src/data.asm $(bindata)
-include $(dep)
%.odj: %.c
$(CC) $(CFLAGS) -o $@ -c $<
%.odj: %.s
$(TOOLPREFIX)as -o $@ -c $<
.PHONY: imago
imago:
$(MAKE) -C libs/imago -f Makefile.dj
.PHONY: anim
anim:
$(MAKE) -C libs/anim -f Makefile.dj
.PHONY: goat3d
goat3d:
$(MAKE) -C libs/goat3d -f Makefile.dj
.PHONY: assfile
assfile:
$(MAKE) -C libs/assfile -f Makefile.dj
.PHONY: cleanlibs
cleanlibs:
$(MAKE) -C libs/imago clean -f Makefile.dj
$(MAKE) -C libs/anim clean -f Makefile.dj
$(MAKE) -C libs/goat3d clean -f Makefile.dj
$(MAKE) -C libs/assfile clean -f Makefile.dj
.PHONY: clean
.PHONY: cleandep
ifeq ($(hostsys), dos)
clean:
del src\*.odj
del src\3dgfx\*.odj
del src\rt\*.odj
del src\dos\*.odj
del $(bin)
cleandep:
del src\*.d
del src\3dgfx\*.d
del src\rt\*.d
del src\dos\*.d
else
clean:
rm -f $(obj) $(bin)
cleandep:
rm -f $(dep)
.PHONY: data
data:
@tools/procdata
endif
.PHONY: strip
strip: $(bin)
$(TOOLPREFIX)strip $(bin)