added a bunch of gcc builtins
[smatch.git] / Makefile
blobccf9f891aba520566e0dc428a1ab55367dac6de0
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 graph 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 $(BINDIR)/sparse ; then install -v $< $(BINDIR)/sparse ; install -v $(SLIB_FILE) $(BINDIR) ; fi
50 bin-dir:
51 @if ! test -d $(BINDIR); then \
52 echo "No '$(BINDIR)' 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 graph: graph.o $(LIBS)
81 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
83 example: example.o $(LIBS)
84 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
86 test-unssa: test-unssa.o $(LIBS)
87 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
89 test-dissect: test-dissect.o $(LIBS)
90 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
92 $(LIB_FILE): $(LIB_OBJS)
93 $(AR) rcs $@ $(LIB_OBJS)
95 $(SLIB_FILE): $(LIB_OBJS)
96 $(CC) -shared -o $@ $(LIB_OBJS)
98 evaluate.o: $(LIB_H)
99 expression.o: $(LIB_H)
100 lib.o: $(LIB_H)
101 allocate.o: $(LIB_H)
102 parse.o: $(LIB_H)
103 pre-process.o: $(LIB_H) pre-process.h
104 scope.o: $(LIB_H)
105 show-parse.o: $(LIB_H)
106 symbol.o: $(LIB_H)
107 expand.o: $(LIB_H)
108 linearize.o: $(LIB_H)
109 flow.o: $(LIB_H)
110 cse.o: $(LIB_H)
111 simplify.o: $(LIB_H)
112 memops.o: $(LIB_H)
113 liveness.o: $(LIB_H)
114 sort.o: $(LIB_H)
115 inline.o: $(LIB_H)
116 target.o: $(LIB_H)
117 test-lexing.o: $(LIB_H)
118 test-parsing.o: $(LIB_H)
119 test-linearize.o: $(LIB_H)
120 test-dissect.o: $(LIB_H) dissect.h
121 compile.o: $(LIB_H) compile.h
122 compile-i386.o: $(LIB_H) compile.h
123 tokenize.o: $(LIB_H)
124 check.o: $(LIB_H)
125 obfuscate.o: $(LIB_H)
126 example.o: $(LIB_H)
127 storage.o: $(LIB_H) storage.h
128 dissect.o: $(LIB_H) dissect.h
129 graph.o: $(LIB_H)
131 compat-linux.o: compat/strtold.c compat/mmap-blob.c \
132 $(LIB_H)
133 compat-solaris.o: compat/mmap-blob.c $(LIB_H)
134 compat-mingw.o: $(LIB_H)
135 compat-cygwin.o: $(LIB_H)
137 pre-process.h:
138 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
140 clean:
141 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) $(SLIB_FILE) pre-process.h
143 % : SCCS/s.%s