256 lines
7.6 KiB
Makefile
256 lines
7.6 KiB
Makefile
|
# Copyright (c) 1995, 1996 Cygnus Support
|
||
|
#
|
||
|
# The authors hereby grant permission to use, copy, modify, distribute,
|
||
|
# and license this software and its documentation for any purpose, provided
|
||
|
# that existing copyright notices are retained in all copies and that this
|
||
|
# notice is included verbatim in any distributions. No written agreement,
|
||
|
# license, or royalty fee is required for any of the authorized uses.
|
||
|
# Modifications to this software may be copyrighted by their authors
|
||
|
# and need not follow the licensing terms described here, provided that
|
||
|
# the new terms are clearly indicated on the first page of each file where
|
||
|
# they apply.
|
||
|
#
|
||
|
# This currently works with Motorola's MVME135 and IDP m68k based
|
||
|
# target boards.
|
||
|
#
|
||
|
|
||
|
VPATH = @srcdir@
|
||
|
srcdir = @srcdir@
|
||
|
objdir = .
|
||
|
srcroot = $(srcdir)/../..
|
||
|
objroot = $(objdir)/../..
|
||
|
|
||
|
prefix = @prefix@
|
||
|
exec_prefix = @exec_prefix@
|
||
|
|
||
|
host_alias = @host_alias@
|
||
|
target_alias = @target_alias@
|
||
|
program_transform_name = @program_transform_name@
|
||
|
|
||
|
bindir = @bindir@
|
||
|
libdir = @libdir@
|
||
|
tooldir = $(exec_prefix)/$(target_alias)
|
||
|
|
||
|
# Multilib support variables.
|
||
|
# TOP is used instead of MULTI{BUILD,SRC}TOP.
|
||
|
MULTIDIRS =
|
||
|
MULTISUBDIR =
|
||
|
MULTIDO = true
|
||
|
MULTICLEAN = true
|
||
|
|
||
|
INSTALL = @INSTALL@
|
||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||
|
INSTALL_DATA = @INSTALL_DATA@
|
||
|
|
||
|
SHELL = /bin/sh
|
||
|
|
||
|
CC = @CC@
|
||
|
|
||
|
AS = @AS@
|
||
|
AR = @AR@
|
||
|
LD = @LD@
|
||
|
RANLIB = @RANLIB@
|
||
|
AR_FLAGS = qv
|
||
|
|
||
|
OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
|
||
|
then echo ${objroot}/../binutils/objdump ; \
|
||
|
else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
|
||
|
OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||
|
then echo ${objroot}/../binutils/objcopy ; \
|
||
|
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||
|
|
||
|
SCRIPTS = mvme162 mvme135 idp bcc
|
||
|
|
||
|
OBJS = close.o fstat.o getpid.o isatty.o kill.o \
|
||
|
lseek.o open.o print.o putnum.o read.o sbrk.o stat.o \
|
||
|
unlink.o write.o
|
||
|
|
||
|
CFLAGS = -g
|
||
|
# ARFLAGS = rv
|
||
|
|
||
|
CRT0 = crt0.o
|
||
|
#
|
||
|
# here's all the MVME135 target stuff
|
||
|
#
|
||
|
MVME_LDFLAGS= -L${srcdir} -Tmvme135.ld
|
||
|
MVME135_BSP= libmvme135.a
|
||
|
MVME162_BSP= libmvme162.a
|
||
|
#MVME135_OBJS= mvme.o
|
||
|
#MVME162_OBJS= mvme.o
|
||
|
# Uncomment the last two objects if you want to use the GDB stub.
|
||
|
# The stub is included "as is", and will likely take some hacking
|
||
|
# to work on your system.
|
||
|
MVME135_OBJS= cpu32bug.o # mvme-stub.o mvme135-asm.o
|
||
|
MVME162_OBJS= cpu32bug.o # mvme-stub.o mvme162lx-asm.o
|
||
|
|
||
|
|
||
|
#
|
||
|
# here's all the BCC target stuff
|
||
|
#
|
||
|
BCC_LDFLAGS= -L${srcdir} -Tbcc.ld
|
||
|
BCC_BSP= libbcc.a
|
||
|
BCC_OBJS= cpu32bug.o
|
||
|
|
||
|
#
|
||
|
# here's all the IDP target stuff
|
||
|
#
|
||
|
IDP_LDFLAGS= -L${srcdir} -Tidp.ld
|
||
|
IDP_BSP= libidp.a
|
||
|
IDP_OBJS= leds.o idp-inbyte.o idp-outbyte.o mc68ec.o
|
||
|
|
||
|
#
|
||
|
# here's all the DBUG target stuff
|
||
|
#
|
||
|
DBUG_BSP= libdbug.a
|
||
|
DBUG_OBJS= dbug-exit.o dbug-inbyte.o dbug-outbyte.o
|
||
|
|
||
|
# Host specific makefile fragment comes in here.
|
||
|
@host_makefile_frag@
|
||
|
|
||
|
#
|
||
|
# build a test program for each target board. Just trying to get
|
||
|
# it to link is a good test, so we ignore all the errors for now.
|
||
|
#
|
||
|
all: ${CRT0} ${BCC_BSP} ${IDP_BSP} ${MVME135_BSP} ${MVME162_BSP} ${DBUG_BSP}
|
||
|
|
||
|
#
|
||
|
# here's where we build the board support packages for each target
|
||
|
#
|
||
|
${BCC_BSP}: $(OBJS) ${BCC_OBJS}
|
||
|
${AR} ${ARFLAGS} $@ $(OBJS) ${BCC_OBJS}
|
||
|
${RANLIB} $@
|
||
|
|
||
|
${IDP_BSP}: $(OBJS) ${IDP_OBJS}
|
||
|
${AR} ${ARFLAGS} $@ $(OBJS) ${IDP_OBJS}
|
||
|
${RANLIB} $@
|
||
|
|
||
|
${DBUG_BSP}: $(OBJS) ${DBUG_OBJS}
|
||
|
${AR} ${ARFLAGS} $@ $(OBJS) ${DBUG_OBJS}
|
||
|
${RANLIB} $@
|
||
|
|
||
|
${MVME135_BSP}: $(OBJS) ${MVME135_OBJS}
|
||
|
${AR} ${ARFLAGS} $@ $(OBJS) ${MVME135_OBJS}
|
||
|
${RANLIB} $@
|
||
|
|
||
|
${MVME162_BSP}: $(OBJS) ${MVME162_OBJS}
|
||
|
${AR} ${ARFLAGS} $@ $(OBJS) ${MVME162_OBJS}
|
||
|
${RANLIB} $@
|
||
|
|
||
|
leds.o: ${srcdir}/leds.c
|
||
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||
|
|
||
|
idp-inbyte.o: ${srcdir}/idp-inbyte.c
|
||
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||
|
|
||
|
idp-outbyte.o: ${srcdir}/idp-outbyte.c
|
||
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||
|
|
||
|
mc68ec.o: ${srcdir}/mc68ec.c
|
||
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
|
||
|
|
||
|
test.o: ${srcdir}/test.c
|
||
|
|
||
|
#
|
||
|
# Make a simple test case to test the linker script, startup code, and
|
||
|
# I/O code
|
||
|
#
|
||
|
test: $(OBJS) idp-test.srec mvme135-test.srec bcc-test.srec \
|
||
|
idp-test.dis mvme135-test.dis bcc-test.dis
|
||
|
@echo Done...
|
||
|
|
||
|
# compile a fully linked binary. The -N option is for a.out, so the
|
||
|
# base address will be zero, rather than the default of 0x2020. The
|
||
|
# -Wl,-T*.ld is for the linker script. By using -Wl, the linker script
|
||
|
# is put on the proper place in the comand line for ld, and all the
|
||
|
# symbols will get fully resolved.
|
||
|
|
||
|
idp-test.x: test.o ${CRT0} Makefile ${IDP_BSP}
|
||
|
${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
|
||
|
test.o -o $@ $(LDFLAGS_FOR_TARGET) -N -Wl,-Tidp.ld
|
||
|
idp-test.srec: idp-test.x
|
||
|
$(OBJCOPY) -O srec idp-test.x $@
|
||
|
idp-test.dis: idp-test.x
|
||
|
@rm -fr idp-test.dis
|
||
|
$(OBJDUMP) -d idp-test.x > $@
|
||
|
idp-test: idp-test.srec idp-test.dis
|
||
|
|
||
|
mvme135-test.x: test.o ${CRT0} ${srcdir}/mvme135.ld Makefile ${MVME135_BSP}
|
||
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
||
|
-N -Wl,-Tmvme135.ld -nostdlib
|
||
|
mvme135-test.srec: mvme135-test.x
|
||
|
$(OBJCOPY) -O srec mvme135-test.x $@
|
||
|
mvme135-test.dis: mvme135-test.x
|
||
|
@rm -fr mvme135-test.dis
|
||
|
$(OBJDUMP) -d mvme135-test.x > $@
|
||
|
mvme135-test: mvme135-test.srec mvme135-test.dis
|
||
|
|
||
|
mvme162-test.x: test.o ${CRT0} ${srcdir}/mvme162.ld Makefile ${MVME162_BSP}
|
||
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
||
|
-N -Wl,-Tmvme162.ld -nostdlib
|
||
|
mvme162-test.srec: mvme162-test.x
|
||
|
$(OBJCOPY) -O srec mvme162-test.x $@
|
||
|
mvme162-test.dis: mvme162-test.x
|
||
|
@rm -fr mvme162-test.dis
|
||
|
$(OBJDUMP) -d mvme162-test.x > $@
|
||
|
mvme162-test: mvme162-test.srec mvme162-test.dis
|
||
|
|
||
|
bcc-test.x: test.o ${CRT0} ${srcdir}/bcc.ld Makefile ${BCC_BSP}
|
||
|
${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \
|
||
|
-N -Wl,-Tbcc.ld -nostdlib
|
||
|
bcc-test.srec: bcc-test.x
|
||
|
$(OBJCOPY) -O srec bcc-test.x $@
|
||
|
bcc-test.dis: bcc-test.x
|
||
|
@rm -fr bcc-test.dis
|
||
|
$(OBJDUMP) -d bcc-test.x > $@
|
||
|
bcc-test: bcc-test.srec bcc-test.dis
|
||
|
|
||
|
# a C++ test case
|
||
|
dtor.o: $(srcdir)/dtor.C
|
||
|
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -o $@ -c $<
|
||
|
dtor.dis: dtor.x
|
||
|
@rm -fr dtor.dis
|
||
|
$(OBJDUMP) -d dtor.x > $@
|
||
|
dtor.x: dtor.o ${CRT0} ${srcdir}/mvme135.ld Makefile ${MVME135_BSP}
|
||
|
${CC} -L${srcdir} -L${objdir} dtor.o -o $@ $(LIBS_FOR_TARGET) \
|
||
|
-N -Wl,-Tmvme135.ld -nostdlib
|
||
|
|
||
|
|
||
|
.PHONY: install info dvi doc install-info clean-info
|
||
|
install:
|
||
|
$(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0)
|
||
|
# install BCC stuff
|
||
|
$(INSTALL_PROGRAM) $(BCC_BSP) $(tooldir)/lib${MULTISUBDIR}/$(BCC_BSP)
|
||
|
$(INSTALL_DATA) ${srcdir}/bcc.ld $(tooldir)/lib${MULTISUBDIR}/bcc.ld
|
||
|
# install IDP stuff
|
||
|
$(INSTALL_PROGRAM) $(IDP_BSP) $(tooldir)/lib${MULTISUBDIR}/$(IDP_BSP)
|
||
|
$(INSTALL_DATA) ${srcdir}/idp.ld $(tooldir)/lib${MULTISUBDIR}/idp.ld
|
||
|
# install MVME135 stuff
|
||
|
$(INSTALL_PROGRAM) $(MVME135_BSP) $(tooldir)/lib${MULTISUBDIR}/$(MVME135_BSP)
|
||
|
$(INSTALL_DATA) ${srcdir}/mvme135.ld $(tooldir)/lib${MULTISUBDIR}/mvme135.ld
|
||
|
# install MVME162lx stuff
|
||
|
$(INSTALL_PROGRAM) $(MVME162_BSP) $(tooldir)/lib${MULTISUBDIR}/$(MVME162_BSP)
|
||
|
$(INSTALL_DATA) ${srcdir}/mvme162.ld $(tooldir)/lib${MULTISUBDIR}/mvme162.ld
|
||
|
# install DBUG stuff
|
||
|
$(INSTALL_PROGRAM) $(DBUG_BSP) $(tooldir)/lib${MULTISUBDIR}/$(DBUG_BSP)
|
||
|
$(INSTALL_DATA) ${srcdir}/sbc5204.ld $(tooldir)/lib${MULTISUBDIR}/sbc5204.ld
|
||
|
$(INSTALL_DATA) ${srcdir}/sbc5206.ld $(tooldir)/lib${MULTISUBDIR}/sbc5206.ld
|
||
|
|
||
|
# target specific makefile fragment comes in here.
|
||
|
@target_makefile_frag@
|
||
|
|
||
|
clean mostlyclean:
|
||
|
rm -f a.out core *.i *~ *.a *.o *-test *.srec *.dis *.x *.map
|
||
|
|
||
|
distclean maintainer-clean realclean: clean
|
||
|
rm -f Makefile config.cache config.log config.status
|
||
|
|
||
|
info dvi doc:
|
||
|
install-info:
|
||
|
clean-info:
|
||
|
|
||
|
Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@
|
||
|
$(SHELL) config.status
|
||
|
|
||
|
config.status: configure
|
||
|
$(SHELL) config.status --recheck
|