Warn about sizeof of zero size.
[smatch.git] / Makefile
blob687d02761b719384775d1d9c96670e9076146b95
2 # Turkey time!
4 OS=linux
6 CC=gcc
7 CFLAGS=-O -g -Wall -Wwrite-strings
8 LDFLAGS=-g
9 AR=ar
11 PREFIX=$(HOME)
12 PROGRAMS=test-lexing test-parsing obfuscate check compile test-linearize example
14 LIB_H= token.h parse.h lib.h symbol.h scope.h expression.h target.h \
15 linearize.h bitmap.h ident-list.h compat.h flow.h allocate.h \
16 storage.h
18 LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
19 expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
20 sort.o allocate.o compat-$(OS).o \
21 flow.o cse.o simplify.o memops.o liveness.o storage.o
23 LIB_FILE= sparse.a
24 LIBS=$(LIB_FILE)
26 all: $(PROGRAMS)
29 # Install the 'check' binary as 'sparse', just to confuse people.
31 # "The better to keep you on your toes, my dear".
33 install: check bin-dir
34 if test $< -nt $(PREFIX)/bin/sparse ; then install -v $< $(PREFIX)/bin/sparse ; fi
36 bin-dir:
37 @if ! test -d $(PREFIX)/bin; then \
38 echo "No '$(PREFIX)/bin' directory to install in"; \
39 echo "Please create it and add it to your PATH"; \
40 exit 1; \
43 .PHONY: bin-dir
45 test-lexing: test-lexing.o $(LIB_FILE)
46 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
48 test-parsing: test-parsing.o $(LIB_FILE)
49 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
51 test-linearize: test-linearize.o $(LIB_FILE)
52 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
54 test-sort: test-sort.o $(LIB_FILE)
55 gcc $(LDFLAGS) -o $@ $< $(LIBS)
57 compile: compile.o compile-i386.o $(LIB_FILE)
58 $(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
60 obfuscate: obfuscate.o $(LIB_FILE)
61 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
63 check: check.o $(LIB_FILE)
64 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
66 example: example.o $(LIB_FILE)
67 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
69 $(LIB_FILE): $(LIB_OBJS)
70 $(AR) rcs $(LIB_FILE) $(LIB_OBJS)
72 evaluate.o: $(LIB_H)
73 expression.o: $(LIB_H)
74 lib.o: $(LIB_H)
75 allocate.o: $(LIB_H)
76 parse.o: $(LIB_H)
77 pre-process.o: $(LIB_H) pre-process.h
78 scope.o: $(LIB_H)
79 show-parse.o: $(LIB_H)
80 symbol.o: $(LIB_H)
81 expand.o: $(LIB_H)
82 linearize.o: $(LIB_H)
83 flow.o: $(LIB_H)
84 cse.o: $(LIB_H)
85 simplify.o: $(LIB_H)
86 memops.o: $(LIB_H)
87 liveness.o: $(LIB_H)
88 sort.o: $(LIB_H)
89 inline.o: $(LIB_H)
90 target.o: $(LIB_H)
91 test-lexing.o: $(LIB_H)
92 test-parsing.o: $(LIB_H)
93 test-linearize.o: $(LIB_H)
94 compile.o: $(LIB_H) compile.h
95 compile-i386.o: $(LIB_H) compile.h
96 tokenize.o: $(LIB_H)
97 check.o: $(LIB_H)
98 obfuscate.o: $(LIB_H)
99 example.o: $(LIB_H)
100 storage.o: $(LIB_H) storage.h
102 compat-linux.o: compat/strtold.c compat/mmap-blob.c \
103 $(LIB_H)
104 compat-solaris.o: compat/mmap-blob.c $(LIB_H)
105 compat-mingw.o: $(LIB_H)
106 compat-cygwin.o: $(LIB_H)
108 pre-process.h:
109 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
111 clean:
112 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) pre-process.h