4 BINDIR := $(PREFIX)/bin
5 DATADIR := $(PREFIX)/share
6 MANDIR := $(DATADIR)/man
8 UNAME ?= $(shell uname)
9 CYGWIN = $(findstring CYGWIN, $(UNAME))
10 MINGW = $(findstring MINGW32, $(UNAME))
13 # linker flags and optional additional libraries if required
17 CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL)
18 ifneq ($(shell git describe --always 2>/dev/null),)
19 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
21 #turn on tons of warnings if clang is present
22 # but also turn off the STUPID ONES
27 -Wno-format-nonliteral \
28 -Wno-disabled-macro-expansion \
30 -Wno-missing-prototypes \
32 -Wno-unknown-warning-option
34 #Tiny C Compiler doesn't know what -pedantic-errors is
35 # and instead of ignoring .. just errors.
37 CFLAGS +=-pedantic-errors -ffunction-sections -fdata-sections -Wl,-gc-sections
39 CFLAGS += -Wno-pointer-sign -fno-common
47 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o fs.o utf8.o correct.o
48 OBJ_P = util.o fs.o conout.o opts.o pak.o
49 OBJ_T = test.o util.o conout.o fs.o
50 OBJ_C = main.o lexer.o parser.o fs.o
51 OBJ_X = exec-standalone.o util.o conout.o fs.o
53 ifneq ("$(CYGWIN)", "")
54 #nullify the common variables that
55 #most *nix systems have (for windows)
62 TESTSUITE = testsuite.exe
65 ifneq ("$(MINGW)", "")
66 #nullify the common variables that
67 #most *nix systems have (for windows)
74 TESTSUITE = testsuite.exe
77 #arm support for linux .. we need to allow unaligned accesses
78 #to memory otherwise we just segfault everywhere
79 ifneq (, $(findstring arm, $(shell uname -m)))
80 CFLAGS += -munaligned-access
92 --date-format "%d %B, %Y" \
93 --seconds-per-day 0.01 \
94 --auto-skip-seconds 1 \
97 --camera-mode overview \
98 --highlight-all-users \
100 --hide progress,mouse \
102 --max-files 99999999999 \
103 --max-file-lag 0.000001 \
104 --bloom-multiplier 1.3 \
105 --logo doc/html/gmqcc.png \
108 #ffmpeg flags for gource
151 -shiftimplementation \
174 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
176 exec-standalone.o: exec.c
177 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
180 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
182 $(GMQCC): $(OBJ_C) $(OBJ_D)
183 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
185 $(TESTSUITE): $(OBJ_T)
186 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
189 $(CC) -o $@ $^ $(LDFLAGS)
191 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
199 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe
202 @ splint $(SPLINTFLAGS) *.c *.h
205 @ gource $(GOURCEFLAGS)
208 @ gource $(GOURCEFLAGS) -o - | ffmpeg $(FFMPEGFLAGS) gource.mp4
211 @makedepend -Y -w 65536 2> /dev/null \
212 $(subst .o,.c,$(OBJ_D))
213 @makedepend -a -Y -w 65536 2> /dev/null \
214 $(subst .o,.c,$(OBJ_T))
215 @makedepend -a -Y -w 65536 2> /dev/null \
216 $(subst .o,.c,$(OBJ_C))
217 @makedepend -a -Y -w 65536 2> /dev/null \
218 $(subst .o,.c,$(OBJ_X))
219 @makedepend -a -Y -w 65536 2> /dev/null \
220 $(subst .o,.c,$(OBJ_P))
223 install: install-gmqcc install-qcvm install-doc
224 install-gmqcc: $(GMQCC)
225 install -d -m755 $(DESTDIR)$(BINDIR)
226 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/$(GMQCC)
227 install-qcvm: $(QCVM)
228 install -d -m755 $(DESTDIR)$(BINDIR)
229 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/$(QCVM)
231 install -d -m755 $(DESTDIR)$(MANDIR)/man1
232 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
233 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
236 rm $(DESTDIR)$(BINDIR)/gmqcc
237 rm $(DESTDIR)$(BINDIR)/qcvm
238 rm $(DESTDIR)$(MANDIR)/man1/doc/gmqcc.1
239 rm $(DESTDIR)$(MANDIR)/man1/doc/qcvm.1
243 util.o: gmqcc.h opts.def
244 code.o: gmqcc.h opts.def
245 ast.o: gmqcc.h opts.def ast.h ir.h
246 ir.o: gmqcc.h opts.def ir.h
247 conout.o: gmqcc.h opts.def
248 ftepp.o: gmqcc.h opts.def lexer.h
249 opts.o: gmqcc.h opts.def
250 fs.o: gmqcc.h opts.def
251 utf8.o: gmqcc.h opts.def
252 correct.o: gmqcc.h opts.def
254 test.o: gmqcc.h opts.def
255 util.o: gmqcc.h opts.def
256 conout.o: gmqcc.h opts.def
257 fs.o: gmqcc.h opts.def
259 main.o: gmqcc.h opts.def lexer.h
260 lexer.o: gmqcc.h opts.def lexer.h
261 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h intrin.h
262 fs.o: gmqcc.h opts.def
264 util.o: gmqcc.h opts.def
265 conout.o: gmqcc.h opts.def
266 fs.o: gmqcc.h opts.def
268 util.o: gmqcc.h opts.def
269 fs.o: gmqcc.h opts.def
270 conout.o: gmqcc.h opts.def
271 opts.o: gmqcc.h opts.def
272 pak.o: gmqcc.h opts.def