#####
# Makefile for WWW Access counter
# by Muhammad A Muquit
# 04/10/95, muquit@semcor.com
# http://www.semcor.com/~muquit/
# updated for Count 1.2 06/06/95, --muquit
# updated for Count 1.5 09/17/95, -- muquit
#####

#######################################################################
# if you are on a SYSV machine, add -DSYSV to CFLAGS
##

#######################################################################
# if you do not want Datafile locking facility, remove -DUSE_LOCK option
# from CFLAGS. Please Note, if you are on a SYSV machine and you use this
# option, you must also add -DSYSV option to CFLAGS
##

#######################################################################
# If you want to deny unauthorized access to the counter program add the
# flag -DACCESS_AUTH to CFLAGS. If you add this option, edit the 
# configuration file and a block with your host names. Please do not forget
# this, otherwise you will get unauthorized access denied message. Look at the
# sample count.conf file. 
##

#######################################################################
# If you do not want to create data file for user, add -DALLOW_FILE_CREATION
# flag to CFLAGS. If you compile with that flag, data file will be created
# if it does not exist and the value defined in run-time with st will be
# written to the data file. Make sure the data directory has write 
# permission for httpd
##

emx:
	$(MAKE) all CC="gcc -O -s -Zomf -Zsys -Zstack 512" O=".obj" X=".exe" \
	AR="emxomfar cr" RANLIB="emxomfar s" A=".lib" OUT="-o"
emx-debug:
	$(MAKE) all CC="gcc -g" O=".o" X=".exe" \
	AR="ar cr" RANLIB="ar s" A=".a" OUT="-o"
ibm:
	$(MAKE) all CC="icc -Wpro- -Ti -Gm" O=".obj" X=".exe" \
	AR="ilib" RANLIB="rem" A=".lib" OUT="-Fe"

CFLAGS = -DACCESS_AUTH -I. -I./combine

OBJS = main$O utils$O strimage$O

all: combine$A count$X

combine$A:
	$(MAKE) -C combine CC="$(CC)" O="$O" X="$X" \
	AR="$(AR)" RANLIB="$(RANLIB)" A="$A"

count$X: $(OBJS)
	$(CC) $(CFLAGS) $(OUT) $@ $(OBJS) combine/combine$A

main$O: main.c
	$(CC) $(CFLAGS) -c main.c

utils$O: utils.c
	$(CC) $(CFLAGS) -c utils.c

strimage$O: strimage.c
	$(CC) $(CFLAGS) -c strimage.c

main$O: count.h config.h
utils$O: count.h config.h

clean:
	$(MAKE) -C combine clean
	rm -f *$O count.exe core
