CC = cc
OLIBS = -lcdf -lm
CFLAGS = -O2 -I../include -L../utils
PROGS = ngsonde
DBG_PROGS = dbg_ngsonde
Fman      = ngsonde.1
Fhtml     = ngsonde.1.html
PROF_PROGS = prof_ngsonde
FILES = ngsonde.c ngcmdargs.c nglfit.c nggfit.c cgm_conmin.c ngutil.c ng3dvar_tf_smootht.c ngsonde_tf_misfit.c ng3dvar_tf_bgf.c

all : $(PROGS)

all-release : $(PROGS)

all-debug : $(DBG_PROGS)

all-profile : $(PROF_PROGS)

ngsonde : $(FILES)
	$(CC) $(CFLAGS) -o ngsonde $(FILES) $(OLIBS)

dbg_ngsonde : ngsonde.c
	$(CC) $(DBG_CFLAGS) -o ngsonde $(FILES) $(OLIBS)

prof_ngsonde : ngsonde.c
	$(CC) $(PROF_CFLAGS) -o ngsonde $(FILES) $(OLIBS)

#
#--------------------------------------------
# 
# Build Html of man page.
#
html : ${Fhtml}

${Fhtml} : ${Fman}
	groff -m man -T html < ${Fman} > ${Fhtml} 2> /dev/null

#
#--------------------------------------------
# 

clean :
	-rm -f $(PROGS)
	-rm -f *.o
	-rm -f *.out
	-rm -f *.html

install :
	-cp  $(PROGS) /home/root/bin
	-cp  *.1 /home/root/man/man1
