Add -Wno-old-initializer to turn off warnings about non-C99 struct initializers
[smatch.git] / Makefile
blob77a68779ccaefa5dad26e0e5347634f88251c29b
1 VERSION=0.3
3 OS=linux
5 CC=gcc
6 CFLAGS=-O -g -Wall -Wwrite-strings -fpic
7 LDFLAGS=-g
8 AR=ar
11 # For debugging, uncomment the next one
13 CFLAGS += -DDEBUG
15 DESTDIR=
16 PREFIX=$(HOME)
17 BINDIR=$(PREFIX)/bin
18 LIBDIR=$(PREFIX)/lib
19 INCLUDEDIR=$(PREFIX)/include
20 PKGCONFIGDIR=$(LIBDIR)/pkgconfig
22 PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse test-linearize example \
23 test-unssa test-dissect ctags
24 INST_PROGRAMS=sparse cgcc
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 dissect.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) sparse.pc
42 install: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc
43 install -d $(DESTDIR)$(BINDIR)
44 install -d $(DESTDIR)$(LIBDIR)
45 install -d $(DESTDIR)$(INCLUDEDIR)/sparse
46 install -d $(DESTDIR)$(PKGCONFIGDIR)
47 for f in $(INST_PROGRAMS); do \
48 install -v $$f $(DESTDIR)$(BINDIR)/$$f || exit 1; \
49 done
50 for f in $(LIBS); do \
51 install -m 644 -v $$f $(DESTDIR)$(LIBDIR)/$$f || exit 1; \
52 done
53 for f in $(LIB_H); do \
54 install -m 644 -v $$f $(DESTDIR)$(INCLUDEDIR)/sparse/$$f || exit 1; \
55 done
56 install -m 644 -v sparse.pc $(DESTDIR)$(PKGCONFIGDIR)/sparse.pc
58 sparse.pc: sparse.pc.in
59 sed 's|@version@|$(VERSION)|g;s|@prefix@|$(PREFIX)|g;s|@libdir@|$(LIBDIR)|g;s|@includedir@|$(INCLUDEDIR)|g' sparse.pc.in > sparse.pc
61 test-lexing: test-lexing.o $(LIBS)
62 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
64 test-parsing: test-parsing.o $(LIBS)
65 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
67 test-linearize: test-linearize.o $(LIBS)
68 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
70 test-sort: test-sort.o $(LIBS)
71 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
73 compile: compile.o compile-i386.o $(LIBS)
74 $(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
76 obfuscate: obfuscate.o $(LIBS)
77 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
79 sparse: sparse.o $(LIBS)
80 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
82 graph: graph.o $(LIBS)
83 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
85 example: example.o $(LIBS)
86 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
88 test-unssa: test-unssa.o $(LIBS)
89 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
91 test-dissect: test-dissect.o $(LIBS)
92 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
94 ctags: ctags.o $(LIBS)
95 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
97 $(LIB_FILE): $(LIB_OBJS)
98 $(AR) rcs $@ $(LIB_OBJS)
100 $(SLIB_FILE): $(LIB_OBJS)
101 $(CC) -shared -o $@ $(LIB_OBJS)
103 evaluate.o: $(LIB_H)
104 expression.o: $(LIB_H)
105 lib.o: $(LIB_H)
106 allocate.o: $(LIB_H)
107 parse.o: $(LIB_H)
108 pre-process.o: $(LIB_H) pre-process.h
109 scope.o: $(LIB_H)
110 show-parse.o: $(LIB_H)
111 symbol.o: $(LIB_H)
112 expand.o: $(LIB_H)
113 linearize.o: $(LIB_H)
114 flow.o: $(LIB_H)
115 cse.o: $(LIB_H)
116 simplify.o: $(LIB_H)
117 memops.o: $(LIB_H)
118 liveness.o: $(LIB_H)
119 sort.o: $(LIB_H)
120 inline.o: $(LIB_H)
121 target.o: $(LIB_H)
122 test-lexing.o: $(LIB_H)
123 test-parsing.o: $(LIB_H)
124 test-linearize.o: $(LIB_H)
125 test-dissect.o: $(LIB_H)
126 ctags.o: $(LIB_H)
127 compile.o: $(LIB_H) compile.h
128 compile-i386.o: $(LIB_H) compile.h
129 tokenize.o: $(LIB_H)
130 sparse.o: $(LIB_H)
131 obfuscate.o: $(LIB_H)
132 example.o: $(LIB_H)
133 storage.o: $(LIB_H)
134 dissect.o: $(LIB_H)
135 graph.o: $(LIB_H)
137 compat-linux.o: compat/strtold.c compat/mmap-blob.c \
138 $(LIB_H)
139 compat-solaris.o: compat/mmap-blob.c $(LIB_H)
140 compat-mingw.o: $(LIB_H)
141 compat-cygwin.o: $(LIB_H)
143 pre-process.h:
144 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
146 clean:
147 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc
149 dist:
150 @if test "`git describe`" != "$(VERSION)" ; then \
151 echo 'Update VERSION in the Makefile before running "make dist".' ; \
152 exit 1 ; \
154 git archive --format=tar --prefix=sparse-$(VERSION)/ HEAD^{tree} | gzip -9 > sparse-$(VERSION).tar.gz