# Makefile for amg ARRAY MULTIPLIER GENERATOR from Philippe Royannez
include $(TOP)/etc/$(MACHINE).mk

ALC_INC          = -I$(ALLIANCE_INCLUDE) \
                   -DMGN_H='"mgn319.h"' \
                   -DMLU_H='"mlu411.h"' \
                   -DMPU_H='"mpu402.h"' \
                   -DMLO_H='"mlo404.h"' \
                   -DMPH_H='"mph402.h"' \
                   -DICU_H='"icu201.h"' \
                   -DICN_H='"icn201.h"' \
                   -DIAC_H='"iac201.h"' \
                   -DMUT_H='"mut315.h"'
ALC_LIB          = -L$(ALLIANCE_LIB) \
                   -lMgn319 \
                   -lMlu411 \
                   -lMpu402 \
                   -lMcp401 \
                   -lMap402 \
                   -lMmg401 \
                   -lMcl408 \
                   -lMal404 \
                   -lMvl406 \
                   -lMel406 \
                   -lMsl608 \
                   -lMhl402 \
                   -lMlo404 \
                   -lMph402 \
                   -lIcu201 \
                   -lIcc201 \
                   -lIca201 \
                   -lIcn201 \
                   -lMut315 -lm

RCSSOURCES = Makefile amg.c amg_data.c amg_layout.c amg_vhdl.c amg_pat.c
SOURCE =main.c dispatch.c amg_layout.c amg_vhdl.c amg_data.c amg_icon.c amg_pat.c

OBJ =main.o dispatch.o amg_layout.o amg_vhdl.o amg_data.o amg_icon.o amg_pat.o

#CHECK = -DVTICHECK -DPARSEOUT

LOCAL_CFLAGS     = $(CHECK) $(ALC_INC) -D$(MACHINE) \
                  -DALC='"$(ALLIANCE_VERSION)"' \
                  -DAMG='"$(VERSION)"'

.c.o :
	$(CC) -c $(LOCAL_CFLAGS) $<

distrib: ../bin/amg
	@$(TOUCH) distrib
	@if [ -f ../bin/INSTALLED ]; then $(RM) ../bin/INSTALLED; else exit 0; fi
	@if [ -f ../lib/INSTALLED ]; then $(RM) ../lib/INSTALLED; else exit 0; fi
	@if [ -f ../include/INSTALLED ]; then $(RM) ../include/INSTALLED; else exit 0; fi

../bin/amg : $(OBJ)
	$(CC) $(LOCAL_CFLAGS) $(OBJ) $(ALC_LIB) -o ../bin/amg 


clean:
	-@$(RM) $(OBJ) ../bin/amg distrib
