9 CFLAGS
=-O
-g
-Wall
-Wwrite-strings
-fpic
14 # For debugging, uncomment the next one
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
38 SLIB_FILE
= libsparse.so
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; \
52 for f in
$(LIBS
); do \
53 install -m
644 -v
$$f $(DESTDIR
)$(LIBDIR
)/$$f || exit
1; \
55 for f in
$(LIB_H
); do \
56 install -m
644 -v
$$f $(DESTDIR
)$(INCLUDEDIR
)/sparse
/$$f || exit
1; \
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
)
103 expression.o
: $(LIB_H
)
107 pre-process.o
: $(LIB_H
) pre-process.h
109 show-parse.o
: $(LIB_H
)
112 linearize.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
129 obfuscate.o
: $(LIB_H
)
135 compat-linux.o
: compat
/strtold.c compat
/mmap-blob.c \
137 compat-solaris.o
: compat
/mmap-blob.c
$(LIB_H
)
138 compat-mingw.o
: $(LIB_H
)
139 compat-cygwin.o
: $(LIB_H
)
142 echo
"#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
145 rm -f
*.
[oasi
] core core.
[0-9]* $(PROGRAMS
) $(SLIB_FILE
) pre-process.h sparse.
pc