zmap-freebsd/src/Makefile

82 lines
2.6 KiB
Makefile
Raw Normal View History

INCLUDE+=-I../lib -I./ -Ioutput_modules
LDFLAGS+=-pthread
LDLIBS+=-lpcap -lgmp -lm
2013-08-16 11:12:47 -04:00
TARGETS=zmap
VPATH=../lib:output_modules:probe_modules
PREFIX=/usr/local
INSTALL=install
INSTALLDATA=install -m 644
2013-08-20 21:53:37 -04:00
mandir=$(PREFIX)/man/man1/
2013-08-29 18:05:41 -04:00
oldmanfile=/usr/share/man/man1/zmap.1
2013-08-16 11:12:47 -04:00
bindir=$(PREFIX)/sbin
# Hardening and warnings for building with gcc
2013-08-20 19:24:18 -04:00
# Maybe add -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
GCCWARNINGS = -Wall -Wformat=2 -Wno-format-nonliteral\
-pedantic -fno-strict-aliasing \
-Wextra \
-Wfloat-equal -Wundef -Wwrite-strings -Wredundant-decls \
2013-08-16 11:12:47 -04:00
-Wnested-externs -Wbad-function-cast -Winit-self \
2013-08-20 19:24:18 -04:00
-Wmissing-noreturn -Wnormalized=id \
-Wstack-protector
GCCHARDENING=-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all -fwrapv -fPIC --param ssp-buffer-size=1
2013-08-16 11:12:47 -04:00
LDHARDENING=-z relro -z now
EXTRACFLAGS=-std=gnu99 -g -O2 $(GCCHARDENING) $(GCCWARNINGS) $(EXTRA_CFLAGS) -Werror
2013-08-16 11:12:47 -04:00
EXTRALDFLAGS= $(LDHARDENING)
CFLAGS+=$(INCLUDE) $(EXTRACFLAGS)
2013-08-16 11:12:47 -04:00
LDFLAGS+=$(EXTRALDFLAGS)
probemodules=module_tcp_synscan.o module_icmp_echo.o module_udp.o #ADD YOUR PROBE MODULE HERE
2013-08-29 15:03:23 -04:00
outputmodules= module_csv.o #ADD YOUR OUTPUT MODULE HERE
2013-08-16 11:12:47 -04:00
2013-08-29 15:03:23 -04:00
objects=constraint.o blacklist.o cyclic.o logger.o send.o recv.o state.o monitor.o zopt_compat.o zmap.o random.o output_modules.o packet.o probe_modules.o ${probemodules} ${outputmodules} validate.o rijndael-alg-fst.o get_gateway.o aesrand.o fieldset.o
redis_objects=module_redis.o redis.o
2013-08-16 11:12:47 -04:00
ifeq ($(REDIS), true)
LDLIBS+=-lhiredis
objects+=$(redis_objects)
2013-08-16 11:12:47 -04:00
CFLAGS+=-DREDIS
endif
ifeq ($(JSON), true)
2013-08-30 01:15:25 -04:00
LDLIBS+=-ljson
CFLAGS+=-DJSON
objects+=module_json.o
endif
2013-08-16 11:12:47 -04:00
all: $(TARGETS)
$(TARGETS):
$(CC) $(CFLAGS) $(DFLAGS) $(LDFLAGS) $^ -o $@ $(LDLIBS)
zmap: $(objects)
zopt_compat.o: zopt.c
2013-08-16 11:12:47 -04:00
zopt.c zopt.h: zopt.ggo
gengetopt -C --no-help --no-version -i $^ -F $*
install: zmap
$(INSTALL) zmap $(bindir)/zmap
test -d /etc/zmap || (mkdir /etc/zmap && $(INSTALLDATA) ../conf/* /etc/zmap/)
2013-08-29 18:05:41 -04:00
test -f $(oldmanfile) && rm -f $(oldmanfile) && mandb -f $(oldmanfile) || /bin/true # remove old man page if it's there
2013-08-20 21:53:37 -04:00
test -d $(mandir) || mkdir -p $(mandir)
2013-08-16 11:12:47 -04:00
$(INSTALLDATA) ./zmap.1 $(mandir)
2013-08-20 12:20:53 -04:00
@echo "\n**************\nSuccess! ZMap is installed. Try running (as root):\nzmap -p 80 -N 10 -B 1M -o -\n**************"
2013-08-16 11:12:47 -04:00
uninstall:
test -f $(oldmanfile) && rm -f $(oldmanfile) && mandb -f $(oldmanfile) || /bin/true # remove old man page if it's there
test -f $(mandir)/zmap.1 && rm -f $(mandir)/zmap.1 && mandb -f $(mandir)/zmap.1 || /bin/true # remove current man page if it's there
rm -f $(bindir)/zmap
2013-08-16 11:12:47 -04:00
clean:
-rm -f $(objects) $(redis_objects) $(TARGETS)
2013-08-16 11:12:47 -04:00
.PHONY: install clean