[PATCH] Add support for GCC's __builtin_types_compatible_p extension
[smatch.git] / Makefile
blob378ee726efa1552a16c97d6c59cde6b629a142e1
2 # Turkey time!
4 OS=linux
6 CC=gcc
7 CFLAGS=-O -g -Wall -Wwrite-strings -fpic
8 LDFLAGS=-g
9 AR=ar
12 # For debugging, uncomment the next one
14 CFLAGS += -DDEBUG
17 # If building with shared libraries, you might
18 # want to add this
20 # LDFLAGS += -Wl,-rpath,$(BINDIR)
22 PREFIX=$(HOME)
23 BINDIR=$(PREFIX)/bin
24 PROGRAMS=test-lexing test-parsing obfuscate check compile test-linearize example test-unssa test-dissect
26 LIB_H= token.h parse.h lib.h symbol.h scope.h expression.h target.h \
27 linearize.h bitmap.h ident-list.h compat.h flow.h allocate.h \
28 storage.h ptrlist.h
30 LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
31 expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
32 sort.o allocate.o compat-$(OS).o ptrlist.o \
33 flow.o cse.o simplify.o memops.o liveness.o storage.o unssa.o dissect.o
35 LIB_FILE= libsparse.a
36 SLIB_FILE= libsparse.so
38 LIBS=$(LIB_FILE)
40 all: $(PROGRAMS) $(SLIB_FILE)
43 # Install the 'check' binary as 'sparse', just to confuse people.
45 # "The better to keep you on your toes, my dear".
47 install: check $(SLIB_FILE) bin-dir
48 if test $< -nt $(PREFIX)/bin/sparse ; then install -v $< $(BINDIR)/sparse ; install -v $(SLIB_FILE) $(BINDIR) ; fi
50 bin-dir:
51 @if ! test -d $(PREFIX)/bin; then \
52 echo "No '$(PREFIX)/bin' directory to install in"; \
53 echo "Please create it and add it to your PATH"; \
54 exit 1; \
57 .PHONY: bin-dir
59 test-lexing: test-lexing.o $(LIBS)
60 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
62 test-parsing: test-parsing.o $(LIBS)
63 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
65 test-linearize: test-linearize.o $(LIBS)
66 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
68 test-sort: test-sort.o $(LIBS)
69 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
71 compile: compile.o compile-i386.o $(LIBS)
72 $(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
74 obfuscate: obfuscate.o $(LIBS)
75 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
77 check: check.o $(LIBS)
78 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
80 example: example.o $(LIBS)
81 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
83 test-unssa: test-unssa.o $(LIBS)
84 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
86 test-dissect: test-dissect.o $(LIBS)
87 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
89 $(LIB_FILE): $(LIB_OBJS)
90 $(AR) rcs $@ $(LIB_OBJS)
92 $(SLIB_FILE): $(LIB_OBJS)
93 $(CC) -shared -o $@ $(LIB_OBJS)
95 evaluate.o: $(LIB_H)
96 expression.o: $(LIB_H)
97 lib.o: $(LIB_H)
98 allocate.o: $(LIB_H)
99 parse.o: $(LIB_H)
100 pre-process.o: $(LIB_H) pre-process.h
101 scope.o: $(LIB_H)
102 show-parse.o: $(LIB_H)
103 symbol.o: $(LIB_H)
104 expand.o: $(LIB_H)
105 linearize.o: $(LIB_H)
106 flow.o: $(LIB_H)
107 cse.o: $(LIB_H)
108 simplify.o: $(LIB_H)
109 memops.o: $(LIB_H)
110 liveness.o: $(LIB_H)
111 sort.o: $(LIB_H)
112 inline.o: $(LIB_H)
113 target.o: $(LIB_H)
114 test-lexing.o: $(LIB_H)
115 test-parsing.o: $(LIB_H)
116 test-linearize.o: $(LIB_H)
117 test-dissect.o: $(LIB_H) dissect.h
118 compile.o: $(LIB_H) compile.h
119 compile-i386.o: $(LIB_H) compile.h
120 tokenize.o: $(LIB_H)
121 check.o: $(LIB_H)
122 obfuscate.o: $(LIB_H)
123 example.o: $(LIB_H)
124 storage.o: $(LIB_H) storage.h
125 dissect.o: $(LIB_H) dissect.h
127 compat-linux.o: compat/strtold.c compat/mmap-blob.c \
128 $(LIB_H)
129 compat-solaris.o: compat/mmap-blob.c $(LIB_H)
130 compat-mingw.o: $(LIB_H)
131 compat-cygwin.o: $(LIB_H)
133 pre-process.h:
134 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
136 clean:
137 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) $(SLIB_FILE) pre-process.h
139 % : SCCS/s.%s