Remove old SCCS target from Makefile.
[smatch.git] / Makefile
blob3bc789bf43adfca75a902662a8623ad66fa09fef
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=$(PREFIX)/share/pkgconfig
25 PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse test-linearize example test-unssa test-dissect
26 INST_PROGRAMS=sparse cgcc
28 LIB_H= token.h parse.h lib.h symbol.h scope.h expression.h target.h \
29 linearize.h bitmap.h ident-list.h compat.h flow.h allocate.h \
30 storage.h ptrlist.h dissect.h
32 LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
33 expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
34 sort.o allocate.o compat-$(OS).o ptrlist.o \
35 flow.o cse.o simplify.o memops.o liveness.o storage.o unssa.o dissect.o
37 LIB_FILE= libsparse.a
38 SLIB_FILE= libsparse.so
40 LIBS=$(LIB_FILE)
42 all: $(PROGRAMS) sparse.pc
44 install: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc
45 install -d $(DESTDIR)$(BINDIR)
46 install -d $(DESTDIR)$(LIBDIR)
47 install -d $(DESTDIR)$(INCLUDEDIR)/sparse
48 install -d $(DESTDIR)$(PKGCONFIGDIR)
49 for f in $(INST_PROGRAMS); do \
50 install -v $$f $(DESTDIR)$(BINDIR)/$$f || exit 1; \
51 done
52 for f in $(LIBS); do \
53 install -m 644 -v $$f $(DESTDIR)$(LIBDIR)/$$f || exit 1; \
54 done
55 for f in $(LIB_H); do \
56 install -m 644 -v $$f $(DESTDIR)$(INCLUDEDIR)/sparse/$$f || exit 1; \
57 done
58 install -m 644 -v sparse.pc $(DESTDIR)$(PKGCONFIGDIR)/sparse.pc
60 sparse.pc: sparse.pc.in
61 sed 's|@version@|$(VERSION)|g;s|@prefix@|$(PREFIX)|g;s|@libdir@|$(LIBDIR)|g;s|@includedir@|$(INCLUDEDIR)|g' sparse.pc.in > sparse.pc
63 test-lexing: test-lexing.o $(LIBS)
64 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
66 test-parsing: test-parsing.o $(LIBS)
67 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
69 test-linearize: test-linearize.o $(LIBS)
70 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
72 test-sort: test-sort.o $(LIBS)
73 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
75 compile: compile.o compile-i386.o $(LIBS)
76 $(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
78 obfuscate: obfuscate.o $(LIBS)
79 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
81 sparse: sparse.o $(LIBS)
82 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
84 graph: graph.o $(LIBS)
85 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
87 example: example.o $(LIBS)
88 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
90 test-unssa: test-unssa.o $(LIBS)
91 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
93 test-dissect: test-dissect.o $(LIBS)
94 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
96 $(LIB_FILE): $(LIB_OBJS)
97 $(AR) rcs $@ $(LIB_OBJS)
99 $(SLIB_FILE): $(LIB_OBJS)
100 $(CC) -shared -o $@ $(LIB_OBJS)
102 evaluate.o: $(LIB_H)
103 expression.o: $(LIB_H)
104 lib.o: $(LIB_H)
105 allocate.o: $(LIB_H)
106 parse.o: $(LIB_H)
107 pre-process.o: $(LIB_H) pre-process.h
108 scope.o: $(LIB_H)
109 show-parse.o: $(LIB_H)
110 symbol.o: $(LIB_H)
111 expand.o: $(LIB_H)
112 linearize.o: $(LIB_H)
113 flow.o: $(LIB_H)
114 cse.o: $(LIB_H)
115 simplify.o: $(LIB_H)
116 memops.o: $(LIB_H)
117 liveness.o: $(LIB_H)
118 sort.o: $(LIB_H)
119 inline.o: $(LIB_H)
120 target.o: $(LIB_H)
121 test-lexing.o: $(LIB_H)
122 test-parsing.o: $(LIB_H)
123 test-linearize.o: $(LIB_H)
124 test-dissect.o: $(LIB_H)
125 compile.o: $(LIB_H) compile.h
126 compile-i386.o: $(LIB_H) compile.h
127 tokenize.o: $(LIB_H)
128 sparse.o: $(LIB_H)
129 obfuscate.o: $(LIB_H)
130 example.o: $(LIB_H)
131 storage.o: $(LIB_H)
132 dissect.o: $(LIB_H)
133 graph.o: $(LIB_H)
135 compat-linux.o: compat/strtold.c compat/mmap-blob.c \
136 $(LIB_H)
137 compat-solaris.o: compat/mmap-blob.c $(LIB_H)
138 compat-mingw.o: $(LIB_H)
139 compat-cygwin.o: $(LIB_H)
141 pre-process.h:
142 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
144 clean:
145 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc