#
# 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 router libraries
# written by Fred, boys.

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

ALC_INC          = -I$(ALLIANCE_INCLUDE) \
                   -DMLU_H='"$(MLU_H)"'\
                   -DMPU_H='"$(MPU_H)"'\
                   -DMLO_H='"$(MLO_H)"'\
                   -DMPH_H='"$(MPH_H)"'\
                   -DAPR_H='"$(APR_H)"'\
                   -DMUT_H='"$(MUT_H)"'
ALC_LIB          = -L$(ALLIANCE_LIB) \
                   $(MLU_L) \
                   $(MPU_L) \
                   $(MCP_L) \
                   $(MAP_L) \
                   $(MMG_L) \
                   $(MCL_L) \
                   $(MGL_L) \
                   $(MAL_L) \
                   $(MVL_L) \
                   $(MEL_L) \
                   $(MSL_L) \
                   $(MHL_L) \
                   $(RCN_L) \
                   $(MLO_L) \
                   $(MPH_L) \
                   $(APR_L) \
                   $(MUT_L) -lm


EXEC         = bbr
OBJ          = check.o util.o

LOCAL_CFLAGS = $(ALC_INC) -DALC=$(ALLIANCE_VERSION) -O4

all : $(TARGET_BIN)/$(EXEC)

$(TARGET_BIN)/$(EXEC) : $(OBJ) $(EXEC).c
	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -o $(TARGET_BIN)/$(EXEC) $(EXEC).c $(OBJ) $(ALC_LIB)
	$(STRIP) $(TARGET_BIN)/$(EXEC)

ranc : $(OBJ) random.c
	$(CC) -DRANDOM $(CFLAGS) $(LOCAL_CFLAGS) -c check.c
	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -o ranc random.c $(OBJ) $(ALC_LIB)
	mv ranc ../bench

check.o : check.c util.h
	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -c check.c

util.o : util.c util.h
	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -c util.c

compact.o : compact.c
	$(CC) $(CFLAGS) $(LOCAL_CFLAGS) -c compact.c

clean:
	-@$(RM) $(OBJ) > /dev/null 2>&1

realclean: clean 
	-@$(RM) $(TARGET_BIN)/$(EXEC) > /dev/null 2>&1
