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
check compile graph 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
)
43 # Install the 'check' binary as 'sparse', just to confuse people.
45 # "The better to keep you on your toes, my dear".
47 install: check $(SLIB_FILE
) bin-dir
48 if
test $< -nt
$(BINDIR
)/sparse
; then
install -v
$< $(BINDIR
)/sparse
; install -v
$(SLIB_FILE
) $(BINDIR
) ; fi
51 @if
! test -d
$(BINDIR
); then \
52 echo
"No '$(BINDIR)' directory to install in"; \
53 echo
"Please create it and add it to your PATH"; \
59 test-lexing
: test-lexing.o
$(LIBS
)
60 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
62 test-parsing
: test-parsing.o
$(LIBS
)
63 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
65 test-linearize
: test-linearize.o
$(LIBS
)
66 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
68 test-sort
: test-sort.o
$(LIBS
)
69 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
71 compile
: compile.o compile-i386.o
$(LIBS
)
72 $(CC
) $(LDFLAGS
) -o
$@
$< compile-i386.o
$(LIBS
)
74 obfuscate
: obfuscate.o
$(LIBS
)
75 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
77 check: check.o
$(LIBS
)
78 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
80 graph
: graph.o
$(LIBS
)
81 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
83 example
: example.o
$(LIBS
)
84 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
86 test-unssa
: test-unssa.o
$(LIBS
)
87 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
89 test-dissect
: test-dissect.o
$(LIBS
)
90 $(CC
) $(LDFLAGS
) -o
$@
$< $(LIBS
)
92 $(LIB_FILE
): $(LIB_OBJS
)
93 $(AR
) rcs
$@
$(LIB_OBJS
)
95 $(SLIB_FILE
): $(LIB_OBJS
)
96 $(CC
) -shared
-o
$@
$(LIB_OBJS
)
99 expression.o
: $(LIB_H
)
103 pre-process.o
: $(LIB_H
) pre-process.h
105 show-parse.o
: $(LIB_H
)
108 linearize.o
: $(LIB_H
)
117 test-lexing.o
: $(LIB_H
)
118 test-parsing.o
: $(LIB_H
)
119 test-linearize.o
: $(LIB_H
)
120 test-dissect.o
: $(LIB_H
) dissect.h
121 compile.o
: $(LIB_H
) compile.h
122 compile-i386.o
: $(LIB_H
) compile.h
125 obfuscate.o
: $(LIB_H
)
127 storage.o
: $(LIB_H
) storage.h
128 dissect.o
: $(LIB_H
) dissect.h
131 compat-linux.o
: compat
/strtold.c compat
/mmap-blob.c \
133 compat-solaris.o
: compat
/mmap-blob.c
$(LIB_H
)
134 compat-mingw.o
: $(LIB_H
)
135 compat-cygwin.o
: $(LIB_H
)
138 echo
"#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h
141 rm -f
*.
[oasi
] core core.
[0-9]* $(PROGRAMS
) $(SLIB_FILE
) pre-process.h