-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile.in
89 lines (75 loc) · 3.25 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
.PHONY: all install uninstall clean dist-clean distclean release
sfuzz sfuzz.exe: $(SF_OBJS)
@echo "[LINK] $@"
@$(CCPATH)/$(CC) -o $@ $(SF_OBJS) $(LDFLAGS) $(LIBS)
snoop snoop.exe: $(SNOOP_OBJS)
@echo "[LINK] $@"
@$(CCPATH)/$(CC) -o $@ $(SNOOP_OBJS) $(LDFLAGS) $(LIBS)
sfo sfo.exe: $(SFO_OBJS)
@echo "[LINK] $@"
@$(CCPATH)/$(CC) -o $@ $(SFO_OBJS) $(LDFLAGS) $(LIBS)
%.so: %.c $(SHARED_INC)
@echo "[LINK] $@"
@$(CCPATH)/$(CC) $(CFLAGS) -D__PLUGIN_BUILD__ -o $@ $< $(SHARED_INC) $(SHARED_OPTS)
-include $(SF_OBJS:.o=.d)
-include $(SNOOP_OBJS:.o=.d)
%.1.gz: %.1
@echo "[GZIP] $@"
@$(GZIP) -c < $< > $@
%.o: %.c
@echo "[CC] $@"
@$(CCPATH)/$(CC) $(CFLAGS) -MT '$@' -MT '$*.d' -MD -c $<
@$(CCPATH)/$(CC) -c -o $@ $(CFLAGS) $<
install: all
@echo "Installing to: $(DESTDIR)$(PREFIX)"
@$(INSTALL_DIR) $(DESTDIR)$(BIN_DIR)
@$(INSTALL) sfuzz $(DESTDIR)$(BIN_DIR)
@$(INSTALL) sfo $(DESTDIR)$(BIN_DIR)
@$(INSTALL_DIR) $(DESTDIR)$(MAN_DIR)
@$(INSTALL) -m 0644 sfuzz.1.gz $(DESTDIR)$(MAN_DIR)
@$(INSTALL) -m 0644 sfo.1.gz $(DESTDIR)$(MAN_DIR)
@$(INSTALL_DIR) $(DESTDIR)$(SHARE_DIR)sfuzz-db
@$(INSTALL) -m 0644 $(SFUZZ_SAMPLE)* $(DESTDIR)$(SHARE_DIR)sfuzz-db
@$(INSTALL) *.so $(DESTDIR)$(SHARE_DIR)sfuzz-db
@echo Installed.
uninstall:
@$(RM) -rf $(SHARE_DIR)sfuzz-db
@$(RM) -f $(BIN_DIR)sfuzz
@$(RM) -f $(BIN_DIR)sfo
@$(RM) -f $(BIN_DIR)sfo.exe
@$(RM) -f $(BIN_DIR)sfuzz.exe
@echo "Uninstalled."
clean:
@$(RM) -f core *~ *.o snoop snoop.exe sfuzz sfuzz.exe sfo sfo.exe *.so *.d *.deb sfo.1.gz sfuzz.1.gz
@$(RM) -rf *.so.dSYM sfuzz-deb-temp
distclean dist-clean: clean
@$(RM) -f Makefile Makefile.old simple-fuzzer.spec
@echo Makefile / configuration removed.
# the following is a semi-portable way of writing a debian dpkg file for
# the distribution of sfuzz as a .deb file
deb: all
@$(MKDIR) -p -m 0700 sfuzz-deb-temp/data
@$(MKDIR) -p -m 0700 sfuzz-deb-temp/control
@$(MAKE) DESTDIR=sfuzz-deb-temp/data install
@$(CP) debfile sfuzz-deb-temp/control/control
@$(FIND) sfuzz-deb-temp/data -type f -print | $(XARGS) $(MD5SUM) > sfuzz-deb-temp/control/md5sums
@$(SED) -ire 's@sfuzz-deb-temp/data@@g' sfuzz-deb-temp/control/md5sums
@$(SED) -ire 's@\*@@g' sfuzz-deb-temp/control/md5sums
@$(SED) -ire 's@VERSION@$(VERSION)@g' sfuzz-deb-temp/control/control
@$(SED) -ire 's@ARCHITECTURE@$(ARCH)@g' sfuzz-deb-temp/control/control
@$(SED) -ire 's@x86_64@amd64@g' sfuzz-deb-temp/control/control
@$(SED) -ire 's/MAINTAINER/$(MAINT)/g' sfuzz-deb-temp/control/control
@echo "2.0" > sfuzz-deb-temp/debian-binary
@$(TAR) --owner=0 --group=0 --strip-components=2 --directory=sfuzz-deb-temp/data -czf sfuzz-deb-temp/data.tar.gz `echo $(PREFIX) | $(SED) 's@^/@@g'`
@$(TAR) --owner=0 --group=0 --directory=sfuzz-deb-temp/control -czf sfuzz-deb-temp/control.tar.gz control md5sums
@cd sfuzz-deb-temp && $(AR) rcs ../simple-fuzzer.deb debian-binary control.tar.gz data.tar.gz
release: clean
@echo Making a release tree:
@$(RM) -f Makefile Makefile.old
@$(RM) -rf /tmp/sfuzz-$(VERSION)
@$(MKDIR) -p /tmp/sfuzz-$(VERSION)
@$(CP) -dPar * /tmp/sfuzz-$(VERSION)
@$(RM) -rf /tmp/sfuzz-$(VERSION)/.git*
@$(TAR) --strip-components=1 --owner=0 --group=0 --directory=/tmp/ -cjf sfuzz-$(VERSION).tar.bz2 sfuzz-$(VERSION)
@$(RM) -rf /tmp/sfuzz-$(VERSION)
@echo sfuzz-$(VERSION).tar.bz2 is built.