#You may wish to add -DNO_UNISTD and -DNO_SYSTEM to CFLAGS if
#your system lacks the /usr/include/unistd.h header file
#or the system() function, respectively. Non-unix systems
#will also definitely have different linker syntax.

CFLAGS=-Wall
CC=gcc
AR=ar
LIBS=-L./ -lcgic
ALL=libcgic.a clic_control

all: $(ALL)

libcgic.a: cgic.o cgic.h
	rm -f libcgic.a
	$(AR) rc libcgic.a cgic.o

clean:
	rm -f *.o *.a $(ALL) *~ testdev* core *.cgi

clic_control: main.o matrix_control.o libcgic.a templates.o utility.o comm.o
	gcc $? -o clic_control.cgi ${LIBS}
	chmod a+rx clic_control.cgi
	mv clic_control.cgi ../install/cgi-bin/
	chmod a+x ../install/cgi-bin/settings
	chmod a+x ../install/cgi-bin/tpl
	chmod a+x ../install/cgi-bin/session
	chmod a+w ../install/cgi-bin/settings/list.txt
	chmod a+w ../install/cgi-bin/session/lock

makefifo:
	mknod -m a=rw ../install/cgi-bin/testdev1 p
	mknod -m a=rw ../install/cgi-bin/testdev2 p
	mknod -m a=rw ../install/cgi-bin/testdev3 p

