minix/driver/storage/ramdisk: Makefile rework

This is an attempt at simplifying the Makefile, by specifying the home
directory of every utility, instead of trying to guess depending on some
variable.

While this is a bit more verbose, this simplifies the logic. This also makes
it simpler to add / remove programs from the ramdisk.

Change-Id: Id789a6cc6e5a9be11decec0f30c5327f19819aa1
This commit is contained in:
Lionel Sambuc 2014-08-03 21:38:36 +02:00 committed by Gerrit Code Review
parent 187bd3cde6
commit d13085797b

View file

@ -23,64 +23,91 @@ RAMDISK_DEFINES= \
-DRAMDISK_DYNAMIC=${RAMDISK_DYNAMIC} -DRAMDISK_DYNAMIC=${RAMDISK_DYNAMIC}
# The name of the proto file to use # The name of the proto file to use
PROTO= proto PROTO= proto
# Common to all architectures # Common to all architectures
ETC= system.conf group ETC= system.conf group
EXTRA= rc EXTRA= rc
PROTO_FILES= proto.common.etc proto.common.dynamic PROTO_FILES= proto.common.etc
PROG_DRIVERS= PROTO_FILES+= proto.common.dynamic
PROG_COMMANDS= mount umount grep fsck_mfs sh service loadramdisk sysenv PROGRAMS= # defined
PROG_SERVERS= input mfs procfs PROGRAMS+= fsck_mfs
PROG_BIN= dir.fsck_mfs:= minix/commands/fsck.mfs
PROG_SBIN= PROGRAMS+= grep
PROG_USR.BIN= dir.grep:= minix/commands/grep
PROG_USR.SBIN= PROGRAMS+= input
dir.input:= minix/servers/input
PROGRAMS+= loadramdisk
dir.loadramdisk:= minix/commands/loadramdisk
PROGRAMS+= mfs
dir.mfs:= minix/fs/mfs
PROGRAMS+= mount
dir.mount:= minix/commands/mount
PROGRAMS+= procfs
dir.procfs:= minix/fs/procfs
PROGRAMS+= service
dir.service:= minix/commands/service
PROGRAMS+= sh
dir.sh:= minix/commands/ash
PROGRAMS+= sysenv
dir.sysenv:= minix/commands/sysenv
PROGRAMS+= umount
dir.umount:= minix/commands/umount
.if ${MKSMALL} != "yes" .if ${MKSMALL} != "yes"
RAMDISK_SMALL= 1 RAMDISK_SMALL= 1
.endif .endif
.if ${MACHINE_ARCH} == "i386" .if ${MACHINE_ARCH} == "i386"
ETC+= rs.single ETC+= rs.single
EXTRA+= PROGRAMS+= at_wini
PROG_DRIVERS+= at_wini floppy pci pckbd dir.at_wini:= minix/drivers/storage/at_wini
PROG_COMMANDS+= cdprobe PROGRAMS+= floppy
PROG_USR.SBIN+= pwd_mkdb dir.floppy:= minix/drivers/storage/floppy
PROGRAMS+= pci
dir.pci:= minix/drivers/bus/pci
PROGRAMS+= pckbd
dir.pckbd:= minix/drivers/hid/pckbd
PROGRAMS+= cdprobe
dir.cdprobe:= minix/commands/cdprobe
PROGRAMS+= pwd_mkdb
dir.pwd_mkdb:= usr.sbin/pwd_mkdb
.if ${MKSMALL} != "yes" .if ${MKSMALL} != "yes"
PROG_DRIVERS+= ahci PROGRAMS+= ahci
PROG_DRIVERS+= virtio_blk dir.ahci:= minix/drivers/storage/ahci
PROG_SERVERS+= ext2 PROGRAMS+= virtio_blk
dir.virtio_blk:= minix/drivers/storage/virtio_blk
PROGRAMS+= ext2
dir.ext2:= minix/fs/ext2
.endif .endif
.if ${MKACPI} != "no" .if ${MKACPI} != "no"
RAMDISK_INC_ACPI= 1 RAMDISK_INC_ACPI= 1
PROG_DRIVERS+= acpi PROGRAMS+= acpi
dir.acpi:= minix/drivers/power/acpi
.endif .endif
.endif # ${MACHINE_ARCH} == "i386" .endif # ${MACHINE_ARCH} == "i386"
.if ${MACHINE_ARCH} == "earm" .if ${MACHINE_ARCH} == "earm"
PROG_DRIVERS+= mmc PROGRAMS+= mmc
dir.mmc:= minix/drivers/storage/mmc
.endif # ${MACHINE_ARCH} == "earm" .endif # ${MACHINE_ARCH} == "earm"
.if ${LDSTATIC} == "-dynamic" .if ${LDSTATIC} == "-dynamic"
RAMDISK_DYNAMIC= 1 RAMDISK_DYNAMIC= 1
PROG_LIBEXEC+= ld.elf_so PROGRAMS+= ld.elf_so
PROG_LIBS+= libc PROG_LIBS+= libc
PROG_MINIXLIBS+= libminlib libcompat_minix libterminfo PROG_MINIXLIBS+= libminlib
PROG_MINIXLIBS+= libcompat_minix
PROG_MINIXLIBS+= libterminfo
.endif .endif
PROGRAMS=${PROG_COMMANDS} \
${PROG_BIN} ${PROG_SBIN} ${PROG_USR.BIN} ${PROG_USR.SBIN} \
${PROG_DRIVERS} ${PROG_SERVERS} \
${PROG_LIBEXEC}
CPPFLAGS+= -I${NETBSDSRCDIR}/servers CPPFLAGS+= -I${NETBSDSRCDIR}/servers
# LSC We have to take care of not erasing the source file, so never add EXTRA # LSC We have to take care of not erasing the source file, so never add EXTRA
# to CLEANFILES # to CLEANFILES
CLEANFILES += ${PROGRAMS} ${SCRIPTS} ${ETC} image image.c t CLEANFILES += ${PROGRAMS} ${SCRIPTS} ${ETC} image image.c
CLEANFILES += proto.gen proto.dev proto.dev.mtree CLEANFILES += proto.gen proto.dev proto.dev.mtree
CLEANFILES += ${PROG_LIBEXEC} CLEANFILES += ${PROG_LIBEXEC}
CLEANFILES += ${.OBJDIR}/etc/* CLEANFILES += ${.OBJDIR}/etc/*
@ -93,7 +120,7 @@ CLEANFILES += ${.OBJDIR}/etc/*
TOOL_PWD_MKDB?= ${NETBSDSRCDIR}/usr.sbin/pwd_mkdb/pwd_mkdb TOOL_PWD_MKDB?= ${NETBSDSRCDIR}/usr.sbin/pwd_mkdb/pwd_mkdb
# Remove "drivers/storage/ramdisk" component from path # Remove "drivers/storage/ramdisk" component from path
PROGROOT:= ${.OBJDIR:S,/drivers/storage/ramdisk,,} PROGROOT:= ${.OBJDIR:S,/minix/drivers/storage/ramdisk,,}
# Generate dependencies rules for config files # Generate dependencies rules for config files
.for etc in ${ETC} .for etc in ${ETC}
@ -139,32 +166,16 @@ ${PROGROOT}/minix/lib/${lib}/${lib}.so.0:
.endfor .endfor
# Generate dependencies rules for binaries # Generate dependencies rules for binaries
dir.acpi:= power/acpi .for prog in ${PROGRAMS}
dir.ahci:= storage/ahci ${prog}: ${PROGROOT}/${dir.${prog}}/${prog}
dir.at_wini:= storage/at_wini
dir.ext2:= ../fs/ext2
dir.floppy:= storage/floppy
dir.fsck_mfs:= fsck.mfs
dir.mfs:= ../fs/mfs
dir.mmc:= storage/mmc
dir.pci:= bus/pci
dir.pckbd:= hid/pckbd
dir.procfs:= ../fs/procfs
dir.pwd_mkdb:= ../../usr.sbin/pwd_mkdb
dir.sh:= ash
dir.virtio_blk:= storage/virtio_blk
.for srcdir in bin sbin commands drivers libexec servers usr.bin usr.sbin
.for prog in ${PROG_${srcdir:tu}}
${prog}: ${PROGROOT}/${srcdir}/${dir.${prog}:U${prog}}/${prog}
${INSTALL} $> $@ ${INSTALL} $> $@
${PROGROOT}/${srcdir}/${dir.${prog}:U${prog}}/${prog}: ${PROGROOT}/${dir.${prog}}/${prog}:
${MAKE} -C ${NETBSDSRCDIR}/minix/${srcdir}/${dir.${prog}:U${prog}} all ${MAKE} -C ${NETBSDSRCDIR}/${dir.${prog}} all
.endfor # prog .endfor # prog
.endfor # srcdir
realall image: proto.gen ${ETC:C/^/etc\//} ${EXTRA} etc/master.passwd etc/pwd.db etc/spwd.db etc/passwd etc/group realall image: proto.gen ${ETC:C/^/etc\//} ${EXTRA} \
etc/master.passwd etc/pwd.db etc/spwd.db etc/passwd etc/group
${_MKMSG_CREATE} "Generating ramdisk image" ${_MKMSG_CREATE} "Generating ramdisk image"
${TOOL_MKFSMFS} image proto.gen || { rm -f image; false; } ${TOOL_MKFSMFS} image proto.gen || { rm -f image; false; }