vpath %.c   $(SRCDIR)
vpath %.h   $(SRCDIR)
vpath %.inc $(SRCDIR)

.SUFFIXES:
.SUFFIXES: .c .o .d
#DEPEND rule copied from gnu make manual
%.d: %.c
	set -e; $(CC) -MM $(CFLAGS) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@

#generate the final version of the flags
LCDEFS = $(OPTIMIZER) $(LCOPTS) $(REG_LCDEFS)
CFLAGS = $(LCDEFS) $(DFLAGS) $(WOFF)

include $(DEPEND)

#
#create the include file
#for storing the flags inside the program
#

aprog:
	echo "Cflags = strdup(\"Compiled: \n`date` \nby `whoami` \non `echo $(HOSTNAME)` \nusing $(CC) `$(CC) --version | head -1` \nCFLAGS: $(CFLAGS)\nSvnversion: `svnversion -n .. ` \");" > ../getcflags.inc;\
	$(MAKE) prog;

#then make the final program
prog: $(OBJECTS) $(DEPEND)
	$(CC) $(CFLAGS) -Wl,-export_dynamic -shared -o   ca_umat.so $(OBJECTS) $(LDFLAGS)
