| 1 | # Copyright (c) 1995, 1996 Cygnus Support |
|---|
| 2 | # |
|---|
| 3 | # The authors hereby grant permission to use, copy, modify, distribute, |
|---|
| 4 | # and license this software and its documentation for any purpose, provided |
|---|
| 5 | # that existing copyright notices are retained in all copies and that this |
|---|
| 6 | # notice is included verbatim in any distributions. No written agreement, |
|---|
| 7 | # license, or royalty fee is required for any of the authorized uses. |
|---|
| 8 | # Modifications to this software may be copyrighted by their authors |
|---|
| 9 | # and need not follow the licensing terms described here, provided that |
|---|
| 10 | # the new terms are clearly indicated on the first page of each file where |
|---|
| 11 | # they apply. |
|---|
| 12 | # |
|---|
| 13 | DESTDIR = |
|---|
| 14 | VPATH = @srcdir@ |
|---|
| 15 | srcdir = @srcdir@ |
|---|
| 16 | objdir = . |
|---|
| 17 | srcroot = $(srcdir)/../.. |
|---|
| 18 | objroot = $(objdir)/../.. |
|---|
| 19 | |
|---|
| 20 | prefix = @prefix@ |
|---|
| 21 | exec_prefix = @exec_prefix@ |
|---|
| 22 | |
|---|
| 23 | host_alias = @host_alias@ |
|---|
| 24 | target_alias = @target_alias@ |
|---|
| 25 | |
|---|
| 26 | bindir = @bindir@ |
|---|
| 27 | libdir = @libdir@ |
|---|
| 28 | tooldir = $(exec_prefix)/$(target_alias) |
|---|
| 29 | |
|---|
| 30 | # Multilib support variables. |
|---|
| 31 | # TOP is used instead of MULTI{BUILD,SRC}TOP. |
|---|
| 32 | MULTIDIRS = |
|---|
| 33 | MULTISUBDIR = |
|---|
| 34 | MULTIDO = true |
|---|
| 35 | MULTICLEAN = true |
|---|
| 36 | |
|---|
| 37 | INSTALL = @INSTALL@ |
|---|
| 38 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
|---|
| 39 | INSTALL_DATA = @INSTALL_DATA@ |
|---|
| 40 | |
|---|
| 41 | SHELL = /bin/sh |
|---|
| 42 | |
|---|
| 43 | CC = @CC@ |
|---|
| 44 | |
|---|
| 45 | AS = @AS@ |
|---|
| 46 | AR = @AR@ |
|---|
| 47 | LD = @LD@ |
|---|
| 48 | RANLIB = @RANLIB@ |
|---|
| 49 | |
|---|
| 50 | OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ |
|---|
| 51 | then echo ${objroot}/../binutils/objdump ; \ |
|---|
| 52 | else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` |
|---|
| 53 | OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ |
|---|
| 54 | then echo ${objroot}/../binutils/objcopy ; \ |
|---|
| 55 | else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` |
|---|
| 56 | |
|---|
| 57 | SCRIPTS = w89k op50n |
|---|
| 58 | CRT0 = crt0.o |
|---|
| 59 | OBJS = close.o fstat.o getpid.o isatty.o kill.o \ |
|---|
| 60 | lseek.o open.o print.o putnum.o read.o sbrk.o stat.o \ |
|---|
| 61 | unlink.o write.o hp-milli.o |
|---|
| 62 | |
|---|
| 63 | CFLAGS = -g |
|---|
| 64 | # ARFLAGS = rv |
|---|
| 65 | |
|---|
| 66 | # |
|---|
| 67 | # here's all the Oki OP50N target stuff |
|---|
| 68 | # |
|---|
| 69 | OKI_LDFLAGS= -L${srcdir} -Top50n.ld $(LDFLAGS_FOR_TARGET) -Ttext 40000 -Map oki.map |
|---|
| 70 | OKI_BSP= libop50n.a |
|---|
| 71 | OKI_OBJS= op50nled.o op50n-io.o |
|---|
| 72 | |
|---|
| 73 | # |
|---|
| 74 | # here's all the WinBind W89k target stuff |
|---|
| 75 | # |
|---|
| 76 | WEC_LDFLAGS= -L${srcdir} -Tw89k.ld $(LDFLAGS_FOR_TARGET) -Ttext 100000 -Map wec.map |
|---|
| 77 | WEC_BSP= libw89k.a |
|---|
| 78 | WEC_OBJS= w89k-io.o |
|---|
| 79 | |
|---|
| 80 | # Host specific makefile fragment comes in here. |
|---|
| 81 | @host_makefile_frag@ |
|---|
| 82 | |
|---|
| 83 | # |
|---|
| 84 | # build a test program for each target board. Just trying to get |
|---|
| 85 | # it to link is a good test, so we ignore all the errors for now. |
|---|
| 86 | # |
|---|
| 87 | |
|---|
| 88 | all: ${CRT0} ${OKI_BSP} ${WEC_BSP} |
|---|
| 89 | |
|---|
| 90 | test: ${CRT0} test.o ${OKI_BSP} ${WEC_BSP} |
|---|
| 91 | @for script in ${SCRIPTS}; do \ |
|---|
| 92 | echo Building $@ for $${script}... ; \ |
|---|
| 93 | ${CC} $(CFLAGS_FOR_TARGET) $(INCLUDES) -L${objdir} \ |
|---|
| 94 | -m$${script} test.o -L. \ |
|---|
| 95 | -o $${script}-test.x $(LIBS_FOR_TARGET) ; \ |
|---|
| 96 | if [ -s $${script}-test.x ] ; then \ |
|---|
| 97 | echo "Making an srecord for $${script}-test.x..." ; \ |
|---|
| 98 | ${OBJCOPY} -O srec $${script}-test.x $${script}-test.srec ; \ |
|---|
| 99 | echo "Making an disassembly file for $${script}-test.x..." ; \ |
|---|
| 100 | rm -f $${script}-test.dis ; \ |
|---|
| 101 | ${OBJDUMP} -d $${script}-test.x > $${script}-test.dis ; \ |
|---|
| 102 | else \ |
|---|
| 103 | rm $${script}-test.x ; \ |
|---|
| 104 | echo "WARNING: $${script}-test didn't build." ; \ |
|---|
| 105 | fi ; \ |
|---|
| 106 | done |
|---|
| 107 | |
|---|
| 108 | # |
|---|
| 109 | # here's where we build the board support packages for each target |
|---|
| 110 | # |
|---|
| 111 | ${OKI_BSP}: $(OBJS) ${OKI_OBJS} |
|---|
| 112 | ${AR} ${ARFLAGS} $@ $(OBJS) ${OKI_OBJS} |
|---|
| 113 | ${RANLIB} $@ |
|---|
| 114 | |
|---|
| 115 | ${WEC_BSP}: $(OBJS) ${WEC_OBJS} |
|---|
| 116 | ${AR} ${ARFLAGS} $@ $(OBJS) ${WEC_OBJS} |
|---|
| 117 | ${RANLIB} $@ |
|---|
| 118 | |
|---|
| 119 | op50n-test.x: test.o ${srcdir}/test.c ${OKI_BSP} ${WEC_BSP} |
|---|
| 120 | w89k-test.x: test.o ${srcdir}/test.c ${OKI_BSP} ${WEC_BSP} |
|---|
| 121 | |
|---|
| 122 | doc: |
|---|
| 123 | |
|---|
| 124 | clean mostlyclean: |
|---|
| 125 | rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x |
|---|
| 126 | |
|---|
| 127 | distclean maintainer-clean realclean: clean |
|---|
| 128 | rm -f Makefile config.cache config.log config.status |
|---|
| 129 | |
|---|
| 130 | .PHONY: install info install-info clean-info |
|---|
| 131 | install: |
|---|
| 132 | $(INSTALL_PROGRAM) $(CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(CRT0) |
|---|
| 133 | # install Oki stuff |
|---|
| 134 | $(INSTALL_PROGRAM) $(OKI_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(OKI_BSP) |
|---|
| 135 | $(INSTALL_DATA) ${srcdir}/op50n.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/op50n.ld |
|---|
| 136 | # install WinBond stuff |
|---|
| 137 | $(INSTALL_PROGRAM) $(WEC_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(WEC_BSP) |
|---|
| 138 | $(INSTALL_DATA) ${srcdir}/w89k.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/w89k.ld |
|---|
| 139 | |
|---|
| 140 | info: |
|---|
| 141 | install-info: |
|---|
| 142 | clean-info: |
|---|
| 143 | |
|---|
| 144 | test.o: ${srcdir}/test.c |
|---|
| 145 | ${CRT0}:${srcdir}/crt0.S |
|---|
| 146 | op50n-io.o: ${srcdir}/op50n-io.S |
|---|
| 147 | op50nled.o: ${srcdir}/op50nled.c |
|---|
| 148 | |
|---|
| 149 | # target specific makefile fragment comes in here. |
|---|
| 150 | @target_makefile_frag@ |
|---|
| 151 | |
|---|
| 152 | Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@ |
|---|
| 153 | $(SHELL) config.status |
|---|
| 154 | |
|---|
| 155 | config.status: configure |
|---|
| 156 | $(SHELL) config.status --recheck |
|---|