1
# makefile for netcat, based off same ol' "generic makefile".
2
# Usually do "make systype" -- if your systype isn't defined, try "generic"
3
# or something else that most closely matches, see where it goes wrong, fix
4
# it, and MAIL THE DIFFS back to Hobbit.
5
6
### PREDEFINES
7
8
# DEFAULTS, possibly overridden by <systype> recursive call:
9
# pick gcc if you'd rather , and/or do -g instead of -O if debugging
10
# debugging
11
# DFLAGS = -DTEST -DDEBUG
12
CFLAGS = -O
13
XFLAGS = 	# xtra cflags, set by systype targets
14
XLIBS =		# xtra libs if necessary?
15
# -Bstatic for sunos,  -static for gcc, etc.  You want this, trust me.
16
STATIC =
17
CC = cc $(CFLAGS)
18
LD = $(CC) -s	# linker; defaults to stripped executables
19
o = o		# object extension
20
21
ALL = nc
22
23
### BOGON-CATCHERS
24
25
bogus:
26
	@echo "Usage:  make  <systype>  [options]"
27
28
### HARD TARGETS
29
30
nc:	netcat.c
31
	$(LD) $(DFLAGS) $(XFLAGS) $(STATIC) -o nc netcat.c $(XLIBS)
32
33
nc-dos:
34
	@echo "DOS?!  Maybe someday, but not now"
35
36
### SYSTYPES -- in the same order as in generic.h, please
37
38
# designed for msc and nmake, but easy to change for your compiler.
39
# Recursive make may fail if you're short on memory -- u-fix!
40
# Note special hard-target and "quotes" instead of 'quotes' ...
41
dos:
42
	$(MAKE) -e $(ALL)-dos $(MFLAGS) CC="cl /nologo" XLIBS= \
43
	XFLAGS="/AS -D__MSDOS__ -DMSDOS"  o=obj
44
45
ultrix:
46
	make -e $(ALL) $(MFLAGS) XFLAGS='-DULTRIX'
47
48
# you may need XLIBS='-lresolv -l44bsd' if you have BIND 4.9.x
49
sunos:
50
	make -e $(ALL) $(MFLAGS) XFLAGS='-DSUNOS' STATIC=-Bstatic \
51
	XLIBS='-lresolv'
52
53
# Pick this one ahead of "solaris" if you actually have the nonshared
54
# libraries [lib*.a] on your machine.  By default, the Sun twits don't ship
55
# or install them, forcing you to use shared libs for any network apps.
56
# Kludged for gcc, which many regard as the only thing available.
57
solaris-static:
58
	make -e $(ALL) $(MFLAGS) XFLAGS='-DSYSV=4 -D__svr4__ -DSOLARIS' \
59
	CC=gcc STATIC=-static XLIBS='-lnsl -lsocket -lresolv'
60
61
# the more usual shared-lib version...
62
solaris:
63
	make -e $(ALL) $(MFLAGS) XFLAGS='-DSYSV=4 -D__svr4__ -DSOLARIS' \
64
	CC=gcc STATIC= XLIBS='-lnsl -lsocket -lresolv'
65
66
aix:
67
	make -e $(ALL) $(MFLAGS) XFLAGS='-DAIX'
68
69
linux:
70
	make -e $(ALL) $(MFLAGS) XFLAGS='-DLINUX' STATIC=-static
71
72
# irix 5.2, dunno 'bout earlier versions.  If STATIC='-non_shared' doesn't
73
# work for you, null it out and yell at SGI for their STUPID default
74
# of apparently not installing /usr/lib/nonshared/*.  Sheesh.
75
irix:
76
	make -e $(ALL) $(MFLAGS) XFLAGS='-DIRIX -DSYSV=4 -D__svr4__' \
77
	STATIC=-non_shared
78
79
osf:
80
	make -e $(ALL) $(MFLAGS) XFLAGS='-DOSF' STATIC=-non_shared
81
82
# virtually the same as netbsd/bsd44lite/whatever
83
freebsd:
84
	make -e $(ALL) $(MFLAGS) XFLAGS='-DFREEBSD' STATIC=-static
85
86
bsdi:
87
	make -e $(ALL) $(MFLAGS) XFLAGS='-DBSDI' STATIC=-Bstatic
88
89
netbsd:
90
	make -e $(ALL) $(MFLAGS) XFLAGS='-DNETBSD' STATIC=-static
91
92
# finally got to an hpux box, which turns out to be *really* warped. 
93
# STATIC here means "linker subprocess gets args '-a archive'" which causes
94
# /lib/libc.a to be searched ahead of '-a shared', or /lib/libc.sl.
95
hpux:
96
	make -e $(ALL) $(MFLAGS) XFLAGS='-DHPUX' STATIC="-Wl,-a,archive"
97
98
# unixware from bmc@telebase.com; apparently no static because of the
99
# same idiotic lack of link libraries
100
unixware:
101
	make -e $(ALL) $(MFLAGS) XFLAGS='-DUNIXWARE -DSYSV=4 -D__svr4__' \
102
	STATIC= XLIBS='-L/usr/lib -lnsl -lsocket -lresolv'
103
104
# from Declan Rieb at sandia, for a/ux 3.1.1 [also suggests using gcc]:
105
aux:
106
	make -e $(ALL) $(MFLAGS) XFLAGS='-DAUX' STATIC=-static CC=gcc
107
108
# Nexstep from mudge: NeXT cc is really old gcc
109
next:
110
	make -e $(ALL) $(MFLAGS) XFLAGS='-DNEXT' STATIC=-Bstatic
111
112
# start with this for a new architecture, and see what breaks.
113
generic:
114
	make -e $(ALL) $(MFLAGS) XFLAGS='-DGENERIC' STATIC=
115
116
# Still at large: dgux dynix ???
117
118
### RANDOM
119
120
clean:
121
	rm -f $(ALL) *.o *.obj