# Makefile
# Kazuya Sakai, Ph.D
# Tokyo Metropolitan University
# June 20, 2018

# You may execute ./target with LD_LIBRARY_PATH=. ./target

CC     = gcc
SRC1 = codeinj
SRC2 = target
FILE   = Makefile *.txt *.c
DIR	= codeinj

all: codeinj target

codeinj:
	$(CC) -o $(SRC1) $(SRC1).c

target:
	$(CC) -o $(SRC2) $(SRC2).c

pkg:
	# directory
	if [ ! -d $(DIR) ]; then \
		mkdir $(DIR); \
	fi
	
	# copy files
	for var in $(FILE); do\
		cp $$var $(DIR)/$$var; \
	done \
	
	# tar.gz
	tar zcvf $(DIR).tar.gz $(DIR)
	rm -r $(DIR)

clean:
	rm $(SRC1) $(SRC2)
