# Makefile for analog 1.9beta
# Please read Readme.html, or http://www.statslab.cam.ac.uk/~sret1/analog/
CC = gcc           # which compiler to use. NB Different compilers need
                   # different CFLAGS, e.g., -O instead of -O2.
CFLAGS = -O2       # options, e.g. for optimisation or ANSI compilation.
LIBS = -lm         # extra libraries needed
PAGER = less       # Your favourite pager program, e.g. more

PROGRAM = analog
SOURCES = alias.c analog.c formgen.c hash.c init.c output.c sscanf.c utils.c
OBJS = $(SOURCES:.c=.o)
HEADERS = analhead.h analhea2.h

# Form interface options:
FORMPROG = analform.cgi     # The program that processes the data from the form
FORMSRC = analform.c        # The source code for that program
FORMHTML = analogform.html  # Where the form itself will go
FORMOPTS =                  # Extra analog options when constructing the form

$(PROGRAM): $(OBJS) $(HEADERS) Makefile
	$(CC) $(CFLAGS) $(OBJS) -o $(PROGRAM) $(LIBS)

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

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

form: $(PROGRAM) $(FORMPROG)
	$(PROGRAM) -form $(FORMOPTS) +O$(FORMHTML)

force:
	touch $(SOURCES)
	make $(PROGRAM) 'CFLAGS=$(CFLAGS)' 'LIBS=$(LIBS)' CC=$(CC)

lint:
	lint $(SOURCES) $(LIBS) | $(PAGER)

clean:
	rm -f *.o analog
