# Author: PARENT Pierre
# Makefile du Projet d'OS 2004-2005

PREFIX = /usr/local
SOURCE = src
LIBS = $(PREFIX)/lib
INCLUDES =$(PREFIX)/include
DEBUG = -DDEBUG

all: $(SOURCE)/bibliotheque.so

clean:
	rm -f $(SOURCE)/*.o
	rm -f $(SOURCE)/*.so
	rm -f $(SOURCE)/testeur

#
# PARTIE CONCERNANT LA BIBLIOTHEQUE
#
$(SOURCE)/bibliotheque.so: 
	@echo "-- Compilation --"
	gcc -c $(SOURCE)/bibliotheque.c -o $(SOURCE)/bibliotheque.o
	gcc -o $(SOURCE)/bibliotheque.so -shared $(SOURCE)/bibliotheque.o

debug :
	@echo "-- Compilation en mode DEBUG--"
	gcc -c $(DEBUG) $(SOURCE)/bibliotheque.c -o $(SOURCE)/bibliotheque.o
	gcc -o $(SOURCE)/bibliotheque.so -shared $(SOURCE)/bibliotheque.o

install: $(SOURCE)/bibliotheque.so
	@autre/autorisations.sh
	cp $(SOURCE)/bibliotheque.so $(LIBS)
	cp $(SOURCE)/bibliotheque.h $(INCLUDES)

uninstall:
	rm -f $(LIBS)/bibliotheque.so
	rm -f $(INCLUDES)/bibliotheque.h


#
# PARTIE CONCERNANT LE PROGRAMME DE TEST
#
run: $(SOURCE)/testeur
	@$(SOURCE)/testeur

$(SOURCE)/testeur :
	gcc -c $(SOURCE)/testeur.c -o $(SOURCE)/testeur.o
	gcc -o $(SOURCE)/testeur $(SOURCE)/testeur.o $(LIBS)/bibliotheque.so