# makefile.dos, for dgjpp type gcc compiler and gnumake371 
# IMPORTANT *****************************************************  IMPORTANT

# Not all the source files are included. The following routines are missing:
# comp_hack.c, lud_hack.c, lub_hack.c and cis_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     
#CFLAGS=   -DANSI -DUNIX -g
CFLAGS=   -DANSI -DGCC -DDOS -g
all: optimise.exe input.exe yagi.exe output.exe first.exe

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.exe: $(YAGI-OBJECTS) makefile  nr_hack.h com_hack.h
	$(CC) $(CFLAGS) $(YAGI-OBJECTS) $(LIBS) -o yagi
	strip yagi
	copy go32.exe yagi.exe
	copy /b yagi.exe+yagi tmp.exe
	del yagi.exe
	rename tmp.exe yagi.exe

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

input.exe: $(INPUT-OBJECTS) makefile    com_hack.h nr_hack.h
	$(CC) $(CFLAGS) $(INPUT-OBJECTS) $(LIBS) -o  input
	strip input
	copy go32.exe input.exe
	copy /b input.exe+input tmp.exe
	del input.exe
	rename tmp.exe input.exe
	

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.exe: $(OUTPUT-OBJECTS) makefile
	$(CC) $(CFLAGS) $(OUTPUT-OBJECTS) $(LIBS) -o  output
	strip output
	copy go32.exe output.exe
	copy /b output.exe+output tmp.exe
	del output.exe
	rename tmp.exe output.exe



FIRST-OBJECTS = first.o nrutil.o write_ip.o string.o getopt.o u_first.o version.o self2.o showfirs.o cis_hack.o com_hack.o ci.o new_len.o
first.exe: $(FIRST-OBJECTS) makefile
	$(CC) $(CFLAGS) $(FIRST-OBJECTS) $(LIBS) -o  first
	strip first
	copy go32.exe first.exe
	copy /b first.exe+first tmp.exe
	del first.exe
	rename tmp.exe first.exe
	del 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 teststop.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.exe: $(OPTIMISE-OBJECTS) makefile
	$(CC) $(CFLAGS) $(OPTIMISE-OBJECTS) $(LIBS) -o  optimise
	strip optimise
	copy go32.exe optimise.exe
	copy /b optimise.exe+optimise tmp.exe
	del optimise.exe
	rename tmp.exe optimise.exe
	

