| 1 | # @(#)Makefile 7.20 (Berkeley) %G% |
| 2 | |
| 3 | DESTDIR= |
| 4 | STAND= ../../stand |
| 5 | INCPATH=-I. -I../.. |
| 6 | VPATH= ${STAND} |
| 7 | |
| 8 | CC= cc |
| 9 | AS= as |
| 10 | |
| 11 | RELOC= 800 |
| 12 | MTBOOTRELOC= e0000 |
| 13 | BOOTRELOC= e0000 |
| 14 | LDT1MBSYSOPT= -T ${MTBOOTRELOC} -x |
| 15 | LDTSYSOPT= -T ${BOOTRELOC} -x |
| 16 | LDTOPT= -T ${RELOC} -e _entry -x |
| 17 | |
| 18 | DEFS= -DSTANDALONE -DCOMPAT_42 -DTAHOE -DRELOC=0x${RELOC} |
| 19 | CFLAGS= -O ${INCPATH} ${DEFS} |
| 20 | |
| 21 | DRIVERS=cy.c hd.c vd.c |
| 22 | SRCS= boot.c cat.c conf.c copy.c cy.c hd.c ls.c prf.c srt0.c \ |
| 23 | ${DRIVERS} |
| 24 | LIBS= libsa/libsa.a libdrive.a ${DESTDIR}/usr/lib/libc.a |
| 25 | |
| 26 | SUBDIR= vdformat |
| 27 | ALL= boot cat copy ls |
| 28 | |
| 29 | all: srt0.o ${ALL} # ${SUBDIR} |
| 30 | |
| 31 | ${SUBDIR}: |
| 32 | cd $@; make ${MFLAGS} |
| 33 | |
| 34 | libsa/libsa.a:: |
| 35 | cd libsa; make |
| 36 | |
| 37 | libdrive.a: conf.o machdep.o prf.o ${DRIVERS:.c=.o} |
| 38 | ar crv $@ $? |
| 39 | ranlib $@ |
| 40 | |
| 41 | machdep.o: machdep.c ../include/mtpr.h ../tahoe/mem.h ../tahoe/SYS.h |
| 42 | ${CC} -E ${CFLAGS} machdep.c | ${AS} -o machdep.o |
| 43 | |
| 44 | boot: boot.o bootsrt0.o ${LIBS} |
| 45 | ld ${LDTSYSOPT} bootsrt0.o boot.o ${LIBS} |
| 46 | nm -u a.out |
| 47 | size a.out |
| 48 | dd if=a.out of=boot ibs=1024 skip=1 |
| 49 | -rm -f a.out |
| 50 | |
| 51 | boot1mb: boot.o boot1mbsrt0.o ${LIBS} |
| 52 | ld ${LDT1MBSYSOPT} boot1mbsrt0.o boot.o ${LIBS} |
| 53 | nm -u a.out |
| 54 | size a.out |
| 55 | dd if=a.out of=boot1mb ibs=1024 skip=1 |
| 56 | -rm -f a.out |
| 57 | |
| 58 | cat: cat.o srt0.o ${LIBS} |
| 59 | ld ${LDTOPT} -o $@ -s srt0.o cat.o ${LIBS} |
| 60 | |
| 61 | copy: copy.o srt0.o ncy.o ${LIBS} |
| 62 | ld ${LDTOPT} -o $@ srt0.o copy.o ncy.o ${LIBS} |
| 63 | |
| 64 | xpformat: xpformat.o srt0.o ${LIBS} |
| 65 | ld ${LDTOPT} -o $@ srt0.o xpformat.o ${LIBS} |
| 66 | |
| 67 | ls: ls.o srt0.o ${LIBS} |
| 68 | ld ${LDTOPT} -o $@ -s srt0.o ls.o ${LIBS} |
| 69 | |
| 70 | srt0.o: srt0.c |
| 71 | ${CC} -E ${CFLAGS} srt0.c | ${AS} -o srt0.o |
| 72 | |
| 73 | bootsrt0.o: srt0.c |
| 74 | ${CC} -E -DBOOTRELOC=0x${BOOTRELOC} -DREL ${CFLAGS} srt0.c | \ |
| 75 | ${AS} -o bootsrt0.o |
| 76 | |
| 77 | boot1mbsrt0.o: srt0.c |
| 78 | ${CC} -E -DBOOTRELOC=0x${MTBOOTRELOC} -DREL ${CFLAGS} srt0.c | \ |
| 79 | ${AS} -o boot1mbsrt0.o |
| 80 | |
| 81 | ncy.c: cy.c |
| 82 | rm -f ncy.c |
| 83 | ln cy.c ncy.c |
| 84 | |
| 85 | ncy.o: ncy.c |
| 86 | ${CC} -DNOBLOCK ${CFLAGS} -c ncy.c |
| 87 | |
| 88 | clean: |
| 89 | rm -f ${ALL} *.o *.map *.bak a.out ncy.c libdrive.a |
| 90 | cd libsa; make clean |
| 91 | for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done |
| 92 | |
| 93 | cleandir: clean |
| 94 | rm -f ${MAN} tags .depend |
| 95 | cd libsa; make cleandir |
| 96 | for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} cleandir); done |
| 97 | |
| 98 | depend: ${SRCS} |
| 99 | mkdep ${COPTS} ${SRCS} |
| 100 | for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done |
| 101 | |
| 102 | install: |
| 103 | install -o bin -g bin -m 644 cat copy ls ${DESTDIR}/stand |
| 104 | install -o bin -g bin -m 644 boot ${DESTDIR}/ |
| 105 | for i in ${SUBDIR}; do \ |
| 106 | (cd $$i; make ${MFLAGS} DESTDIR=${DESTDIR} install) \ |
| 107 | done |
| 108 | |
| 109 | tags: ${SRCS} |
| 110 | ctags ${SRCS} |
| 111 | for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} tags); done |