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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
# Extract the version string from nping.h.
export NPING_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NPING_VERSION' nping.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q')
NPING_NAME= Nping
NPING_URL= https://nmap.org/nping
NPING_PLATFORM=@host@
prefix = @prefix@
datarootdir = @datarootdir@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
mandir = @mandir@
srcdir = @srcdir@
npingdatadir = @datadir@/nping
NPINGDEVDIR=~/nping-private-dev
WIN32STUFFDIR=mswin32
NPINGWEBDIR=../../../web/nmap/nping
NPINGWININSTDIR=mswin32/nsis
export RELEASE_DATE := $(shell date +"%b %d, %Y")
export NBASEDIR=../nbase
export NSOCKDIR=../nsock
export NDIR=$(shell pwd)
CC = @CC@
CXX = @CXX@
CCOPT =
DBGFLAGS =
STRIP = @STRIP@
LIBPCAPDIR = @libpcapdir@
export LIBDNETDIR = @LIBDNETDIR@
DEFS = @DEFS@ -DNPING_NAME=\"$(NPING_NAME)\" -DNPING_URL=\"$(NPING_URL)\" -DNPING_PLATFORM=\"$(NPING_PLATFORM)\"
# With GCC, add extra security checks to source code.
# http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
# Level 1 only makes changes that don't affect "conforming" programs,
# while level 2 enforces additional restrictions.
DEFS += -D_FORTIFY_SOURCE=2
# For mtrace debugging -- see MTRACE define in main.cc for instructions
# Should only be enabled during debugging and not in any real release.
# DEFS += -DMTRACE=1
CXXFLAGS = @CXXFLAGS@ $(DBGFLAGS) $(CCOPT) $(DEFS)
CPPFLAGS = @CPPFLAGS@ -I$(NBASEDIR) -I$(NSOCKDIR)/include
export CFLAGS = $(CXXFLAGS)
# CFLAGS = $(DEFS) $(INCLS)
STATIC =
LDFLAGS = @LDFLAGS@ $(DBGFLAGS) $(STATIC)
OPENSSL_LIBS = @OPENSSL_LIBS@
LIBS = $(NSOCKDIR)/src/libnsock.a $(NBASEDIR)/libnbase.a ../libnetutil/libnetutil.a $(OPENSSL_LIBS) @LIBPCAP_LIBS@ @LIBDNET_LIBS@ @LIBS@
# LIBS = -lefence @LIBS@
# LIBS = -lrmalloc @LIBS@
INSTALL = @INSTALL@
# MAKEDEPEND = @MAKEDEPEND@
export RPMTDIR=$(HOME)/rpm
# DESTDIR is used by some package maintainers to install Nping under
# its usual directory structure into a different tree. See the
# CHANGELOG for more info.
DESTDIR =
TARGET = nping
export 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
export 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
OBJS = 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
export DOCS2DIST = leet-nping-ascii-art.txt nping.1 nping-man.html
export MISC2DIST = config.guess config.sub configure configure.ac Makefile.in TODO nping_config.h.in CHANGELOG LICENSE
# %.o : %.cc -- nope this is a GNU extension
.cc.o:
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
all:
$(MAKE) $(TARGET)
$(TARGET): $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a ../libnetutil/libnetutil.a $(OBJS)
@echo Compiling nping
rm -f $@
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
@echo Nping compiled successfully!
# Make a statically compiled binary for portability between distributions
static:
$(MAKE) STATIC=-static
debug:
$(MAKE) DBGFLAGS="-O0 -g -pg -ftest-coverage -fprofile-arcs"
# CALL THIS FROM ONE COMPUTER AND CHECK IN RESULTS BEFORE DOING ANYONE
# DOES A MAKE RELEASE
prerelease:
cd $(NPINGDEVDIR) && $(MAKE) prerelease
# Generate the Nping distribution tarball
generate-tarball:
cd nping-priv && ./create_tarballs.sh
# Update the web site. WARNING: "make generate-tarball" must have been called first.
web:
cd nping-priv && ./update_web.sh
clean:
rm -f $(OBJS) $(TARGET)
# Who generates dependencies.mk? If it is generated by ./configure and
# not by make it should be moved to distclean
rm -f dependencies.mk
debugclean:
rm -f *.gcov *.gcda *.gcno gmon.out
distclean: clean
rm -f Makefile Makefile.bak makefile.dep nping_config.h stamp-h \
stamp-h.in config.cache config.log config.status
install-nping: $(TARGET)
-$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
$(INSTALL) -c -m 755 nping $(DESTDIR)$(bindir)/nping
# Use strip -x to avoid stripping dynamically loaded NSE functions. See
# http://seclists.org/nmap-dev/2007/q4/0272.html.
$(STRIP) -x $(DESTDIR)$(bindir)/nping
$(INSTALL) -c -m 644 docs/$(TARGET).1 $(DESTDIR)$(mandir)/man1/
install: install-nping
@echo "NPING SUCCESSFULLY INSTALLED"
uninstall: uninstall-nping
uninstall-nping:
rm -f $(DESTDIR)$(bindir)/$(TARGET)
rm -f $(DESTDIR)$(mandir)/man1/$(TARGET).1
${srcdir}/configure: configure.ac
cd ${srcdir} && autoconf
## autoheader might not change config.h.in, so touch a stamp file.
#${srcdir}/config.h.in: stamp-h.in
#${srcdir}/stamp-h.in: configure.ac acconfig.h \
# config.h.top config.h.bot
# cd ${srcdir} && autoheader
# echo timestamp > ${srcdir}/stamp-h.in
#
#config.h: stamp-h
#stamp-h: config.h.in config.status
# ./config.status
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
makefile.dep:
$(CXX) -MM $(CPPFLAGS) $(SRCS) > $@
-include makefile.dep
|