6 CFLAGS
=-O
-g
-Wall
-Wwrite-strings
-fpic
11 # For debugging, uncomment the next one
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
36 SLIB_FILE
= libsparse.so
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; \
50 for f in
$(LIBS
); do \
51 install -m
644 -v
$$f $(DESTDIR
)$(LIBDIR
)/$$f || exit
1; \
53 for f in
$(LIB_H
); do \
54 install -m
644 -v
$$f $(DESTDIR
)$(INCLUDEDIR
)/sparse
/$$f || exit
1; \
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
)
104 expression.o
: $(LIB_H
)
108 pre-process.o
: $(LIB_H
) pre-process.h
110 show-parse.o
: $(LIB_H
)
113 linearize.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
)
127 compile.o
: $(LIB_H
) compile.h
128 compile-i386.o
: $(LIB_H
) compile.h
131 obfuscate.o
: $(LIB_H
)
137 compat-linux.o
: compat
/strtold.c compat
/mmap-blob.c \
139 compat-solaris.o
: compat
/mmap-blob.c
$(LIB_H
)
140 compat-mingw.o
: $(LIB_H
)
141 compat-cygwin.o
: $(LIB_H
)
144 echo
"#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
147 rm -f
*.
[oasi
] core core.
[0-9]* $(PROGRAMS
) $(SLIB_FILE
) pre-process.h sparse.
pc
150 @if
test "`git describe`" != "$(VERSION)" ; then \
151 echo
'Update VERSION in the Makefile before running "make dist".' ; \
154 git archive
--format
=tar --prefix=sparse-
$(VERSION
)/ HEAD^
{tree
} | gzip
-9 > sparse-
$(VERSION
).
tar.gz