1# only need to compile netscript with a single command, so this isn't going to
2# look typical. (probably should have though, at this point)
3CC=gcc
4MAKE=make
5ECHO=echo
6LN=ln
7RM=rm
8CHMOD=chmod
9# odd isn't it? this will be more multi-platformed, just one file anyways.
10INSTALL=cp
11BINDIR=/usr/bin
12
13all:
14	@$(ECHO) "Usage: make <platform>, or <function>"
15	@$(ECHO) "* where <platform> is: linux, bsd, bsdi, irix, sunos, generic, or bare."
16	@$(ECHO) "* where <platform> is: nlinux, nbsd, nbsdi, nirix, or nsunos. (ncurses)"
17	@$(ECHO) "* where <platform> is: glinux, gbsd, gbsdi, girix, or gsunos. (gtk)"
18	@$(ECHO) "* where <platform> is: gnlinux, gnbsd, gnbsdi, gnirix, or gnsunos. (gtk+ncurses)"
19	@$(ECHO) "* where <function> is: install, clean, or cleanall."
20
21# for the ./automake support. (using uname)
22Linux: linux
23FreeBSD: bsd
24NetBSD: bsd
25OpenBSD: bsd
26BSD/OS: bsdi
27IRIX: irix
28SunOS: sunos
29# for any confusion.
30Solaris: sunos
31solaris: sunos
32NLinux: nlinux
33NFreeBSD: nbsd
34NNetBSD: nbsd
35NOpenBSD: nbsd
36NBSD/OS: nbsdi
37NIRIX: nirix
38NSunOS: nsunos
39NSolaris: nsunos
40Nsolaris: nsunos
41GLinux: glinux
42GFreeBSD: gbsd
43GNetBSD: gbsd
44GOpenBSD: gbsd
45GBSD/OS: gbsdi
46GIRIX: girix
47GSunOS: gsunos
48GSolaris: gsunos
49Gsolaris: gsunos
50GNLinux: gnlinux
51GNFreeBSD: gnbsd
52GNNetBSD: gnbsd
53GNOpenBSD: gnbsd
54GNBSD/OS: gnbsdi
55GNIRIX: gnirix
56GNSunOS: gnsunos
57GNSolaris: gnsunos
58GNsolaris: gnsunos
59# for auto-* link.
60Ninstall: install ninstall
61Ginstall: install ginstall
62GNinstall: install ginstall ninstall
63# the make functions, mostly minor differences.
64linux:
65	@$(ECHO) "* Compiling linux-variant style netscript..."
66	@$(CC) netscript.c -o netscript -rdynamic -lc -ldl -DARPA -DLINUX_T
67
68nlinux:
69	@$(ECHO) "* Compiling NCURSES-linux-variant style netscript..."
70	@$(CC) netscript.c -o netscript -rdynamic -lc -ldl -DARPA -DLINUX_T -DNCURSES -lcurses
71
72glinux:
73	@$(ECHO) "* Compiling GTK-linux-variant style netscript..."
74	@$(CC) netscript.c -o netscript -rdynamic -lc -ldl -DARPA -DLINUX_T -DGTK `gtk-config --cflags --libs gthread`
75
76gnlinux:
77	@$(ECHO) "* Compiling GTK-NCURSES-linux-variant style netscript..."
78	@$(CC) netscript.c -o netscript -rdynamic -lc -ldl -DARPA -DLINUX_T -DGTK `gtk-config --cflags --libs gthread` -DNCURSES -lcurses
79
80bsd:
81	@$(ECHO) "* Compiling bsd-variant style netscript..."
82	@$(CC) netscript.c -o netscript -rdynamic -lc -DARPA -DBSD_T
83
84nbsd:
85	@$(ECHO) "* Compiling NCURSES-bsd-variant style netscript..."
86	@$(CC) netscript.c -o netscript -rdynamic -lc -DARPA -DBSD_T -DNCURSES -lcurses
87
88gbsd:
89	@$(ECHO) "* Compiling GTK-bsd-variant style netscript..."
90	@$(CC) netscript.c -o netscript -rdynamic -lc -DARPA -DBSD_T -DGTK `gtk-config --cflags --libs gthread`
91
92gnbsd:
93	@$(ECHO) "* Compiling GTK-NCURSES-bsd-variant style netscript..."
94	@$(CC) netscript.c -o netscript -rdynamic -lc -DARPA -DBSD_T -DGTK `gtk-config --cflags --libs gthread` -DNCURSES -lcurses
95
96bsdi:
97	@$(ECHO) "* Compiling bsd-variant style netscript..."
98	@$(CC) netscript.c -o netscript -rdynamic -lc -ldl -DARPA -DBSD_T
99
100nbsdi:
101	@$(ECHO) "* Compiling NCURSES-bsd-variant style netscript..."
102	@$(CC) netscript.c -o netscript -rdynamic -lc -ldl -DARPA -DBSD_T -DNCURSES -lcurses
103
104gbsdi:
105	@$(ECHO) "* Compiling GTK-bsd-variant style netscript..."
106	@$(CC) netscript.c -o netscript -rdynamic -lc -ldl -DARPA -DBSD_T -DGTK `gtk-config --cflags --libs gthread`
107
108gnbsdi:
109	@$(ECHO) "* Compiling GTK-NCURSES-bsd-variant style netscript..."
110	@$(CC) netscript.c -o netscript -rdynamic -lc -ldl -DARPA -DBSD_T -DGTK `gtk-config --cflags --libs gthread` -DNCURSES -lcurses
111
112irix:
113	@$(ECHO) "* Compiling irix-variant style netscript..."
114	@$(CC) netscript.c -o netscript -lc -DARPA -DIRIX_T
115
116nirix:
117	@$(ECHO) "* Compiling NCURSES-irix-variant style netscript..."
118	@$(CC) netscript.c -o netscript -lc -DARPA -DIRIX_T -DNCURSES -lcurses
119
120girix:
121	@$(ECHO) "* Compiling GTK-irix-variant style netscript..."
122	@$(CC) netscript.c -o netscript -lc -DARPA -DIRIX_T -DGTK `gtk-config --cflags --libs gthread`
123
124gnirix:
125	@$(ECHO) "* Compiling GTK-NCURSES-irix-variant style netscript..."
126	@$(CC) netscript.c -o netscript -lc -DARPA -DIRIX_T -DGTK `gtk-config --cflags --libs gthread` -DNCURSES -lcurses
127
128sunos:
129	@$(ECHO) "* Compiling sunos-variant style netscript..."
130	@$(CC) netscript.c -o netscript -lc -ldl -lnsl -lsocket -DARPA -DSUNOS_T
131
132nsunos:
133	@$(ECHO) "* Compiling NCURSES-sunos-variant style netscript..."
134	@$(CC) netscript.c -o netscript -lc -ldl -lnsl -lsocket -DARPA -DSUNOS_T -DNCURSES -lcurses
135
136gsunos:
137	@$(ECHO) "* Compiling GTK-sunos-variant style netscript..."
138	@$(CC) netscript.c -o netscript -lc -ldl -lnsl -lsocket -DARPA -DSUNOS_T -DGTK `gtk-config --cflags --libs gthread`
139
140gnsunos:
141	@$(ECHO) "* Compiling GTK-NCURSES-sunos-variant style netscript..."
142	@$(CC) netscript.c -o netscript -lc -ldl -lnsl -lsocket -DARPA -DSUNOS_T -DGTK `gtk-config --cflags --libs gthread` -DNCURSES -lcurses
143
144generic:
145	@$(ECHO) "* Compiling generic style netscript..."
146	@$(CC) netscript.c -o netscript -rdynamic -lc -ldl -DARPA
147
148bare:
149	@$(ECHO) "* Compiling bare style netscript..."
150	@$(CC) netscript.c -o netscript -DDISABLE_MODULES -DDISABLE_SRCIP -DDISABLE_SYSLOG
151
152install:
153	@$(ECHO) "* Installing netscript to bin directory, and linking..."
154	@$(INSTALL) netscript $(BINDIR)
155	@$(CHMOD) 755 $(BINDIR)/netscript
156	@$(LN) -sf $(BINDIR)/netscript $(BINDIR)/ns
157
158ninstall:
159	@$(ECHO) "* Installing netscript auto-NCURSES link to bin directory..."
160	@$(LN) -sf $(BINDIR)/netscript $(BINDIR)/nnetscript
161
162ginstall:
163	@$(ECHO) "* Installing netscript auto-GTK link to bin directory..."
164	@$(LN) -sf $(BINDIR)/netscript $(BINDIR)/gnetscript
165
166gninstall:
167	@$(ECHO) "* Installing netscript auto-GTK-NCURSES link to bin directory..."
168	@$(LN) -sf $(BINDIR)/netscript $(BINDIR)/nnetscript
169	@$(LN) -sf $(BINDIR)/netscript $(BINDIR)/gnetscript
170
171clean:
172	@$(ECHO) "* Cleaning local netscript file(s)..."
173	@$(RM) -rf netscript
174
175cleanall:
176	@$(ECHO) "* Cleaning global netscript file(s)..."
177	@$(RM) -rf netscript $(BINDIR)/netscript $(BINDIR)/ns $(BINDIR)/nnetscript $(BINDIR)/gnetscript
178	@$(RM) -rf /usr/share/man/man1/netscript.1.gz /usr/share/man/man1/gnetscript.1.gz /usr/share/man/man1/ns.1.gz
179
180