#******************************** CLEARSY *************************************
# Fichier : $Id: Makefile,v 1.5 2001/12/28 17:54:55 fl Exp $
# (C) 1997-1998 CLEARSY
#
# Description : Makefile to generate the basic library for C++ code generated
#				by Atelier-B B to C/C++ translator
#
#				make clean : cleans the library
#				make all   : compiles and installs the library
#
#
# Auteur(s) : SL, CT, AW
#
# Historique : $Log: Makefile,v $
# Historique : Revision 1.5  2001/12/28 17:54:55  fl
# Historique : Changement STERIA CLEARSY
# Historique :
# Historique : Revision 1.4  2000/11/20 10:32:45  lv
# Historique : Ajout target Solaris 7 et 8.
# Historique :
# Historique : Revision 1.3  1998/10/07 14:48:56  atelierb
# Historique : Modification des makefiles pour supporter HP10.20
# Historique : Suppression de machines de base obsoletes
# Historique :
# Revision 1.2  1998/04/30  00:27:50  sl
# Integration Atelier
#
# Historique : Revision 1.1.1.1  1998/03/26 14:08:05  ct
# Historique :  Version Initiale
# Historique :
# Historique : Revision 1.3  1998/03/26 13:59:23  ct
# Historique : Librairie C++ pour Traducteur V4.1p
# Historique :
# Historique : Revision 1.2  1997/11/17 08:45:36  ct
# Historique : Ajout de $BASE : repertoire des librairies de l'AtelierB
# Historique :   (par ex. :  /home/AB/press/lib/lang/cpp)
# Historique :
# Historique : Revision 1.1.1.1  1997/11/17 08:18:19  ct
# Historique : version initiale
# Historique :
#
#******************************************************************************
# Choose here your C++ compiler
CCC		= 	gcc

# Choose here your archive tool
AR		=	ar

# Comment the next line if you are not using GNU Make
.SUFFIXES: .S .o .c .s .i .C .cc .cpp

#
# DO NOT EDIT BELOW !!!
#

# Figure which OS we are using
GET_TYPE=\
machine=`uname -a | awk '{print $$1}'`;\
systeme=`uname -a | awk '{print $$3}'`; \
short_systeme=`echo $$systeme | cut -d'.' -f1-2`; \
if [ "$$machine" = "SunOS" ]; \
then \
if [ "$$short_systeme" = "4.1" ];\
then type="sun4"; \
elif [ "$$systeme" = "5.3" ];\
then type="sun5.3"; \
elif [ "$$systeme" = "5.4" ]; \
then type="sun5.4"; \
elif [ "$$systeme" = "5.5" ]; \
then type="sun5.5"; \
elif [ "$$systeme" = "5.5.1" ]; \
then type="sun5.5.1"; \
elif [ "$$systeme" = "5.6" -o "$$systeme" = "5.7" -o "$$systeme" = "5.8" ]; \
then type="sun5.6"; \
else \
echo "Error : unsupported OS : $$machine $$systeme"; \
exit;\
fi;\
elif [ "$$machine" = "HP-UX" ];\
then \
	hp_release=`uname -r | cut -d '.' -f2`;\
	if [ "$$hp_release" = "09" ];\
	then type="hp";\
	elif [ "$$hp_release" = "10" ];\
	then type="hp10";\
	else \
		echo "Attention : systeme inconnu : $$machine $$systeme"; \
		exit;\
	fi; \
elif [ "$$machine" = "Linux" ];\
then type="linux";\
else \
echo "Error : unsupported OS : $$machine"; \
exit; \
fi


# Source code, source include and objetcs
SOURCES	=	PRED_SETS.cpp ARRAY.cpp
INCLUDES=	PRED_SETS.h ARRAY.h BTYPE.h
OBJECTS	=	PRED_SETS.o ARRAY.o
LIB		=	libBtoCPP.a

# Targets
all: $(OBJECTS)
	@ $(GET_TYPE);\
	if [ ! -d lib/$$type ];\
	then\
		mkdir lib/$$type;\
	fi;\
	$(AR) ruv lib/$$type/$(LIB) $(OBJECTS) ;\
	cp $(INCLUDES) include ;\
	echo "$(LIB) : compilation and installation completed"

clean:
	@ $(GET_TYPE);\
	rm -f $(OBJECTS) ;\
	rm -f lib/$$type/$(LIB) ;\
	cd /tmp ;\
	rm -f $(INCLUDES)

# Compile rules
PRED_SETS.o: PRED_SETS.cpp
	$(CCC) -c PRED_SETS.cpp -o PRED_SETS.o

ARRAY.o: ARRAY.cpp
	$(CCC) -c ARRAY.cpp -o ARRAY.o


#
# End of Makefile
#
