TARGETS = getmass.o

CFLAGS = $(COPTFLAGS) $(STDCFLAG) $(PICFLAG)

install:
	-rm -f $(TARGETS)
	-test -d optimised || mkdir optimised
	for FILE in $(TARGETS) ; do ln -s optimised/$$FILE ; done
	$(MAKE) "COPTFLAGS=$(OPTFLAG)" $(TARGETS)
	$(MAKE) mass.raw

dbx:
	-rm -f $(TARGETS)	
	-test -d debug || mkdir debug
	for FILE in $(TARGETS) ; do ln -s debug/$$FILE ; done
	$(MAKE) "COPTFLAGS=-g" $(TARGETS)
	$(MAKE) mass.raw

profile:
	-rm -f $(TARGETS)
	-test -d profiled || mkdir profiled
	for FILE in $(TARGETS) ; do ln -s profiled/$$FILE ; done
	$(MAKE) "COPTFLAGS=$(OPTFLAG)" $(TARGETS)
	$(MAKE) mass.raw

masstest: masstest.c getmass.o
	$(LINK.c) -o masstest masstest.c getmass.o

mass.raw: mass_rmd.mas95.gz mass93.dat.gz makeme.c
	$(LINK.c) -o makeme makeme.c -lm
	gunzip -c mass_rmd.mas95.gz > mass_rmd.mas95
	gunzip -c mass93.dat.gz > mass93.dat
	./makeme
	rm mass_rmd.mas95 mass93.dat makeme

clean:
	-rm -f *.o optimised/*.o debug/*.o profiled/*.o *~ *%
	-rmdir -s optimised debug profiled

getmass.o: getmass.c getmass.h
	$(COMPILE.c) -DMASSFILE=\"`pwd`/mass.raw\" getmass.c
