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
|
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
mandir = @mandir@
srcdir = @srcdir@
libdir = @libdir@/nmap
CC = @CC@
CCOPT =
LIBPCAPDIR = @libpcapdir@
INCLS = -I. -I$(LIBPCAPDIR)
DEFS = @DEFS@ -DVERSION=\"$(VERSION)\" -DLIBDIR=\"$(libdir)\"
CFLAGS = @CFLAGS@ $(CCOPT) $(DEFS) $(INCLS)
# CFLAGS = -g -Wall $(DEFS) $(INCLS)
STATIC =
LDFLAGS = @LDFLAGS@ $(STATIC)
LIBS = @LIBS@ -lpcap -lm
INSTALL = @INSTALL@
MAKEDEPEND = @MAKEDEPEND@
RPMTDIR=$(HOME)/rpmdir
VERSION = 2.12
TARGET = nmap
SRCS = nmap.c targets.c tcpip.c error.c utils.c osscan.c charpool.c services.c @COMPAT_SRCS@
OBJS = nmap.o targets.o tcpip.o error.o utils.o osscan.o charpool.o services.o @COMPAT_OBJS@
DEPS = nmap.h error.h targets.h osscan.h tcpip.h utils.h global_structures.h charpool.h services.h
all: $(TARGET)
$(TARGET): $(DEPS) @PCAP_DEPENDS@ $(OBJS)
@echo Compiling nmap
rm -f $@
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(LIBPCAPDIR)/libpcap.a: $(LIBPCAPDIR)/Makefile
@echo Compiling libpcap; cd $(LIBPCAPDIR); $(MAKE)
$(LIBPCAPDIR)/Makefile:
@echo Configuring libpcap; cd $(LIBPCAPDIR); ./configure --prefix=/usr
ci: checkin
checkin:
ci -u Makefile nmap.c targets.c nmap.h tcpip.c tcpip.h error.c error.h utils.c utils.h inet_aton.c configure.in config.h.in Makefile.in configure install-sh config.guess config.sub
# This target is just for me ... don't you get any ideas --Fyodor
distro:
autoconf
rm -f config.cache
./configure
cd $(LIBPCAPDIR) && ./configure
$(MAKE) clean
$(MAKE) static
$(MAKE)
./nmap -h > /dev/null #Make sure nmap exists
rm -f docs/nmap.usage.txt
./nmap -h > docs/nmap.usage.txt
rm -f docs/nmap_manpage.html
nroff -man docs/nmap.1 | man2html -title 'Nmap network security scanner man page' > docs/nmap_manpage.html
rm -rf /usr/tmp/nmap-$(VERSION)
mkdir /usr/tmp/nmap-$(VERSION)
# Make the RPM .spec file
sed -e s/\@VERSION\@/$(VERSION)/g nmap.spec.in > nmap-$(VERSION)-1.spec
$(MAKE) clean
rm -f $(LIBPCAPDIR)/config.cache $(LIBPCAPDIR)/Makefile
cp -ra $(SRCS) $(DEPS) inet_aton.c snprintf.c nmap-os-fingerprints \
nmap-services \
configure.in config.h.in Makefile.in configure install-sh \
config.guess nmap-$(VERSION)-1.spec config.sub INSTALL docs \
COPYING CHANGELOG \
$(LIBPCAPDIR) /usr/tmp/nmap-$(VERSION)
# Kill the CVS crap
find /usr/tmp/nmap-$(VERSION) -type d -name CVS | xargs rm -rf
cd /usr/tmp; \
tar czf nmap-$(VERSION).tgz nmap-$(VERSION)
# Make the actual RPM
rpm -ta /usr/tmp/nmap-$(VERSION).tgz
cp -f $(RPMTDIR)/RPMS/i386/nmap-$(VERSION)-1.i386.rpm /usr/tmp
cp -f $(RPMTDIR)/SRPMS/nmap-$(VERSION)-1.src.rpm /usr/tmp
rm -rf /usr/tmp/nmap-$(VERSION)
# For distributing the binary
static:
cd $(LIBPCAPDIR); $(MAKE)
$(CC) $(CFLAGS) -static $(LDFLAGS) -o nmap.linux.bin $(SRCS) $(LIBS)
strip nmap.linux.bin
clean: @PCAP_CLEAN@ my_clean
my_clean:
rm -f $(OBJS) $(TARGET)
pcap_clean:
cd $(LIBPCAPDIR); $(MAKE) clean
pcap_dist_clean:
cd $(LIBPCAPDIR); $(MAKE) distclean
distclean: my_clean my_distclean @PCAP_DIST_CLEAN@
my_distclean:
rm -f Makefile Makefile.bak config.h stamp-h stamp-h.in \
config.cache config.log config.status
depend:
$(MAKEDEPEND) $(INCLS) -s "# DO NOT DELETE" -- $(DEFS) -- $(SRCS)
install: all
$(INSTALL) -d $(bindir)
$(INSTALL) -d $(mandir)
$(INSTALL) -d $(mandir)/man1
$(INSTALL) -d $(libdir)
$(INSTALL) -m 755 $(TARGET) $(bindir)/$(TARGET)
$(INSTALL) -m 644 docs/$(TARGET).1 $(mandir)/man1/$(TARGET).1
$(INSTALL) -m 644 nmap-os-fingerprints $(libdir)/nmap-os-fingerprints
$(INSTALL) -m 644 nmap-services $(libdir)/nmap-services
uninstall:
rm -f $(bindir)/$(TARGET)
${srcdir}/configure: configure.in
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.in 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
# DO NOT DELETE -- Needed by makedepend
|