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
45 QUIET_CC
= $(Q
:@
=@echo
' CC '$@
;)
46 QUIET_AR
= $(Q
:@
=@echo
' AR '$@
;)
47 QUIET_GEN
= $(Q
:@
=@echo
' GEN '$@
;)
48 QUIET_LINK
= $(Q
:@
=@echo
' LINK '$@
;)
49 # We rely on the -v switch of install to print 'file -> $install_dir/file'
50 QUIET_INST_SH
= $(Q
:@
=echo
-n
' INSTALL ';)
51 QUIET_INST
= $(Q
:@
=@echo
-n
' INSTALL ';)
53 all: $(PROGRAMS
) sparse.
pc
55 install: $(INST_PROGRAMS
) $(LIBS
) $(LIB_H
) sparse.
pc
56 $(Q
)install -d
$(DESTDIR
)$(BINDIR
)
57 $(Q
)install -d
$(DESTDIR
)$(LIBDIR
)
58 $(Q
)install -d
$(DESTDIR
)$(INCLUDEDIR
)/sparse
59 $(Q
)install -d
$(DESTDIR
)$(PKGCONFIGDIR
)
60 $(Q
)for f in
$(INST_PROGRAMS
); do \
61 $(QUIET_INST_SH
)install -v
$$f $(DESTDIR
)$(BINDIR
)/$$f || exit
1; \
63 $(Q
)for f in
$(LIBS
); do \
64 $(QUIET_INST_SH
)install -m
644 -v
$$f $(DESTDIR
)$(LIBDIR
)/$$f || exit
1; \
66 $(Q
)for f in
$(LIB_H
); do \
67 $(QUIET_INST_SH
)install -m
644 -v
$$f $(DESTDIR
)$(INCLUDEDIR
)/sparse
/$$f || exit
1; \
69 $(QUIET_INST
)install -m
644 -v sparse.
pc $(DESTDIR
)$(PKGCONFIGDIR
)/sparse.
pc
71 sparse.
pc: sparse.
pc.in
72 $(QUIET_GEN
)sed
's|@version@|$(VERSION)|g;s|@prefix@|$(PREFIX)|g;s|@libdir@|$(LIBDIR)|g;s|@includedir@|$(INCLUDEDIR)|g' sparse.
pc.in
> sparse.
pc
74 test-lexing
: test-lexing.o
$(LIBS
)
75 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
77 test-parsing
: test-parsing.o
$(LIBS
)
78 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
80 test-linearize
: test-linearize.o
$(LIBS
)
81 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
83 test-sort
: test-sort.o
$(LIBS
)
84 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
86 compile
: compile.o compile-i386.o
$(LIBS
)
87 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< compile-i386.o
$(LIBS
)
89 obfuscate
: obfuscate.o
$(LIBS
)
90 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
92 sparse
: sparse.o
$(LIBS
)
93 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
95 graph
: graph.o
$(LIBS
)
96 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
98 example
: example.o
$(LIBS
)
99 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
101 test-unssa
: test-unssa.o
$(LIBS
)
102 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
104 test-dissect
: test-dissect.o
$(LIBS
)
105 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
107 ctags
: ctags.o
$(LIBS
)
108 $(QUIET_LINK
)$(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
110 $(LIB_FILE
): $(LIB_OBJS
)
111 $(QUIET_AR
)$(AR
) rcs
$@
$(LIB_OBJS
)
113 $(SLIB_FILE
): $(LIB_OBJS
)
114 $(QUIET_LINK
)$(CC
) -shared
-o
$@
$(LIB_OBJS
)
117 expression.o
: $(LIB_H
)
121 pre-process.o
: $(LIB_H
) pre-process.h
123 show-parse.o
: $(LIB_H
)
126 linearize.o
: $(LIB_H
)
135 test-lexing.o
: $(LIB_H
)
136 test-parsing.o
: $(LIB_H
)
137 test-linearize.o
: $(LIB_H
)
138 test-dissect.o
: $(LIB_H
)
140 compile.o
: $(LIB_H
) compile.h
141 compile-i386.o
: $(LIB_H
) compile.h
144 obfuscate.o
: $(LIB_H
)
150 compat-linux.o
: compat
/strtold.c compat
/mmap-blob.c \
152 compat-solaris.o
: compat
/mmap-blob.c
$(LIB_H
)
153 compat-mingw.o
: $(LIB_H
)
154 compat-cygwin.o
: $(LIB_H
)
157 $(QUIET_GEN
)echo
"#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
160 $(QUIET_CC
)$(CC
) -o
$@
-c
$(CFLAGS
) $<
163 rm -f
*.
[oasi
] core core.
[0-9]* $(PROGRAMS
) $(SLIB_FILE
) pre-process.h sparse.
pc
166 @if
test "`git describe`" != "$(VERSION)" ; then \
167 echo
'Update VERSION in the Makefile before running "make dist".' ; \
170 git archive
--format
=tar --prefix=sparse-
$(VERSION
)/ HEAD^
{tree
} | gzip
-9 > sparse-
$(VERSION
).
tar.gz
173 $(Q
)cd validation
&& .
/test-suite
176 find validation
/ -name
"*.c.[egd]*" -exec
rm {} \
;