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
13 CFLAGS += -DGMQCC_GITINFO="`git describe`"
14 #turn on tons of warnings if clang is present
15 # but also turn off the STUPID ONES
20 -Wno-format-nonliteral \
21 -Wno-disabled-macro-expansion \
23 -Wno-missing-prototypes \
27 #Tiny C Compiler doesn't know what -pedantic-errors is
28 # and instead of ignoring .. just errors.
30 CFLAGS +=-pedantic-errors
32 CFLAGS += -Wno-pointer-sign -fno-common
40 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o file.o utf8.o correct.o
41 OBJ_T = test.o util.o conout.o file.o
42 OBJ_C = main.o lexer.o parser.o file.o
43 OBJ_X = exec-standalone.o util.o conout.o file.o
45 ifneq ("$(CYGWIN)", "")
46 #nullify the common variables that
47 #most *nix systems have (for windows)
54 TESTSUITE = testsuite.exe
56 ifneq ("$(MINGW)", "")
57 #nullify the common variables that
58 #most *nix systems have (for windows)
65 TESTSUITE = testsuite.exe
67 #arm support for linux .. we need to allow unaligned accesses
68 #to memory otherwise we just segfault everywhere
69 ifneq (, $(findstring arm, $(shell uname -m)))
70 CFLAGS += -munaligned-access
109 -shiftimplementation \
114 -bufferoverflowhigh \
133 $(CC) -c $< -o $@ $(CFLAGS)
135 exec-standalone.o: exec.c
136 $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
139 $(CC) -o $@ $^ $(CFLAGS) -lm
141 $(GMQCC): $(OBJ_C) $(OBJ_D)
142 $(CC) -o $@ $^ $(CFLAGS)
144 $(TESTSUITE): $(OBJ_T)
145 $(CC) -o $@ $^ $(CFLAGS)
147 all: $(GMQCC) $(QCVM) $(TESTSUITE)
152 # alias to check because test.o exists and people will get confused
153 # about the undefined references to X.
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 -m755 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
183 install -m755 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
187 util.o: gmqcc.h opts.def
188 code.o: gmqcc.h opts.def
189 ast.o: gmqcc.h opts.def ast.h ir.h
190 ir.o: gmqcc.h opts.def ir.h
191 conout.o: gmqcc.h opts.def
192 ftepp.o: gmqcc.h opts.def lexer.h
193 opts.o: gmqcc.h opts.def
194 file.o: gmqcc.h opts.def
195 utf8.o: gmqcc.h opts.def
196 correct.o: gmqcc.h opts.def
198 test.o: gmqcc.h opts.def
199 util.o: gmqcc.h opts.def
200 conout.o: gmqcc.h opts.def
201 file.o: gmqcc.h opts.def
203 main.o: gmqcc.h opts.def lexer.h
204 lexer.o: gmqcc.h opts.def lexer.h
205 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h
206 file.o: gmqcc.h opts.def
208 util.o: gmqcc.h opts.def
209 conout.o: gmqcc.h opts.def
210 file.o: gmqcc.h opts.def