# Makefile 

CC     = gcc
COPTS  = -O2
MLIB   = -lm
LDFLAGS = -L/usr/local/lib
CFLAGS = -I/usr/local/include

all:	badfill spmkix spmkqux recompolx3 badfillw darkflatfz darkflatfz2 darkflatncf darkflatncf2 domask mkbadmask mkdarkavg twflatlev exslopefz twflatcom mkcorrflat

darkflatfz: darkflatfz.c
	$(CC) $(COPTS) $(MLIB) -o darkflatfz darkflatfz.c $(LDFLAGS) $(CFLAGS) -lcfitsio

darkflatfz2: darkflatfz2.c
	$(CC) $(COPTS) $(MLIB) -o darkflatfz2 darkflatfz2.c $(LDFLAGS) $(CFLAGS) -lcfitsio

darkflatncf: darkflatncf.c
	$(CC) $(COPTS) $(MLIB) -o darkflatncf darkflatncf.c

darkflatncf2: darkflatncf2.c
	$(CC) $(COPTS) $(MLIB) -o darkflatncf2 darkflatncf2.c

mkdarkavg: mkdarkavg.c
	$(CC) $(COPTS) $(MLIB) -o mkdarkavg mkdarkavg.c $(LDFLAGS) $(CFLAGS) -lcfitsio

domask: domask.c
	$(CC) $(COPTS) -o domask domask.c

mkbadmask: mkbadmask.c
	$(CC) $(COPTS) -o mkbadmask mkbadmask.c

badfill: badfill.c
	$(CC) $(COPTS) $(MLIB) -o badfill badfill.c

badfillw: badfillw.c
	$(CC) $(COPTS) $(MLIB) -o badfillw badfillw.c

spmkix: spmkix.c
	$(CC) $(COPTS) -o spmkix spmkix.c

spmkqux: spmkqux.c
	$(CC) $(COPTS) $(MLIB) -o spmkqux spmkqux.c

recompolx3: recompolx3.c
	$(CC) $(COPTS) $(MLIB) -o recompolx3 recompolx3.c

twflatlev: twflatlev.c
	$(CC) $(COPTS) $(MLIB) -o twflatlev twflatlev.c $(LDFLAGS) $(CFLAGS) -lcfitsio

exslopefz: exslopefz.c
	$(CC) $(COPTS) $(MLIB) -o exslopefz exslopefz.c $(LDFLAGS) $(CFLAGS) -lcfitsio

twflatcom: twflatcom.c
	$(CC) $(COPTS) $(MLIB) -o twflatcom twflatcom.c $(LDFLAGS) $(CFLAGS) -lcfitsio

mkcorrflat: mkcorrflat.c
	$(CC) $(COPTS) -o mkcorrflat mkcorrflat.c



clean:
	rm -rf *~
	rm -rf badfill spmkix spmkqux recompolx3 badfillw darkflatfz darkflatfz2 darkflatncf darkflatncf2 domask mkbadmask mkdarkavg twflatlev exslopefz twflatcom mkcorrflat

