#
# Makefile
#

# Name of your executable:
PROGRAM_NAME=jbas

# Current version of executable being compiled:
PROGRAM_VERSION=1.0

# Directory containing your own /lib and /include directories, which contain
# your personal headers and library (libJExecutable.a). These are the
# defaults if you are working on the DSRI system
IBAS_DIR=/home/silvia/IBAS/NL/IBAS_V1/NL

# Directory naming conventions used on the DSRI system:
INCLUDE=include
LIBRARY=lib
RANLIB=ranlib

# Put all your function file names here (not executables)
SOURCES_FILES=jbas_pkt.c \
	jbas_hk.c \
	jbas_countrate.c
 

# Put all the names of the respective function object files here
OBJECT_FILES=jbas_pkt.o \
	jbas_hk.o \
	jbas_countrate.o

# This target recompiles your current executable and links it to the ISDC libraries
# and the executable's own library and header. The compiled program is then run.

executable: ${PROGRAM_NAME}_main.c ${PROGRAM_NAME}.h ${PROGRAM_NAME}1.h 
	cp ${PROGRAM_NAME}.h ${IBAS_DIR}/${INCLUDE}
	cp ${PROGRAM_NAME}1.h ${IBAS_DIR}/${INCLUDE}	
	cc -I${IBAS_DIR}/${INCLUDE} ${PROGRAM_NAME}_main.c  \
	-lm -L${IBAS_DIR}/${LIBRARY} -l${PROGRAM_NAME} 
	mv a.out ${PROGRAM_NAME}
	chmod +x ${PROGRAM_NAME}

library: 
	cp ${PROGRAM_NAME}.h ${IBAS_DIR}/${INCLUDE}
	cp ${PROGRAM_NAME}1.h ${IBAS_DIR}/${INCLUDE}
	gcc  -c -O2  -Wall -W -pedantic -Winline -Wmissing-prototypes \
	-Wnested-externs -Wpointer-arith -Wcast-align -Wshadow \
	-Wstrict-prototypes -I${IBAS_DIR}/${INCLUDE} jbas_pkt.c jbas_hk.c jbas_countrate.c	 	
	ar -r ${PROGRAM_NAME}.a ${OBJECT_FILES}
	${RANLIB} ${PROGRAM_NAME}.a
	ar -t ${PROGRAM_NAME}.a
	cp ${PROGRAM_NAME}.a  ${IBAS_DIR}/${LIBRARY}/lib${PROGRAM_NAME}.a
	echo All-new version of library installed in ${IBAS_DIR}/${LIBRARY}


