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 CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL)
14 ifneq ($(shell git describe --always 2>/dev/null),)
15 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
17 #turn on tons of warnings if clang is present
18 # but also turn off the STUPID ONES
23 -Wno-format-nonliteral \
24 -Wno-disabled-macro-expansion \
26 -Wno-missing-prototypes \
29 -Wno-missing-variable-declarations \
30 -Wno-unknown-warning-option
32 #Tiny C Compiler doesn't know what -pedantic-errors is
33 # and instead of ignoring .. just errors.
35 CFLAGS +=-pedantic-errors
37 CFLAGS += -Wno-pointer-sign -fno-common
45 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o fs.o utf8.o correct.o
46 OBJ_P = util.o fs.o conout.o opts.o pak.o
47 OBJ_T = test.o util.o conout.o fs.o
48 OBJ_C = main.o lexer.o parser.o fs.o
49 OBJ_X = exec-standalone.o util.o conout.o fs.o
51 ifneq ("$(CYGWIN)", "")
52 #nullify the common variables that
53 #most *nix systems have (for windows)
60 TESTSUITE = testsuite.exe
63 ifneq ("$(MINGW)", "")
64 #nullify the common variables that
65 #most *nix systems have (for windows)
72 TESTSUITE = testsuite.exe
75 #arm support for linux .. we need to allow unaligned accesses
76 #to memory otherwise we just segfault everywhere
77 ifneq (, $(findstring arm, $(shell uname -m)))
78 CFLAGS += -munaligned-access
90 --date-format "%d %B, %Y" \
91 --seconds-per-day 0.01 \
92 --auto-skip-seconds 1 \
95 --camera-mode overview \
96 --highlight-all-users \
98 --hide progress,mouse \
100 --max-files 99999999999 \
101 --max-file-lag 0.000001 \
102 --bloom-multiplier 1.3 \
105 #ffmpeg flags for gource
148 -shiftimplementation \
170 $(CC) -c $< -o $@ $(CFLAGS)
172 exec-standalone.o: exec.c
173 $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
176 $(CC) -o $@ $^ $(CFLAGS) -lm
178 $(GMQCC): $(OBJ_C) $(OBJ_D)
179 $(CC) -o $@ $^ $(CFLAGS) -lm
181 $(TESTSUITE): $(OBJ_T)
182 $(CC) -o $@ $^ $(CFLAGS) -lm
185 $(CC) -o $@ $^ $(CFLAGS)
187 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
195 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4
198 @ splint $(SPLINTFLAGS) *.c *.h
201 @ gource $(GOURCEFLAGS)
204 @ gource $(GOURCEFLAGS) -o - | ffmpeg $(FFMPEGFLAGS) gource.mp4
207 @makedepend -Y -w 65536 2> /dev/null \
208 $(subst .o,.c,$(OBJ_D))
209 @makedepend -a -Y -w 65536 2> /dev/null \
210 $(subst .o,.c,$(OBJ_T))
211 @makedepend -a -Y -w 65536 2> /dev/null \
212 $(subst .o,.c,$(OBJ_C))
213 @makedepend -a -Y -w 65536 2> /dev/null \
214 $(subst .o,.c,$(OBJ_X))
215 @makedepend -a -Y -w 65536 2> /dev/null \
216 $(subst .o,.c,$(OBJ_P))
219 install: install-gmqcc install-qcvm install-doc
220 install-gmqcc: $(GMQCC)
221 install -d -m755 $(DESTDIR)$(BINDIR)
222 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/gmqcc
223 install-qcvm: $(QCVM)
224 install -d -m755 $(DESTDIR)$(BINDIR)
225 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/qcvm
227 install -d -m755 $(DESTDIR)$(MANDIR)/man1
228 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
229 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
232 rm $(DESTDIR)$(BINDIR)/gmqcc
233 rm $(DESTDIR)$(BINDIR)/qcvm
234 rm $(DESTDIR)$(MANDIR)/man1/doc/gmqcc.1
235 rm $(DESTDIR)$(MANDIR)/man1/doc/qcvm.1
239 util.o: gmqcc.h opts.def
240 code.o: gmqcc.h opts.def
241 ast.o: gmqcc.h opts.def ast.h ir.h
242 ir.o: gmqcc.h opts.def ir.h
243 conout.o: gmqcc.h opts.def
244 ftepp.o: gmqcc.h opts.def lexer.h
245 opts.o: gmqcc.h opts.def
246 fs.o: gmqcc.h opts.def
247 utf8.o: gmqcc.h opts.def
248 correct.o: gmqcc.h opts.def
250 test.o: gmqcc.h opts.def
251 util.o: gmqcc.h opts.def
252 conout.o: gmqcc.h opts.def
253 fs.o: gmqcc.h opts.def
255 main.o: gmqcc.h opts.def lexer.h
256 lexer.o: gmqcc.h opts.def lexer.h
257 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h intrin.h
258 fs.o: gmqcc.h opts.def
260 util.o: gmqcc.h opts.def
261 conout.o: gmqcc.h opts.def
262 fs.o: gmqcc.h opts.def
264 util.o: gmqcc.h opts.def
265 fs.o: gmqcc.h opts.def
266 conout.o: gmqcc.h opts.def
267 opts.o: gmqcc.h opts.def
268 pak.o: gmqcc.h opts.def