1# Extract the version string from nping.h. 2export NPING_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NPING_VERSION' nping.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q') 3NPING_NAME= Nping 4NPING_URL= https://nmap.org/nping 5NPING_PLATFORM=@host@ 6prefix = @prefix@ 7datarootdir = @datarootdir@ 8exec_prefix = @exec_prefix@ 9bindir = @bindir@ 10sbindir = @sbindir@ 11mandir = @mandir@ 12srcdir = @srcdir@ 13npingdatadir = @datadir@/nping 14NPINGDEVDIR=~/nping-private-dev 15WIN32STUFFDIR=mswin32 16NPINGWEBDIR=../../../web/nmap/nping 17NPINGWININSTDIR=mswin32/nsis 18export RELEASE_DATE := $(shell date +"%b %d, %Y") 19 20 21export NBASEDIR=../nbase 22export NSOCKDIR=../nsock 23 24export NDIR=$(shell pwd) 25 26 27CC = @CC@ 28CXX = @CXX@ 29CCOPT = 30DBGFLAGS = 31STRIP = @STRIP@ 32LIBPCAPDIR = @libpcapdir@ 33export LIBDNETDIR = @LIBDNETDIR@ 34 35 36DEFS = @DEFS@ -DNPING_NAME=\"$(NPING_NAME)\" -DNPING_URL=\"$(NPING_URL)\" -DNPING_PLATFORM=\"$(NPING_PLATFORM)\" 37# With GCC, add extra security checks to source code. 38# http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html 39# Level 1 only makes changes that don't affect "conforming" programs, 40# while level 2 enforces additional restrictions. 41DEFS += -D_FORTIFY_SOURCE=2 42# For mtrace debugging -- see MTRACE define in main.cc for instructions 43# Should only be enabled during debugging and not in any real release. 44# DEFS += -DMTRACE=1 45CXXFLAGS = @CXXFLAGS@ $(DBGFLAGS) $(CCOPT) $(DEFS) 46CPPFLAGS = @CPPFLAGS@ -I$(NBASEDIR) -I$(NSOCKDIR)/include 47export CFLAGS = $(CXXFLAGS) 48# CFLAGS = $(DEFS) $(INCLS) 49STATIC = 50LDFLAGS = @LDFLAGS@ $(DBGFLAGS) $(STATIC) 51OPENSSL_LIBS = @OPENSSL_LIBS@ 52LIBS = $(NSOCKDIR)/src/libnsock.a $(NBASEDIR)/libnbase.a ../libnetutil/libnetutil.a $(OPENSSL_LIBS) @LIBPCAP_LIBS@ @LIBDNET_LIBS@ @LIBS@ 53# LIBS = -lefence @LIBS@ 54# LIBS = -lrmalloc @LIBS@ 55INSTALL = @INSTALL@ 56# MAKEDEPEND = @MAKEDEPEND@ 57export RPMTDIR=$(HOME)/rpm 58 59 60# DESTDIR is used by some package maintainers to install Nping under 61# its usual directory structure into a different tree. See the 62# CHANGELOG for more info. 63DESTDIR = 64 65TARGET = nping 66 67 68export SRCS = ArgParser.cc common.cc common_modified.cc nping.cc NpingOps.cc utils.cc utils_net.cc output.cc stats.cc NpingTargets.cc NpingTarget.cc EchoHeader.cc EchoServer.cc EchoClient.cc ProbeMode.cc NEPContext.cc Crypto.cc 69 70export HDRS = ArgParser.h nping_config.h common.h common_modified.h nping.h NpingOps.h global_structures.h output.h utils.h utils_net.h stats.h NpingTargets.h NpingTarget.h EchoHeader.h EchoServer.h EchoClient.h ProbeMode.h NEPContext.h Crypto.h 71 72OBJS = ArgParser.o common.o common_modified.o nping.o NpingOps.o utils.o utils_net.o output.o stats.o NpingTargets.o NpingTarget.o EchoHeader.o EchoServer.o EchoClient.o ProbeMode.o NEPContext.o Crypto.o 73 74export DOCS2DIST = leet-nping-ascii-art.txt nping.1 nping-man.html 75 76export MISC2DIST = config.guess config.sub configure configure.ac Makefile.in TODO nping_config.h.in CHANGELOG LICENSE 77 78 79# %.o : %.cc -- nope this is a GNU extension 80.cc.o: 81 $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@ 82 83all: 84 $(MAKE) $(TARGET) 85 86$(TARGET): $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a ../libnetutil/libnetutil.a $(OBJS) 87 @echo Compiling nping 88 rm -f $@ 89 $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) 90 @echo Nping compiled successfully! 91 92 93# Make a statically compiled binary for portability between distributions 94static: 95 $(MAKE) STATIC=-static 96 97debug: 98 $(MAKE) DBGFLAGS="-O0 -g -pg -ftest-coverage -fprofile-arcs" 99 100# CALL THIS FROM ONE COMPUTER AND CHECK IN RESULTS BEFORE DOING ANYONE 101# DOES A MAKE RELEASE 102prerelease: 103 cd $(NPINGDEVDIR) && $(MAKE) prerelease 104 105# Generate the Nping distribution tarball 106generate-tarball: 107 cd nping-priv && ./create_tarballs.sh 108 109# Update the web site. WARNING: "make generate-tarball" must have been called first. 110web: 111 cd nping-priv && ./update_web.sh 112 113clean: 114 rm -f $(OBJS) $(TARGET) 115# Who generates dependencies.mk? If it is generated by ./configure and 116# not by make it should be moved to distclean 117 rm -f dependencies.mk 118 119debugclean: 120 rm -f *.gcov *.gcda *.gcno gmon.out 121 122distclean: clean 123 rm -f Makefile Makefile.bak makefile.dep nping_config.h stamp-h \ 124 stamp-h.in config.cache config.log config.status 125 126install-nping: $(TARGET) 127 $(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 128 $(INSTALL) -c -m 755 nping $(DESTDIR)$(bindir)/nping 129# Use strip -x to avoid stripping dynamically loaded NSE functions. See 130# http://seclists.org/nmap-dev/2007/q4/0272.html. 131 $(STRIP) -x $(DESTDIR)$(bindir)/nping 132 $(INSTALL) -c -m 644 docs/$(TARGET).1 $(DESTDIR)$(mandir)/man1/ 133 134 135 136install: install-nping 137 @echo "NPING SUCCESSFULLY INSTALLED" 138 139uninstall: uninstall-nping 140 141uninstall-nping: 142 rm -f $(DESTDIR)$(bindir)/$(TARGET) 143 rm -f $(DESTDIR)$(mandir)/man1/$(TARGET).1 144 145${srcdir}/configure: configure.ac 146 cd ${srcdir} && autoconf 147 148## autoheader might not change config.h.in, so touch a stamp file. 149#${srcdir}/config.h.in: stamp-h.in 150#${srcdir}/stamp-h.in: configure.ac acconfig.h \ 151# config.h.top config.h.bot 152# cd ${srcdir} && autoheader 153# echo timestamp > ${srcdir}/stamp-h.in 154# 155#config.h: stamp-h 156#stamp-h: config.h.in config.status 157# ./config.status 158 159Makefile: Makefile.in config.status 160 ./config.status 161 162config.status: configure 163 ./config.status --recheck 164 165makefile.dep: 166 $(CXX) -MM $(CPPFLAGS) $(SRCS) > $@ 167-include makefile.dep 168