# Makefile for sbox.
# 1. Change the definition of CGI_DIRECTORY to point to your site-wide
#    cgi-bin directory
# 2. Review the INSTALL_OPTS definitions if you need to (will install
#    sbox SUID to root)
# 3. Change CFLAGS and CC definitions if you need to.
# 4. "make"
# 5. "make install"
VERSION= 0.99

#CC = cc
CC = gcc
COPTS = -O2
# COPTS = -g -DDEBUG

CFLAGS = -Wall $(COPTS) -DVERSION=$(VERSION)
INSTALL = install
INSTALL_OPTS = -o root -g bin -m 4111 -s
INSTALL_DIRECTORY = /home/www/cgi-bin

all: sbox env

sbox: sbox.o
	$(CC) $(LDOPTS) -o sbox sbox.o

sbox.o: sbox.c sbox.h Makefile

env: env.o
	$(CC) -static -o env env.o

clean:
	rm -f *.o core sbox

install: sbox
	$(INSTALL) $(INSTALL_OPTS) sbox $(INSTALL_DIRECTORY)

dist:
	-mkdir sbox-$(VERSION)
	cp README.html README.txt sbox.h sbox.c env.c Makefile sbox-$(VERSION)
	tar cvf - sbox-$(VERSION) | gzip -9c > sbox-$(VERSION).tgz
	rm -rf sbox-$(VERSION)
