summaryrefslogtreecommitdiffstats
path: root/rules/nmap.make
blob: d54cf493228fc132eec314577fadcc6d39353049 (plain)
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
# -*-makefile-*-
# $id$
#
# Copyright (C) 2003 Ixia Corporation (www.ixiacom.com), by Milan Bobde
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
ifdef PTXCONF_NMAP
PACKAGES += nmap
endif

#
# Paths and names 
#
NMAP			= nmap-3.46
NMAP_URL		= http://download.insecure.org/nmap/dist/nmap-3.46.tgz
NMAP_SOURCE		= $(SRCDIR)/$(NMAP).tgz
NMAP_DIR		= $(BUILDDIR)/$(NMAP)

# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

nmap_get: $(STATEDIR)/nmap.get

nmap_get_deps  =  $(NMAP_SOURCE)

$(STATEDIR)/nmap.get: $(nmap_get_deps)
	@$(call targetinfo, $@)
	touch $@

$(NMAP_SOURCE):
	@$(call targetinfo, $@)
	@$(call get, $(NMAP_URL))

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

nmap_extract: $(STATEDIR)/nmap.extract

$(STATEDIR)/nmap.extract: $(STATEDIR)/nmap.get
	@$(call targetinfo, $@)
	@$(call clean, $(NMAP_DIR))
	@$(call extract, $(NMAP_SOURCE))
	touch $@

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

nmap_prepare: $(STATEDIR)/nmap.prepare

NMAP_AUTOCONF	=  --prefix=/usr
NMAP_AUTOCONF	+= --build=$(GNU_HOST)
NMAP_AUTOCONF	+= --host=$(PTXCONF_GNU_TARGET)
NMAP_AUTOCONF	+= --with-pcap=linux 

NMAP_PATH	=  PATH=$(CROSS_PATH)
NMAP_ENV	=  $(CROSS_ENV)
NMAP_ENV   	+= ac_cv_linux_vers=$(KERNEL_VERSION_MAJOR)

nmap_prepare_deps = \
	$(STATEDIR)/virtual-xchain.install \
	$(STATEDIR)/nmap.extract \
	$(STATEDIR)/libpcap.install

ifdef PTXCONF_OPENSSL_SHARED
NMAP_AUTOCONF		+= --with-openssl
nmap_prepare_deps	+= $(STATEDIR)/openssl.install
else
NMAP_AUTOCONF		+= --without-openssl
endif

$(STATEDIR)/nmap.prepare: $(nmap_prepare_deps)
	@$(call targetinfo, $@)
	cd $(NMAP_DIR) && \
		$(NMAP_PATH) $(NMAP_ENV) \
		./configure $(NMAP_AUTOCONF)
#
# Kludge:
# touch 3 files to avoid cross build failure
#
	touch $(NMAP_DIR)/libpcre/dftables.o
	sleep 1
	touch $(NMAP_DIR)/libpcre/dftables
	sleep 1
	touch $(NMAP_DIR)/libpcre/chartables.c

	touch $@

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

nmap_compile: $(STATEDIR)/nmap.compile

nmap_compile_deps = $(STATEDIR)/nmap.prepare

$(STATEDIR)/nmap.compile: $(nmap_compile_deps) 
	@$(call targetinfo, $@)
	$(NMAP_PATH) make -C $(NMAP_DIR) nmap
	touch $@

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

nmap_install: $(STATEDIR)/nmap.install

$(STATEDIR)/nmap.install: $(STATEDIR)/nmap.compile
	@$(call targetinfo, $@)
	touch $@

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

nmap_targetinstall: $(STATEDIR)/nmap.targetinstall

$(STATEDIR)/nmap.targetinstall: $(STATEDIR)/nmap.install
	@$(call targetinfo, $@)

	install -d $(ROOTDIR)/usr/bin

	install $(NMAP_DIR)/nmap $(ROOTDIR)/usr/bin/nmap
	touch $@

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

nmap_clean: 
	rm -rf $(STATEDIR)/nmap.* $(NMAP_DIR)

# vim: syntax=make