summaryrefslogtreecommitdiffstats
path: root/rules/netcat.make
blob: 4beba6c997ae6b53dccbb07009aa5c2c1b07009b (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
# -*-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_NETCAT
PACKAGES += netcat
endif

#
# Paths and names 
#
NETCAT			= netcat-1.10
NETCAT_FILE		= nc110
NETCAT_URL		= http://www.securityfocus.com/data/tools/nc110.tgz
NETCAT_SOURCE		= $(SRCDIR)/$(NETCAT_FILE).tgz
NETCAT_DIR		= $(BUILDDIR)/$(NETCAT)

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

netcat_get: $(STATEDIR)/netcat.get

netcat_get_deps  =  $(NETCAT_SOURCE)

$(STATEDIR)/netcat.get: $(netcat_get_deps)
	@$(call targetinfo, $@)
	@$(call get_patches, $(NETCAT))
	touch $@

$(NETCAT_SOURCE):
	@$(call targetinfo, $@)
	@$(call get, $(NETCAT_URL))

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

netcat_extract: $(STATEDIR)/netcat.extract

$(STATEDIR)/netcat.extract: $(STATEDIR)/netcat.get
	@$(call targetinfo, $@)
	@$(call clean, $(NETCAT_DIR))
	@$(call extract, $(NETCAT_SOURCE), $(NETCAT_DIR))
	@$(call patchin, $(NETCAT))
	touch $@

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

netcat_prepare: $(STATEDIR)/netcat.prepare

netcat_prepare_deps = \
	$(STATEDIR)/virtual-xchain.install \
	$(STATEDIR)/libpcap.install \
	$(STATEDIR)/netcat.extract

$(STATEDIR)/netcat.prepare: $(netcat_prepare_deps)
	@$(call targetinfo, $@)
	touch $@

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

netcat_compile: $(STATEDIR)/netcat.compile

netcat_compile_deps = $(STATEDIR)/netcat.prepare

NETCAT_PATH	= PATH=$(CROSS_PATH)
NETCAT_MAKEVARS	= CC="$(PTXCONF_COMPILER_PREFIX)gcc -DLINUX -lresolv"

$(STATEDIR)/netcat.compile: $(netcat_compile_deps) 
	@$(call targetinfo, $@)
	$(NETCAT_PATH) make $(NETCAT_MAKEVARS) nc -C $(NETCAT_DIR) 
	touch $@

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

netcat_install: $(STATEDIR)/netcat.install

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

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

netcat_targetinstall: $(STATEDIR)/netcat.targetinstall

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

	@$(call install_init,default)
	@$(call install_fixup,PACKAGE,netcat)
	@$(call install_fixup,PRIORITY,optional)
	@$(call install_fixup,VERSION,$(NETCAT_VERSION))
	@$(call install_fixup,SECTION,base)
	@$(call install_fixup,AUTHOR,"Robert Schwebel <r.schwebel\@pengutronix.de>")
	@$(call install_fixup,DEPENDS,)
	@$(call install_fixup,DESCRIPTION,missing)

	@$(call install_copy, 0, 0, 0755, $(NETCAT_DIR)/nc, /bin/nc)

	@$(call install_finish)

	touch $@

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

netcat_clean: 
	rm -rf $(STATEDIR)/netcat.* $(NETCAT_DIR)
	rm -fr $(IMAGEDIR)/netcat_*

# vim: syntax=make