#
# This file is part of the Alliance CAD System
# Copyright (C) Laboratoire LIP6 - Dpartement ASIM
# Universite Pierre et Marie Curie
# 
# Home page          : http://www-asim.lip6.fr/alliance/
# E-mail support     : mailto:alliance-support@asim.lip6.fr
# 
# This progam is  free software; you can redistribute it  and/or modify it
# under the  terms of the GNU  General Public License as  published by the
# Free Software Foundation;  either version 2 of the License,  or (at your
# option) any later version.
# 
# Alliance VLSI  CAD System  is distributed  in the hope  that it  will be
# useful, but WITHOUT  ANY WARRANTY; without even the  implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
# 
# You should have received a copy  of the GNU General Public License along
# with the GNU C Library; see the  file COPYING. If not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

# makefile for genlib libraries
# Frederic Petrot : Frederic.Petrot@lip6.fr
# date    : 28/01/93
# version 3.26, probably my last intervention on genlib.
# version 3.27, well, it's never ended I'm afraid!
# date    : 10/06/97

.SUFFIXES:

include $(TOP)/etc/$(MACHINE).mk
include $(TOP)/etc/libraries.mk

VERSION      = 3.27
GHEADER      = mgn327.h
HEADER       = $(GHEADER) mbkgen.h
RCSSOURCES   = genlib genlib.c $(HEADER) Makefile
MGN_LIB      = libMgn327.a
MGN_L        = -lMgn327

LOCAL_CFLAGS = -D$(MACHINE) \
               -I$(ALLIANCE_INCLUDE) \
               -DMLU_H='"$(MLU_H)"' \
               -DMPU_H='"$(MPU_H)"' \
               -DMLO_H='"$(MLO_H)"' \
               -DMPH_H='"$(MPH_H)"' \
               -DMUT_H='"$(MUT_H)"'

GEN_OBJ = genlib.o

all : $(TARGET_BIN)/genlib $(TARGET_LIB)/$(MGN_LIB) $(TARGET_INCLUDE)/genlib.h

$(TARGET_BIN)/genlib : genlib
	$(CP) genlib $@

$(TARGET_INCLUDE)/genlib.h : $(HEADER)
	echo "#ifndef _MGN_H_" > 1; \
	echo "#define _MGN_H_" >> 1; \
	echo "#include <stdio.h>" >> 1; \
	echo '#include MUT_H' >> 1; \
	echo '#include MLO_H' >> 1; \
	echo '#include MPH_H' >> 1; \
	echo '#include MLU_H' >> 1; \
	echo '#include MPU_H' >> 1; \
	echo '#include MGN_H' >> 1; \
	echo "#include \"mbkgen.h\"" >> 1; \
	echo "#endif" >> 1; \
	$(MV) 1 $(TARGET_INCLUDE)/genlib.h
	$(CP) $(HEADER) $(TARGET_INCLUDE)

$(TARGET_LIB)/$(MGN_LIB) : genlib.o
	$(AR) $(ARFLAGS) $(TARGET_LIB)/$(MGN_LIB) $(GEN_OBJ) 
	$(RANLIB) $(TARGET_LIB)/$(MGN_LIB)

genlib.o : genlib.c $(HEADER)
	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -c genlib.c

checkin : 
	echo "y" > 1
	for i in $(RCSSOURCES); do \
		ci -l$(VERSION) -f -m"rcs version number consistency" $$i < 1 ; \
	done
	$(RM) 1

clean : 
	$(RM) -f $(GEN_OBJ)

realclean : clean
	$(RM) -f $(TARGET_LIB)/$(MGN_LIB) $(TARGET_INCLUDE)/genlib.h $(TARGET_BIN)/genlib

