3 BINDIR := $(PREFIX)/bin
4 DATADIR := $(PREFIX)/share
5 MANDIR := $(DATADIR)/man
7 UNAME ?= $(shell uname)
8 CYGWIN = $(findstring CYGWIN, $(UNAME))
9 MINGW = $(findstring MINGW32, $(UNAME))
12 CFLAGS += -Wall -Wextra -I. -fno-strict-aliasing -fsigned-char -Wno-overlength-strings
13 ifneq ($(shell git describe --always 2>/dev/null),)
14 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
16 #turn on tons of warnings if clang is present
17 # but also turn off the STUPID ONES
22 -Wno-format-nonliteral \
23 -Wno-disabled-macro-expansion \
25 -Wno-missing-prototypes \
29 #Tiny C Compiler doesn't know what -pedantic-errors is
30 # and instead of ignoring .. just errors.
32 CFLAGS +=-pedantic-errors
34 CFLAGS += -Wno-pointer-sign -fno-common
42 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o file.o utf8.o correct.o
43 OBJ_T = test.o util.o conout.o file.o
44 OBJ_C = main.o lexer.o parser.o file.o
45 OBJ_X = exec-standalone.o util.o conout.o file.o
47 ifneq ("$(CYGWIN)", "")
48 #nullify the common variables that
49 #most *nix systems have (for windows)
56 TESTSUITE = testsuite.exe
58 ifneq ("$(MINGW)", "")
59 #nullify the common variables that
60 #most *nix systems have (for windows)
67 TESTSUITE = testsuite.exe
69 #arm support for linux .. we need to allow unaligned accesses
70 #to memory otherwise we just segfault everywhere
71 ifneq (, $(findstring arm, $(shell uname -m)))
72 CFLAGS += -munaligned-access
111 -shiftimplementation \
116 -bufferoverflowhigh \
135 $(CC) -c $< -o $@ $(CFLAGS)
137 exec-standalone.o: exec.c
138 $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
141 $(CC) -o $@ $^ $(CFLAGS) -lm
143 $(GMQCC): $(OBJ_C) $(OBJ_D)
144 $(CC) -o $@ $^ $(CFLAGS)
146 $(TESTSUITE): $(OBJ_T)
147 $(CC) -o $@ $^ $(CFLAGS)
149 all: $(GMQCC) $(QCVM) $(TESTSUITE)
157 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) *.dat
160 @ splint $(SPLINTFLAGS) *.c *.h
163 @makedepend -Y -w 65536 2> /dev/null \
164 $(subst .o,.c,$(OBJ_D))
165 @makedepend -a -Y -w 65536 2> /dev/null \
166 $(subst .o,.c,$(OBJ_T))
167 @makedepend -a -Y -w 65536 2> /dev/null \
168 $(subst .o,.c,$(OBJ_C))
169 @makedepend -a -Y -w 65536 2> /dev/null \
170 $(subst .o,.c,$(OBJ_X))
173 install: install-gmqcc install-qcvm install-doc
174 install-gmqcc: $(GMQCC)
175 install -d -m755 $(DESTDIR)$(BINDIR)
176 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/gmqcc
177 install-qcvm: $(QCVM)
178 install -d -m755 $(DESTDIR)$(BINDIR)
179 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/qcvm
181 install -d -m755 $(DESTDIR)$(MANDIR)/man1
182 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
183 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
186 rm $(DESTDIR)$(BINDIR)/gmqcc
187 rm $(DESTDIR)$(BINDIR)/qcvm
188 rm $(DESTDIR)$(MANDIR)/man1/doc/gmqcc.1
189 rm $(DESTDIR)$(MANDIR)/man1/doc/qcvm.1
193 util.o: gmqcc.h opts.def
194 code.o: gmqcc.h opts.def
195 ast.o: gmqcc.h opts.def ast.h ir.h
196 ir.o: gmqcc.h opts.def ir.h
197 conout.o: gmqcc.h opts.def
198 ftepp.o: gmqcc.h opts.def lexer.h
199 opts.o: gmqcc.h opts.def
200 file.o: gmqcc.h opts.def
201 utf8.o: gmqcc.h opts.def
202 correct.o: gmqcc.h opts.def
204 test.o: gmqcc.h opts.def
205 util.o: gmqcc.h opts.def
206 conout.o: gmqcc.h opts.def
207 file.o: gmqcc.h opts.def
209 main.o: gmqcc.h opts.def lexer.h
210 lexer.o: gmqcc.h opts.def lexer.h
211 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h
212 file.o: gmqcc.h opts.def
214 util.o: gmqcc.h opts.def
215 conout.o: gmqcc.h opts.def
216 file.o: gmqcc.h opts.def