Replace previous change by different test
[minix.git] / drivers / ramdisk / Makefile
blobdc38cf47cdc9b4171146d8fb42beebe00a47c03a
1 # Makefile for ramdisk image
3 .include <bsd.own.mk>
5 install:
7 all:
9 # Add a few defines we are going to use during the image
10 # creation to determine what features and binaries to include
11 # in the final image
12 # ACPI do we have/include the acpi binary
13 # RAMDISK_SMALL is the script called with MKSMALL=yes
14 # DYNAMIC does the ramdisk contain dynamic binaries?
15 RAMDISK_INC_ACPI= 0
16 RAMDISK_SMALL= 0
17 RAMDISK_DYNAMIC= 0
19 RAMDISK_DEFINES= \
20 -DRAMDISK_INC_ACPI=${RAMDISK_INC_ACPI} \
21 -DRAMDISK_SMALL=${RAMDISK_SMALL} \
22 -DRAMDISK_DYNAMIC=${RAMDISK_DYNAMIC}
24 # The name of the proto file to use
25 PROTO= proto
27 # Common to all architectures
28 ETC= system.conf master.passwd
29 EXTRA= rc mtab
30 PROTO_FILES= proto.common.etc proto.common.dynamic proto.dev
31 PROG_DRIVERS=
32 PROG_COMMANDS= mount fsck.mfs sh service
33 PROG_SERVERS= mfs
34 PROG_USRSBIN=
35 PROG_BIN=
37 .if ${MACHINE_ARCH} == "i386"
38 ETC+= rs.single
39 PROG_DRIVERS+= at_wini floppy pci
40 PROG_COMMANDS+= cdprobe loadramdisk sysenv
41 PROG_SERVERS+= procfs
42 PROG_USRSBIN+= pwd_mkdb
44 .if ${MKSMALL} != "yes"
45 RAMDISK_SMALL= 1
46 PROG_DRIVERS+= ahci
47 PROG_SERVERS+= ext2
48 .endif
50 .if ${MKACPI} != "no"
51 RAMDISK_INC_ACPI= 1
52 PROG_DRIVERS+= acpi
53 .endif
54 .endif # ${MACHINE_ARCH} == "i386"
56 .if ${MACHINE_ARCH} == "earm"
57 EXTRA+= mylogin.sh
58 PROG_DRIVERS+= mmc tty
59 PROG_COMMANDS+= cp dd getty ls time sync sleep stty umount
60 PROG_BIN+= cat rm
61 PROTO= proto.arm.small
62 .endif # ${MACHINE_ARCH} == "earm"
64 .if ${LDSTATIC} == "-dynamic"
65 RAMDISK_DYNAMIC= 1
66 PROG_LIBEXEC+= ld.elf_so
67 PROG_LIBS+= libc libminlib libcompat_minix libterminfo
68 .endif
70 PROGRAMS=${PROG_DRIVERS} ${PROG_COMMANDS} ${PROG_SERVERS} \
71 ${PROG_USRSBIN} ${PROG_BIN} ${PROG_LIBEXEC}
73 CPPFLAGS+= -I${NETBSDSRCDIR}/servers
75 # LSC We have to take care of not erasing the source file, so never add EXTRA
76 # to CLEANFILES
77 CLEANFILES += ${PROGRAMS} ${SCRIPTS} ${ETC} image image.c t proto.gen
78 CLEANFILES += ${LIBRARIES}
79 CLEANFILES += ${PROG_LIBEXEC}
80 CLEANFILES += ${.OBJDIR}/etc/*
82 #############################################################
83 # LSC Below this point the rules should not be modified
84 #############################################################
86 # Tool to bootstrap the password db
87 TOOL_PWD_MKDB?= ${NETBSDSRCDIR}/usr.sbin/pwd_mkdb/pwd_mkdb
89 # Remove "drivers/ramdisk" component from path
90 PROGROOT:= ${.OBJDIR:S,drivers/ramdisk,,}
92 # Generate dependencies rules for config files
93 .for etc in ${ETC}
94 ${etc}: ${NETBSDSRCDIR}/etc/${etc}
95 ${INSTALL} $> $@
96 .endfor
98 # LSC Force the regeneration of the proto file as it seems sometimes
99 # they are not copied over as needed.
100 # LSC ramdisk rc file != /etc/rc && mtab not empty!
101 # BJG if ${.CURDIR} == ${.OBJDIR}, we are building in-tree and install
102 # shouldn't try to install the originals over the originals. Otherwise
103 # we are building out-of-tree and the contents should be copied
104 # unconditionally in case the contents have changed after the first copy.
105 .if ${.CURDIR} != ${.OBJDIR}
106 CLEANFILES += ${EXTRA} ${PROTO} ${PROTO_FILES}
107 .for file in ${EXTRA} ${PROTO} ${PROTO_FILES}
108 ${file}: ${NETBSDSRCDIR}/drivers/ramdisk/${file} .PHONY
109 ${INSTALL} $> $@
110 .endfor
111 .endif
113 # Generate dependencies rules for dynamic libraries, if needed
114 .for lib in ${PROG_LIBS}
115 PROGRAMS+= ${lib}.so.0
116 CLEANFILES += ${lib}.so.0
117 ${lib}.so.0:${PROGROOT}/lib/${lib}/${lib}.so.0
118 ${INSTALL} $> $@
120 ${PROGROOT}/lib/${lib}/${lib}.so.0:
121 ${MAKE} -C ${NETBSDSRCDIR}/lib/${lib} all
122 .endfor
124 # Generate dependencies rules for binaries
125 dir.sh:= ash
126 .for srcdir in bin commands drivers libexec servers
127 .for prog in ${PROG_${srcdir:tu}}
128 ${prog}: ${PROGROOT}/${srcdir}/${dir.${prog}:U${prog}}/${prog}
129 ${INSTALL} $> $@
131 ${PROGROOT}/${srcdir}/${dir.${prog}:U${prog}}/${prog}:
132 ${MAKE} -C ${NETBSDSRCDIR}/${srcdir}/${dir.${prog}:U${prog}} all
133 .endfor # prog
134 .endfor # srcdir
136 # We have to do this as a separate loop, because USR.SBIN is not a valid
137 # make variable name.
138 .for prog in ${PROG_USRSBIN}
139 ${prog}: ${PROGROOT}/usr.sbin/${dir.${prog}:U${prog}}/${prog}
140 ${INSTALL} $> $@
142 ${PROGROOT}/usr.sbin/${dir.${prog}:U${prog}}/${prog}:
143 ${MAKE} -C ${NETBSDSRCDIR}/usr.sbin/${dir.${prog}:U${prog}} all
144 .endfor
146 image: proto.gen ${ETC} ${EXTRA} pwd.db spwd.db passwd
147 ${_MKMSG_CREATE} "Generating ramdisk image"
148 ${TOOL_MKFSMFS} image proto.gen || { rm -f image; false; }
149 # if fsck.mfs -s image | grep -q CLEAN; \
150 # then : ; \
151 # else echo "CLEAN sanity check of image failed." ; \
152 # echo "(Perhaps install current mkfs and fsck.)" ; \
153 # rm -f image; false; \
154 # fi
156 etc/master.passwd: ${NETBSDSRCDIR}/etc/master.passwd
157 rm -rf ${.OBJDIR}/etc/
158 mkdir -p ${.OBJDIR}/etc
159 ${INSTALL} $> $@
160 ${TOOL_PWD_MKDB} -V 0 -p -d . etc/master.passwd
162 # LSC We use @F because some version of make still output a full path for @,
163 # even when the target is just a file name
164 pwd.db spwd.db passwd: etc/master.passwd
165 ${INSTALL} etc/${@F} ${@F}
167 proto.gen: ${PROTO} ${PROTO_FILES} ${PROGRAMS}
168 ${STRIP} ${PROGRAMS}
169 # We are using the c preprocessor to generate proto.gen
170 # used in the mkfs tool.
171 ${TOOL_CAT} ${PROTO} | ${HOST_CC} \
172 ${RAMDISK_DEFINES} \
173 -traditional-cpp -E - | grep -v "^$$" | grep -v "#" >${.OBJDIR}/${.TARGET}
175 .include <minix.service.mk>