7 CFLAGS
=-O
-g
-Wall
-Wwrite-strings
-fpic
12 # For debugging, uncomment the next one
17 # If building with shared libraries, you might
20 # LDFLAGS += -Wl,-rpath,$(BINDIR)
24 PROGRAMS
=test-lexing test-parsing obfuscate compile graph sparse test-linearize example test-unssa test-dissect
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 \
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
) $(SLIB_FILE
)
42 install: sparse
$(SLIB_FILE
) bin-dir
43 if
test $< -nt
$(BINDIR
)/sparse
; then
install -v
$< $(BINDIR
)/sparse
; install -v
$(SLIB_FILE
) $(BINDIR
) ; fi
46 @if
! test -d
$(BINDIR
); then \
47 echo
"No '$(BINDIR)' directory to install in"; \
48 echo
"Please create it and add it to your PATH"; \
54 test-lexing
: test-lexing.o
$(LIBS
)
55 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
57 test-parsing
: test-parsing.o
$(LIBS
)
58 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
60 test-linearize
: test-linearize.o
$(LIBS
)
61 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
63 test-sort
: test-sort.o
$(LIBS
)
64 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
66 compile
: compile.o compile-i386.o
$(LIBS
)
67 $(CC
) $(LDFLAGS
) -o
$@
$< compile-i386.o
$(LIBS
)
69 obfuscate
: obfuscate.o
$(LIBS
)
70 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
72 sparse
: check.o
$(LIBS
)
73 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
75 graph
: graph.o
$(LIBS
)
76 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
78 example
: example.o
$(LIBS
)
79 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
81 test-unssa
: test-unssa.o
$(LIBS
)
82 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
84 test-dissect
: test-dissect.o
$(LIBS
)
85 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
87 $(LIB_FILE
): $(LIB_OBJS
)
88 $(AR
) rcs
$@
$(LIB_OBJS
)
90 $(SLIB_FILE
): $(LIB_OBJS
)
91 $(CC
) -shared
-o
$@
$(LIB_OBJS
)
94 expression.o
: $(LIB_H
)
98 pre-process.o
: $(LIB_H
) pre-process.h
100 show-parse.o
: $(LIB_H
)
103 linearize.o
: $(LIB_H
)
112 test-lexing.o
: $(LIB_H
)
113 test-parsing.o
: $(LIB_H
)
114 test-linearize.o
: $(LIB_H
)
115 test-dissect.o
: $(LIB_H
) dissect.h
116 compile.o
: $(LIB_H
) compile.h
117 compile-i386.o
: $(LIB_H
) compile.h
120 obfuscate.o
: $(LIB_H
)
122 storage.o
: $(LIB_H
) storage.h
123 dissect.o
: $(LIB_H
) dissect.h
126 compat-linux.o
: compat
/strtold.c compat
/mmap-blob.c \
128 compat-solaris.o
: compat
/mmap-blob.c
$(LIB_H
)
129 compat-mingw.o
: $(LIB_H
)
130 compat-cygwin.o
: $(LIB_H
)
133 echo
"#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
136 rm -f
*.
[oasi
] core core.
[0-9]* $(PROGRAMS
) $(SLIB_FILE
) pre-process.h