#
# Makefile
#

# Name of your executable:
PROGRAM_NAME=main

# 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_test

# 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=WriteMyString.c 

# Put all the names of the respective function object files here
OBJECT_FILES=WriteMyString.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}.c  header.h 
	cp header.h ${IBAS_DIR}/${INCLUDE}	
	cc -I${IBAS_DIR}/${INCLUDE} ${PROGRAM_NAME}.c  \
	-lm -L${IBAS_DIR}/${LIBRARY} -l${PROGRAM_NAME} 
	mv a.out ${PROGRAM_NAME}
	chmod +x ${PROGRAM_NAME}

library: 
	cp header.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} WriteMyString.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}


