# only need to compile netscript with a single command, so this isn't going to
# look typical.
CC=gcc
ECHO=echo
RM=rm
CHMOD=chmod

all:
	@$(ECHO) "Usage: make <platform>, or <function>"
	@$(ECHO) "* where <platform> is: linux, bsd, obsd, irix, sunos, or generic."
	@$(ECHO) "* where <platform> is: glinux, gbsd, gobsd, girix, or gsunos. (gtk/gui)"
	@$(ECHO) "* where <function> is: clean."

# for the ./automake support. (using uname)
Linux: linux
FreeBSD: bsd
NetBSD: bsd
OpenBSD: obsd
BSD/OS: bsd
IRIX: irix
SunOS: sunos
# for any confusion.
Solaris: sunos
solaris: sunos
GLinux: glinux
GFreeBSD: gbsd
GNetBSD: gbsd
GOpenBSD: gobsd
GBSD/OS: gbsd
GIRIX: girix
GSunOS: gsunos
GSolaris: gsunos
Gsolaris: gsunos
# the make functions, mostly minor differences.
linux:
	@$(ECHO) "* Compiling linux-variant style modules..."
	@$(CC) nsansi.c -o nsansi -shared
	@$(CC) nssound.c -o nssound -shared

glinux:
	@$(ECHO) "* Compiling GTK-linux-variant style modules..."
	@$(CC) nsansi.c -o nsansi -shared -DGTK
	@$(CC) nssound.c -o nssound -shared

bsd:
	@$(ECHO) "* Compiling bsd-variant style modules..."
	@$(CC) nsansi.c -o nsansi -shared
	@$(CC) nssound.c -o nssound -shared

gbsd:
	@$(ECHO) "* Compiling GTK-bsd-variant style modules..."
	@$(CC) nsansi.c -o nsansi -shared -DGTK
	@$(CC) nssound.c -o nssound -shared

obsd:
	@$(ECHO) "* Compiling bsd-variant style modules..."
	@$(CC) -c nsansi.c -o nsansi
	@$(CC) -c nssound.c -o nssound

gobsd:
	@$(ECHO) "* Compiling GTK-bsd-variant style modules..."
	@$(CC) -c nsansi.c -o nsansi -DGTK
	@$(CC) -c nssound.c -o nssound

irix:
	@$(ECHO) "* Compiling irix-variant style modules..."
	@$(CC) nsansi.c -o nsansi -shared
	@$(CC) nssound.c -o nssound -shared

girix:
	@$(ECHO) "* Compiling GTK-irix-variant style modules..."
	@$(CC) nsansi.c -o nsansi -shared -DGTK
	@$(CC) nssound.c -o nssound -shared

sunos:
	@$(ECHO) "* Compiling sunos-variant style modules..."
	@$(CC) -c nsansi.c -o nsansi
	@$(CC) -c nssound.c -o nssound

gsunos:
	@$(ECHO) "* Compiling GTK-sunos-variant style modules..."
	@$(CC) -c nsansi.c -o nsansi -DGTK
	@$(CC) -c nssound.c -o nssound

generic:
	@$(ECHO) "* Compiling generic style modules..."
	@$(CC) nsansi.c -o nsansi -shared
	@$(CC) nssound.c -o nssound -shared

clean:
	@$(ECHO) "* Cleaning local netscript module file(s)..."
	@$(RM) -rf nsansi nssound
