9 CFLAGS
=-O
-g
-Wall
-Wwrite-strings
-fpic
14 # For debugging, uncomment the next one
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
39 SLIB_FILE
= libsparse.so
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; \
53 for f in
$(LIBS
); do \
54 install -m
644 -v
$$f $(DESTDIR
)$(LIBDIR
)/$$f || exit
1; \
56 for f in
$(LIB_H
); do \
57 install -m
644 -v
$$f $(DESTDIR
)$(INCLUDEDIR
)/sparse
/$$f || exit
1; \
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
)
107 expression.o
: $(LIB_H
)
111 pre-process.o
: $(LIB_H
) pre-process.h
113 show-parse.o
: $(LIB_H
)
116 linearize.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
)
130 compile.o
: $(LIB_H
) compile.h
131 compile-i386.o
: $(LIB_H
) compile.h
134 obfuscate.o
: $(LIB_H
)
140 compat-linux.o
: compat
/strtold.c compat
/mmap-blob.c \
142 compat-solaris.o
: compat
/mmap-blob.c
$(LIB_H
)
143 compat-mingw.o
: $(LIB_H
)
144 compat-cygwin.o
: $(LIB_H
)
147 echo
"#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
150 rm -f
*.
[oasi
] core core.
[0-9]* $(PROGRAMS
) $(SLIB_FILE
) pre-process.h sparse.
pc