Allow -vv as shorthand for "-v -v" aka "very verbose".
[smatch.git] / Makefile
blobcd75e8467a4b31b371ebe96aa41a68e3702d4410
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
17 LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
18 expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
19 sort.o allocate.o compat-$(OS).o \
20 flow.o cse.o simplify.o memops.o liveness.o
22 LIB_FILE= sparse.a
23 LIBS=$(LIB_FILE)
25 all: $(PROGRAMS)
28 # Install the 'check' binary as 'sparse', just to confuse people.
30 # "The better to keep you on your toes, my dear".
32 install: check bin-dir
33 if test $< -nt $(PREFIX)/bin/sparse ; then install -v $< $(PREFIX)/bin/sparse ; fi
35 bin-dir:
36 @if ! test -d $(PREFIX)/bin; then \
37 echo "No '$(PREFIX)/bin' directory to install in"; \
38 echo "Please create it and add it to your PATH"; \
39 exit 1; \
42 .PHONY: bin-dir
44 test-lexing: test-lexing.o $(LIB_FILE)
45 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
47 test-parsing: test-parsing.o $(LIB_FILE)
48 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
50 test-linearize: test-linearize.o $(LIB_FILE)
51 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
53 test-sort: test-sort.o $(LIB_FILE)
54 gcc $(LDFLAGS) -o $@ $< $(LIBS)
56 compile: compile.o compile-i386.o $(LIB_FILE)
57 $(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
59 obfuscate: obfuscate.o $(LIB_FILE)
60 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
62 check: check.o $(LIB_FILE)
63 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
65 example: example.o $(LIB_FILE)
66 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
68 $(LIB_FILE): $(LIB_OBJS)
69 $(AR) rcs $(LIB_FILE) $(LIB_OBJS)
71 evaluate.o: $(LIB_H)
72 expression.o: $(LIB_H)
73 lib.o: $(LIB_H)
74 allocate.o: $(LIB_H)
75 parse.o: $(LIB_H)
76 pre-process.o: $(LIB_H) pre-process.h
77 scope.o: $(LIB_H)
78 show-parse.o: $(LIB_H)
79 symbol.o: $(LIB_H)
80 expand.o: $(LIB_H)
81 linearize.o: $(LIB_H)
82 flow.o: $(LIB_H)
83 cse.o: $(LIB_H)
84 simplify.o: $(LIB_H)
85 memops.o: $(LIB_H)
86 liveness.o: $(LIB_H)
87 sort.o: $(LIB_H)
88 inline.o: $(LIB_H)
89 target.o: $(LIB_H)
90 test-lexing.o: $(LIB_H)
91 test-parsing.o: $(LIB_H)
92 test-linearize.o: $(LIB_H)
93 compile.o: $(LIB_H) compile.h
94 compile-i386.o: $(LIB_H) compile.h
95 tokenize.o: $(LIB_H)
96 check.o: $(LIB_H)
97 obfuscate.o: $(LIB_H)
98 example.o: $(LIB_H)
100 compat-linux.o: compat/strtold.c compat/id-files-stat.c compat/mmap-blob.c \
101 $(LIB_H)
102 compat-solaris.o: compat/id-files-stat.c compat/mmap-blob.c $(LIB_H)
103 compat-mingw.o: $(LIB_H)
104 compat-cygwin.o: $(LIB_H)
106 pre-process.h:
107 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
109 clean:
110 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) pre-process.h