# SUROOT      - If this is defined then the "su" utility is used to link
#               executables.  In some cases it will also cause the setuid
#               bit to be set.  When "su" is run it will ask for a password
#               if there is one.  SUROOT can most easily be defined by
#               creating an environment variable in $HOME/.profile.
#               Note that if you are linking as root and running as root then
#               there is no need to define this variable.

CC=cc -4 -mf -Wc,-s 
LD=$(CC) -T1

CFLAGS=-Osax -w4 -g3
CFLAGS+=-I../iolib
LDFLAGS+=-L../iolib -liomgr -g 

all: daq testdaq

daq: main.o create.o read.o proxy.o queue.o close.o killed.o qioctl.o hint.o 
ifndef SUROOT
	$(LD) $(LDFLAGS) -o $@ $^
else
	su -c "$(LD) $(LDFLAGS) -o $@ $^"
	su -c "chmod u+s pipe"
endif

hint.o: hint.c
	$(CC) $(CFLAGS) -c -o $@ $<

testdaq: testdaq.c
	$(CC) -o $@ $<

clean:
	-rm -f *.o *.err *.map daq testdaq 
