Merge bk://kernel.bkbits.net/jgarzik/sparse.hacking
[smatch.git] / Makefile
blobd30fc4ec883154daf973e2b1500848619fcb3ad4
1 CC=gcc
2 CFLAGS=-g -Wall
3 LDFLAGS=-g
4 AR=ar
6 PREFIX=$(HOME)
7 PROGRAMS=test-lexing test-parsing obfuscate check compile
9 LIB_H= token.h parse.h lib.h symbol.h scope.h expression.h target.h
11 LIB_OBJS= parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
12 expression.o show-parse.o evaluate.o expand.o inline.o
14 LIB_FILE= sparse.a
15 LIBS=$(LIB_FILE)
17 all: $(PROGRAMS)
20 # Install the 'check' binary as 'sparse', just to confuse people.
22 # "The better to keep you on your toes, my dear".
24 install: check
25 install -C check $(PREFIX)/bin/sparse
27 test-lexing: test-lexing.o $(LIB_FILE)
28 gcc $(LDFLAGS) -o $@ $< $(LIBS)
30 test-parsing: test-parsing.o $(LIB_FILE)
31 gcc $(LDFLAGS) -o $@ $< $(LIBS)
33 compile: compile.o compile-i386.o $(LIB_FILE)
34 gcc $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
36 obfuscate: obfuscate.o $(LIB_FILE)
37 gcc $(LDFLAGS) -o $@ $< $(LIBS)
39 check: check.o $(LIB_FILE)
40 gcc $(LDFLAGS) -o $@ $< $(LIBS)
42 $(LIB_FILE): $(LIB_OBJS)
43 $(AR) rcs $(LIB_FILE) $(LIB_OBJS)
45 evaluate.o: $(LIB_H)
46 expression.o: $(LIB_H)
47 lib.o: $(LIB_H)
48 parse.o: $(LIB_H)
49 pre-process.o: $(LIB_H) pre-process.h
50 scope.o: $(LIB_H)
51 show-parse.o: $(LIB_H)
52 symbol.o: $(LIB_H)
53 test-lexing.o: $(LIB_H)
54 test-parsing.o: $(LIB_H)
55 compile.o: $(LIB_H)
56 compile-i386.o: $(LIB_H)
57 tokenize.o: $(LIB_H)
59 pre-process.h:
60 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
62 clean:
63 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) pre-process.h