#
# 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 rfg.
# date : 02/03/1995

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

all : $(TARGET_BIN)/rfg $(TARGET_INCLUDE)/grf604.h $(TARGET_LIB)/libGrf604.a

realclean : clean
	-@$(RM) $(TARGET_BIN)/rfg $(TARGET_BIN)/rfg.old $(TARGET_INCLUDE)/grf*.h $(TARGET_LIB)/libGrf*.a > /dev/null 2>&1

clean :
	-@$(RM) rfg_*.o > /dev/null 2>&1

##### Register file generator compilation.

ALC_INC          = -I$(ALLIANCE_INCLUDE)\
		-DIAC_H='"$(IAC_H)"' \
		-DBEH_H='"$(BEH_H)"' \
		-DBHL_H='"$(BHL_H)"' \
		-DBVL_H='"$(BVL_H)"' \
		-DELP_H='"$(ELP_H)"' \
		-DICN_H='"$(ICN_H)"' \
		-DICU_H='"$(ICU_H)"' \
		-DMGN_H='"$(MGN_H)"' \
		-DMLO_H='"$(MLO_H)"' \
		-DMLU_H='"$(MLU_H)"' \
		-DMPH_H='"$(MPH_H)"' \
		-DMPU_H='"$(MPU_H)"' \
		-DMUT_H='"$(MUT_H)"' \
		-DRDS_H='"$(RDS_H)"' \
		-DRFM_H='"$(RFM_H)"' \
		-DRPR_H='"$(RPR_H)"' \
		-DRTL_H='"$(RTL_H)"' \
		-DRUT_H='"$(RUT_H)"'

ALC_LIB          = -L$(ALLIANCE_LIB)\
                   $(MGN_L)\
                   $(MLU_L)\
                   $(MPU_L)\
                   $(MCP_L)\
                   $(MAP_L)\
                   $(MMG_L)\
                   $(MCL_L)\
                   $(MAL_L)\
                   $(MVL_L)\
                   $(MEL_L)\
                   $(MSL_L)\
                   $(MHL_L)\
                   $(MGL_L)\
                   $(RCN_L)\
                   $(MLO_L)\
                   $(MPH_L)\
                   $(ICU_L)\
                   $(ICC_L)\
                   $(ICA_L)\
                   $(ICN_L)\
                   $(MUT_L)\
                   -lm

$(TARGET_BIN)/rfg : rfg_main.o rfg_disp.o
	$(CC) $(CFLAGS) rfg_main.o rfg_disp.o $(ALC_LIB) -o $(TARGET_BIN)/rfg;
	$(STRIP) $(TARGET_BIN)/rfg;
	@ echo ""

rfg_main.o : rfg_main.c rfg_head.h grf604.h
	$(CC) $(CFLAGS) -Drfg_floating_con $(ALC_INC) -DALC_VER=$(ALLIANCE_VERSION) rfg_main.c -c;
	@ echo ""

rfg_disp.o : rfg_disp.c rfg_head.h rfg_layo.c rfg_icon.c rfg_vhdl.c rfg_patt.c rfg_netl.c rfg_data.c
	$(CC) $(CFLAGS) -Drfg_floating_con $(ALC_INC) rfg_disp.c -c;
	@ echo ""

##### Include file copy.

$(TARGET_INCLUDE)/grf604.h : grf604.h
	$(CP) grf604.h $(TARGET_INCLUDE)/grf604.h;
	@ echo ""

##### Register file generator library make.

$(TARGET_LIB)/libGrf604.a : rfg_disp.o
	$(AR) $(ARFLAGS) $(TARGET_LIB)/libGrf604.a rfg_disp.o;
	$(RANLIB) $(TARGET_LIB)/libGrf604.a;
	@ echo ""

