# vim: ft=make ts=4 sw=4 noet cindent
#---------------------------------------------------------------------------
# Makefile for SICS
# machine-dependent part for Redhat Linux with AFS at PSI
#
# Mark Koennecke 1996-2001
# Markus Zolliker, March 2003
#==========================================================================

include linux_def
# TODO Should use PSI make_gen instead of make_gen_variables
include site_ansto/make_gen_variables
default: all

# PSI rules and variables
COREOBJ += nintf.o
PSI_CFLAGS = -I./ $(INC_HDF5) $(INC_TCL8) -DDO_NOT_SELECT_BEFORE_SEND -DHDF5 -DNXXML\
       -DCYGNUS -DNONINTF -std=gnu99 -g $(DFORTIFY)\
       -Wall -Wextra -Wno-unused
PSI_SLIBS = matrix/libmatrix.a
PSI_LIBS =  \
       $(LIB_TCL8) $(LIB_HDF5) -lpthread \
       -ldl -lz  -lm  -lc $(LIB_MXML) $(LIB_JSON)
PSI_CFLAGS += -MMD
PSI_CFLAGS += -DSITE_ANSTO

all: libsics.a libmatrix

libsics.a: $(COREOBJ)
	rm -f libsics.a
	ar cr libsics.a $(COREOBJ)
	ranlib libsics.a

libmatrix: 
	$(MAKE) -C matrix $(MFLAGS) libmatrix.a

clean:
	rm -f *.o *.d psi/*.o psi/*.d
	$(MAKE) -C matrix $(MFLAGS) clean

%.c: %.w

%.o : %.c
	$(CC) -c $(PSI_CFLAGS) $*.c -o $*.o

# Use the dependency files we requested gcc to produce for us
DEPS := $(COREOBJ:.o=.d)
-include $(DEPS)
