Add initial CSE pass
[smatch.git] / Makefile
blobf57f495438404ed8ae7ab12a4c1db4de306d2968
1 OS=linux
3 CC=gcc
4 CFLAGS=-O -g -Wall -Wwrite-strings
5 LDFLAGS=-g
6 AR=ar
8 PREFIX=$(HOME)
9 PROGRAMS=test-lexing test-parsing obfuscate check compile test-linearize
11 LIB_H= token.h parse.h lib.h symbol.h scope.h expression.h target.h \
12 linearize.h bitmap.h ident-list.h compat.h flow.h
14 LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
15 expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
16 sort.o flow.o cse.o compat-$(OS).o
18 LIB_FILE= sparse.a
19 LIBS=$(LIB_FILE)
21 all: $(PROGRAMS)
24 # Install the 'check' binary as 'sparse', just to confuse people.
26 # "The better to keep you on your toes, my dear".
28 install: check bin-dir
29 if test $< -nt $(PREFIX)/bin/sparse ; then install -v $< $(PREFIX)/bin/sparse ; fi
31 bin-dir:
32 @if ! test -d $(PREFIX)/bin; then \
33 echo "No '$(PREFIX)/bin' directory to install in"; \
34 echo "Please create it and add it to your PATH"; \
35 exit 1; \
38 .PHONY: bin-dir
40 test-lexing: test-lexing.o $(LIB_FILE)
41 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
43 test-parsing: test-parsing.o $(LIB_FILE)
44 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
46 test-linearize: test-linearize.o $(LIB_FILE)
47 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
49 test-sort: test-sort.o $(LIB_FILE)
50 gcc $(LDFLAGS) -o $@ $< $(LIBS)
52 compile: compile.o compile-i386.o $(LIB_FILE)
53 $(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
55 obfuscate: obfuscate.o $(LIB_FILE)
56 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
58 check: check.o $(LIB_FILE)
59 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
61 $(LIB_FILE): $(LIB_OBJS)
62 $(AR) rcs $(LIB_FILE) $(LIB_OBJS)
64 evaluate.o: $(LIB_H)
65 expression.o: $(LIB_H)
66 lib.o: $(LIB_H)
67 parse.o: $(LIB_H)
68 pre-process.o: $(LIB_H) pre-process.h
69 scope.o: $(LIB_H)
70 show-parse.o: $(LIB_H)
71 symbol.o: $(LIB_H)
72 expand.o: $(LIB_H)
73 linearize.o: $(LIB_H)
74 flow.o: $(LIB_H)
75 sort.o: $(LIB_H)
76 inline.o: $(LIB_H)
77 target.o: $(LIB_H)
78 test-lexing.o: $(LIB_H)
79 test-parsing.o: $(LIB_H)
80 test-linearize.o: $(LIB_H)
81 compile.o: $(LIB_H) compile.h
82 compile-i386.o: $(LIB_H) compile.h
83 tokenize.o: $(LIB_H)
84 check.o: $(LIB_H)
85 obfuscate.o: $(LIB_H)
87 compat-linux.o: compat/strtold.c compat/id-files-stat.c compat/mmap-blob.c \
88 $(LIB_H)
89 compat-solaris.o: compat/id-files-stat.c compat/mmap-blob.c $(LIB_H)
90 compat-mingw.o: $(LIB_H)
91 compat-cygwin.o: $(LIB_H)
93 pre-process.h:
94 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
96 clean:
97 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) pre-process.h