Prevent potential NULL pointer dereference in expand_compare
[smatch.git] / Makefile
blobd13630ba4a7ea0ebbff9fee6d437d667295dda95
2 # Turkey time!
4 VERSION=0.2
6 OS=linux
8 CC=gcc
9 CFLAGS=-O -g -Wall -Wwrite-strings -fpic
10 LDFLAGS=-g
11 AR=ar
14 # For debugging, uncomment the next one
16 CFLAGS += -DDEBUG
18 DESTDIR=
19 PREFIX=$(HOME)
20 BINDIR=$(PREFIX)/bin
21 LIBDIR=$(PREFIX)/lib
22 INCLUDEDIR=$(PREFIX)/include
23 PKGCONFIGDIR=$(LIBDIR)/pkgconfig
25 PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse test-linearize example \
26 test-unssa test-dissect ctags
27 INST_PROGRAMS=sparse cgcc
29 LIB_H= token.h parse.h lib.h symbol.h scope.h expression.h target.h \
30 linearize.h bitmap.h ident-list.h compat.h flow.h allocate.h \
31 storage.h ptrlist.h dissect.h
33 LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
34 expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
35 sort.o allocate.o compat-$(OS).o ptrlist.o \
36 flow.o cse.o simplify.o memops.o liveness.o storage.o unssa.o dissect.o
38 LIB_FILE= libsparse.a
39 SLIB_FILE= libsparse.so
41 LIBS=$(LIB_FILE)
43 all: $(PROGRAMS) sparse.pc
45 install: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc
46 install -d $(DESTDIR)$(BINDIR)
47 install -d $(DESTDIR)$(LIBDIR)
48 install -d $(DESTDIR)$(INCLUDEDIR)/sparse
49 install -d $(DESTDIR)$(PKGCONFIGDIR)
50 for f in $(INST_PROGRAMS); do \
51 install -v $$f $(DESTDIR)$(BINDIR)/$$f || exit 1; \
52 done
53 for f in $(LIBS); do \
54 install -m 644 -v $$f $(DESTDIR)$(LIBDIR)/$$f || exit 1; \
55 done
56 for f in $(LIB_H); do \
57 install -m 644 -v $$f $(DESTDIR)$(INCLUDEDIR)/sparse/$$f || exit 1; \
58 done
59 install -m 644 -v sparse.pc $(DESTDIR)$(PKGCONFIGDIR)/sparse.pc
61 sparse.pc: sparse.pc.in
62 sed 's|@version@|$(VERSION)|g;s|@prefix@|$(PREFIX)|g;s|@libdir@|$(LIBDIR)|g;s|@includedir@|$(INCLUDEDIR)|g' sparse.pc.in > sparse.pc
64 test-lexing: test-lexing.o $(LIBS)
65 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
67 test-parsing: test-parsing.o $(LIBS)
68 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
70 test-linearize: test-linearize.o $(LIBS)
71 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
73 test-sort: test-sort.o $(LIBS)
74 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
76 compile: compile.o compile-i386.o $(LIBS)
77 $(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
79 obfuscate: obfuscate.o $(LIBS)
80 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
82 sparse: sparse.o $(LIBS)
83 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
85 graph: graph.o $(LIBS)
86 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
88 example: example.o $(LIBS)
89 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
91 test-unssa: test-unssa.o $(LIBS)
92 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
94 test-dissect: test-dissect.o $(LIBS)
95 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
97 ctags: ctags.o $(LIBS)
98 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
100 $(LIB_FILE): $(LIB_OBJS)
101 $(AR) rcs $@ $(LIB_OBJS)
103 $(SLIB_FILE): $(LIB_OBJS)
104 $(CC) -shared -o $@ $(LIB_OBJS)
106 evaluate.o: $(LIB_H)
107 expression.o: $(LIB_H)
108 lib.o: $(LIB_H)
109 allocate.o: $(LIB_H)
110 parse.o: $(LIB_H)
111 pre-process.o: $(LIB_H) pre-process.h
112 scope.o: $(LIB_H)
113 show-parse.o: $(LIB_H)
114 symbol.o: $(LIB_H)
115 expand.o: $(LIB_H)
116 linearize.o: $(LIB_H)
117 flow.o: $(LIB_H)
118 cse.o: $(LIB_H)
119 simplify.o: $(LIB_H)
120 memops.o: $(LIB_H)
121 liveness.o: $(LIB_H)
122 sort.o: $(LIB_H)
123 inline.o: $(LIB_H)
124 target.o: $(LIB_H)
125 test-lexing.o: $(LIB_H)
126 test-parsing.o: $(LIB_H)
127 test-linearize.o: $(LIB_H)
128 test-dissect.o: $(LIB_H)
129 ctags.o: $(LIB_H)
130 compile.o: $(LIB_H) compile.h
131 compile-i386.o: $(LIB_H) compile.h
132 tokenize.o: $(LIB_H)
133 sparse.o: $(LIB_H)
134 obfuscate.o: $(LIB_H)
135 example.o: $(LIB_H)
136 storage.o: $(LIB_H)
137 dissect.o: $(LIB_H)
138 graph.o: $(LIB_H)
140 compat-linux.o: compat/strtold.c compat/mmap-blob.c \
141 $(LIB_H)
142 compat-solaris.o: compat/mmap-blob.c $(LIB_H)
143 compat-mingw.o: $(LIB_H)
144 compat-cygwin.o: $(LIB_H)
146 pre-process.h:
147 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
149 clean:
150 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc