#
# Makefile per il "progetto"
#
# $Id: Makefile,v 1.12 2005/01/25 14:34:53 eim Exp $
#
# Si puo lanciare il comando "make compile run" per compilare ed eseguire
# direttamente il progetto.
#

all: directory compile

directory:
	if [ ! -d "/tmp/input" ]; then mkdir /tmp/input; fi
	if [ ! -d "/tmp/output" ]; then mkdir /tmp/output; else rm -r /tmp/output && mkdir /tmp/output; fi
	if [ ! -e "/tmp/input/input.txt" ]; then cp ${PWD}/input.txt /tmp/input; fi
#	if [ ! -e "/tmp/input/input.txt" ]; then ln -s --target-directory=/tmp/input ${PWD}/input.txt; fi

compile:
	gcc -pedantic -g -Wall -o /tmp/progetto progetto.c
	gcc -pedantic -g -Wall -o /tmp/client client.c

#
# TODO
#
# run e' un po problematico in quanto e' necessario eseguire:
# progetto <argomento> per un corrette funzionamento, di conseguenza a mio
# avviso sarebbe necessario eseguire: make run <argomento>. Al momento non so'
# come passare un argomento ad un file make (Forse con $(1)), un'alternativa e'
# quella di specificare l'argomento nel Makefile fisso, del tipo:
#
# run:
# 	/tmp/progetto ArgomentoFisso
#
run:
	/tmp/progetto

update:
	cvs update

commit:
	cvs commit

changelog:
	echo -e "#\n#    Automatic generated ChangeLog\n#\n" | cvs2cl -T -t -w -r --fsf -U usermap --header - && rm ChangeLog.bak

spell:
	aspell --lang=it -c README
