# IMPORTANT *****************************************************  IMPORTANT

# Not all the source files are included. The following routines are missing:
# comp_hack.c, lud_hack.c, lub_hack.c cis_hack.c mpr_hack.c
# These are modified copies of source files printed in the book
# 'Numerical Recipes in C', by Press et al, 2nd edition, Cambridge Uni. Press
# (1992). You *must* get these source files and modify according to details
# in the file README. Typing 'make' will *not* give you an executable!
 
# IMPORTANT *****************************************************  IMPORTANT

LIBS = -lm   
CC= gcc     # I've made  CC a link to g++, so CC works at home and at work.
LD= gcc     # I've made  CC a link to g++, so CC works at home and at work.
#CFLAGS=   -DANSI -DUNIX -DGCC -g
CFLAGS=   -DANSI -DUNIX -DGCC -O3
all: optimise input yagi output first rantest mutual

YAGI-OBJECTS = yagi.o num_elem.o getfiles.o nrutil.o string.o read_dat.o \
self.o mutual.o z.o cis_hack.o com_hack.o v.o lud_hack.o lub_hack.o header.o \
write_co.o print_z.o version.o getopt.o u_yagi.o mpr_hack.o self2.o cin.o \
ci.o display.o


yagi: $(YAGI-OBJECTS) makefile  nr_hack.h com_hack.h
	$(LD) $(CFLAGS) $(YAGI-OBJECTS) $(LIBS) -o yagi

INPUT-OBJECTS = input.o nrutil.o string.o write_ip.o num_elem.o version.o \
u_input.o getopt.o 

input: $(INPUT-OBJECTS) makefile    com_hack.h nr_hack.h 
	$(LD) $(CFLAGS) $(INPUT-OBJECTS) $(LIBS) -o  input



OUTPUT-OBJECTS = output.o nrutil.o read_hea.o string.o z_input.o vswr.o \
refco.o com_hack.o pin.o gain.o write_ga.o version.o u_output.o getopt.o  \
zbr_hack.o max_side.o 

output: $(OUTPUT-OBJECTS) makefile  
	$(LD) $(CFLAGS) $(OUTPUT-OBJECTS) $(LIBS) -o  output


FIRST-OBJECTS = first.o nrutil.o write_ip.o string.o getopt.o u_first.o \
version.o self2.o cis_hack.o com_hack.o ci.o new_len.o
first: $(FIRST-OBJECTS) makefile   
	$(LD) $(CFLAGS) $(FIRST-OBJECTS) $(LIBS) -o  first

OPTIMISE-OBJECTS = optimise.o string.o read_dat.o  nrutil.o num_elem.o  \
version.o z.o lud_hack.o lub_hack.o gain.o self.o mutual.o pin.o com_hack.o \
cis_hack.o v.o z_input.o randomis.o better.o write_ip.o refco.o vswr.o \
copym.o perform.o getopt.o showopt.o solve.o print_z.o  ck_flags.o errormsg.o \
max_gain.o dobetter.o gaussian.o sens.o fitness.o mpr_hack.o genetic.o \
ga_lib.o random.o get_cmdl.o changpc.o max_side.o u_optimi.o opt_for.o \
set_ps.o test_stop.o meanperf.o p_pform.o sub_stru.o end_stop.o self2.o cin.o \
ci.o dynamic.o auto.o linear.o

optimise: $(OPTIMISE-OBJECTS) makefile  
	$(LD) $(CFLAGS) $(OPTIMISE-OBJECTS) $(LIBS) -o  optimise

RAND-OBJECTS=random.o rantest.o

rantest: $(RAND-OBJECTS) makefile
	$(LD) $(CFLAGS) $(RAND-OBJECTS) $(LIBS) -o  rantest

MUTUAL-OBJECTS=test2.c cis_hack.o nrutil.o com_hack.o

mutual: $(MUTUAL-OBJECTS) makefile
	$(LD) $(CFLAGS) $(MUTUAL-OBJECTS) $(LIBS) -o mutual

clean:
	rm -f optimise 
	rm -f input 
	rm -f output 
	rm -f yagi 
	rm -f first 
	rm -f rantest
	rm -f *.o
	rm -f *%
	rm -f core
