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