# Makefile for analog 3.0
# Please read docs/Readme.html, or http://www.statslab.cam.ac.uk/~sret1/analog/
CC = gcc           # which compiler to use: eg cc, acc, gcc. NB Different
#                    compilers need different CFLAGS, e.g., -O instead of -O2.
CFLAGS = -O2       # options, e.g. for optimisation or ANSI compilation.
#                    HP/UX cc needs -Aa
#                    Some Linuces might need -I/usr/src/linux/include
DEFS =             # any of -DNOPIPES -DNODNS -DNODIRENT -DNOSTRCMP -DEBCDIC
OS = UNIX          # Operating system: UNIX, DOS, WIN32, MAC, OS2, VMS
#                    RISCOS, BEOS, BS2000
LIBS =             # extra libraries needed; Solaris 2 (SunOS 5) needs
#                    LIBS = -lnsl and SCO Unix needs LIBS = -lsocket
#                    IRIX reportedly needs LIBS = -lc
#                    OS/2 with EMX requires LIBS = -lsocket; so does BS2000/OSD
#                    SVR4 requires LIBS = -lsocket -lnsl

PROGRAM = analog
SOURCES = alias.c analog.c cache.c dates.c hash.c init.c init2.c input.c \
	macinput.c macstuff.c output.c output2.c process.c settings.c \
	sort.c tree.c utils.c win32.c
OBJS = alias.o analog.o cache.o dates.o hash.o init.o init2.o input.o \
	macinput.o macstuff.o output.o output2.o process.o settings.o \
	sort.o tree.o utils.o win32.o
HEADERS = analhead.h analhea2.h macdir.h

# Form interface options:
FORMPROG = anlgform.cgi     # The program that processes the data from the form
FORMSRC = anlgform.c        # The source code for that program

$(PROGRAM): $(OBJS) $(HEADERS) Makefile
	$(CC) $(CFLAGS) $(OBJS) -o $(PROGRAM) $(LIBS)
	@echo '***'
	@echo '***IMPORTANT: You must read the licence before using analog'
	@echo '***'

$(OBJS): $(HEADERS) Makefile
	$(CC) $(CFLAGS) $(DEFS) -D$(OS) -c $*.c

$(FORMPROG): $(FORMSRC) Makefile
	$(CC) $(CFLAGS) $(FORMSRC) -o $(FORMPROG)

form: $(FORMPROG)

force:
	rm -f $(OBJS)
	make $(PROGRAM) 'CFLAGS=$(CFLAGS)' 'LIBS=$(LIBS)' 'DEFS=$(DEFS)' \
	CC=$(CC)

clean:
	rm -f *.o analog
