cleanup write to argument array hack
[smatch.git] / Makefile
blob2dcd51437cbe0a0178afdd58f9a08b1dc8f05a8a
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 compile graph sparse test-linearize example test-unssa test-dissect
25 INST_PROGRAMS=sparse cgcc
27 LIB_H= token.h parse.h lib.h symbol.h scope.h expression.h target.h \
28 linearize.h bitmap.h ident-list.h compat.h flow.h allocate.h \
29 storage.h ptrlist.h
31 LIB_OBJS= target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \
32 expression.o show-parse.o evaluate.o expand.o inline.o linearize.o \
33 sort.o allocate.o compat-$(OS).o ptrlist.o \
34 flow.o cse.o simplify.o memops.o liveness.o storage.o unssa.o dissect.o
36 LIB_FILE= libsparse.a
37 SLIB_FILE= libsparse.so
39 LIBS=$(LIB_FILE)
41 all: $(PROGRAMS)
43 install: $(INST_PROGRAMS) bin-dir
44 for f in $(INST_PROGRAMS); do \
45 install -v $$f $(BINDIR)/$$f || exit 1; \
46 done
48 bin-dir:
49 @if ! test -d $(BINDIR); then \
50 echo "No '$(BINDIR)' directory to install in"; \
51 echo "Please create it and add it to your PATH"; \
52 exit 1; \
55 .PHONY: bin-dir
57 test-lexing: test-lexing.o $(LIBS)
58 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
60 test-parsing: test-parsing.o $(LIBS)
61 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
63 test-linearize: test-linearize.o $(LIBS)
64 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
66 test-sort: test-sort.o $(LIBS)
67 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
69 compile: compile.o compile-i386.o $(LIBS)
70 $(CC) $(LDFLAGS) -o $@ $< compile-i386.o $(LIBS)
72 obfuscate: obfuscate.o $(LIBS)
73 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
75 sparse: check.o $(LIBS)
76 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
78 graph: graph.o $(LIBS)
79 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
81 example: example.o $(LIBS)
82 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
84 test-unssa: test-unssa.o $(LIBS)
85 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
87 test-dissect: test-dissect.o $(LIBS)
88 $(CC) $(LDFLAGS) -o $@ $< $(LIBS)
90 $(LIB_FILE): $(LIB_OBJS)
91 $(AR) rcs $@ $(LIB_OBJS)
93 $(SLIB_FILE): $(LIB_OBJS)
94 $(CC) -shared -o $@ $(LIB_OBJS)
96 evaluate.o: $(LIB_H)
97 expression.o: $(LIB_H)
98 lib.o: $(LIB_H)
99 allocate.o: $(LIB_H)
100 parse.o: $(LIB_H)
101 pre-process.o: $(LIB_H) pre-process.h
102 scope.o: $(LIB_H)
103 show-parse.o: $(LIB_H)
104 symbol.o: $(LIB_H)
105 expand.o: $(LIB_H)
106 linearize.o: $(LIB_H)
107 flow.o: $(LIB_H)
108 cse.o: $(LIB_H)
109 simplify.o: $(LIB_H)
110 memops.o: $(LIB_H)
111 liveness.o: $(LIB_H)
112 sort.o: $(LIB_H)
113 inline.o: $(LIB_H)
114 target.o: $(LIB_H)
115 test-lexing.o: $(LIB_H)
116 test-parsing.o: $(LIB_H)
117 test-linearize.o: $(LIB_H)
118 test-dissect.o: $(LIB_H) dissect.h
119 compile.o: $(LIB_H) compile.h
120 compile-i386.o: $(LIB_H) compile.h
121 tokenize.o: $(LIB_H)
122 check.o: $(LIB_H)
123 obfuscate.o: $(LIB_H)
124 example.o: $(LIB_H)
125 storage.o: $(LIB_H) storage.h
126 dissect.o: $(LIB_H) dissect.h
127 graph.o: $(LIB_H)
129 compat-linux.o: compat/strtold.c compat/mmap-blob.c \
130 $(LIB_H)
131 compat-solaris.o: compat/mmap-blob.c $(LIB_H)
132 compat-mingw.o: $(LIB_H)
133 compat-cygwin.o: $(LIB_H)
135 pre-process.h:
136 echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
138 clean:
139 rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) $(SLIB_FILE) pre-process.h
141 % : SCCS/s.%s