etc/services - sync with NetBSD-8
[minix.git] / minix / drivers / storage / ramdisk / Makefile
blobdb0a1da2196649509bf346e21075ef0394879560
1 # Makefile for ramdisk image
2 .include <bsd.own.mk>
4 USE_BITCODE:=no
6 install:
8 all:
10 # Add a few defines we are going to use during the image
11 # creation to determine what features and binaries to include
12 # in the final image
13 # ACPI do we have/include the acpi binary
14 # RAMDISK_SMALL is the script called with MKSMALL=yes
15 # DYNAMIC does the ramdisk contain dynamic binaries?
16 RAMDISK_INC_ACPI= 0
17 RAMDISK_SMALL= 0
18 RAMDISK_DYNAMIC= 0
20 RAMDISK_DEFINES= \
21 -DRAMDISK_INC_ACPI=${RAMDISK_INC_ACPI} \
22 -DRAMDISK_SMALL=${RAMDISK_SMALL} \
23 -DRAMDISK_DYNAMIC=${RAMDISK_DYNAMIC}
25 # The name of the proto file to use
26 PROTO= proto
28 # Common to all architectures
29 ETC= system.conf group
30 EXTRA= rc
31 PROTO_FILES= proto.common.etc
32 PROTO_FILES+= proto.common.dynamic
33 PROGRAMS= # defined
34 PROGRAMS+= fsck_mfs
35 dir.fsck_mfs:= minix/commands/fsck.mfs
36 PROGRAMS+= grep
37 dir.grep:= minix/usr.bin/grep
38 PROGRAMS+= input
39 dir.input:= minix/servers/input
40 PROGRAMS+= loadramdisk
41 dir.loadramdisk:= minix/commands/loadramdisk
42 PROGRAMS+= mfs
43 dir.mfs:= minix/fs/mfs
44 PROGRAMS+= mount
45 dir.mount:= minix/commands/mount
46 PROGRAMS+= procfs
47 dir.procfs:= minix/fs/procfs
48 PROGRAMS+= minix-service
49 dir.minix-service:= minix/commands/minix-service
50 PROGRAMS+= sh
51 dir.sh:= bin/sh
52 PROGRAMS+= sysenv
53 dir.sysenv:= minix/commands/sysenv
54 PROGRAMS+= umount
55 dir.umount:= minix/commands/umount
57 .if ${MKSMALL} != "yes"
58 RAMDISK_SMALL= 1
59 .endif
61 .if ${MACHINE_ARCH} == "i386"
62 ETC+= rs.single
63 PROGRAMS+= at_wini
64 dir.at_wini:= minix/drivers/storage/at_wini
65 PROGRAMS+= floppy
66 dir.floppy:= minix/drivers/storage/floppy
67 PROGRAMS+= pci
68 dir.pci:= minix/drivers/bus/pci
69 PROGRAMS+= pckbd
70 dir.pckbd:= minix/drivers/hid/pckbd
71 PROGRAMS+= cdprobe
72 dir.cdprobe:= minix/commands/cdprobe
73 PROGRAMS+= pwd_mkdb
74 dir.pwd_mkdb:= usr.sbin/pwd_mkdb
75 PROGRAMS+= isofs
76 dir.isofs:= minix/fs/isofs
78 .if ${MKSMALL} != "yes"
79 PROGRAMS+= ahci
80 dir.ahci:= minix/drivers/storage/ahci
81 PROGRAMS+= virtio_blk
82 dir.virtio_blk:= minix/drivers/storage/virtio_blk
83 PROGRAMS+= ext2
84 dir.ext2:= minix/fs/ext2
85 .endif
87 .if ${MKACPI} != "no"
88 RAMDISK_INC_ACPI= 1
89 PROGRAMS+= acpi
90 dir.acpi:= minix/drivers/power/acpi
91 .endif
92 .endif # ${MACHINE_ARCH} == "i386"
94 .if ${MACHINE_ARCH} == "earm"
95 PROGRAMS+= mmc
96 dir.mmc:= minix/drivers/storage/mmc
97 .endif # ${MACHINE_ARCH} == "earm"
99 .if ${LDSTATIC} == "-dynamic"
100 RAMDISK_DYNAMIC= 1
101 PROGRAMS+= ld.elf_so
102 PROG_LIBS+= libc
103 PROG_MINIXLIBS+= libterminfo
104 .endif
106 CPPFLAGS+= -I${NETBSDSRCDIR}/servers
108 # LSC We have to take care of not erasing the source file, so never add EXTRA
109 # to CLEANFILES
110 CLEANFILES += ${PROGRAMS} ${SCRIPTS} ${ETC} image image.c
111 CLEANFILES += proto.gen proto.dev proto.dev.mtree
112 CLEANFILES += ${PROG_LIBEXEC}
113 CLEANFILES += ${.OBJDIR}/etc/*
115 #############################################################
116 # LSC Below this point the rules should not be modified
117 #############################################################
119 # Tool to bootstrap the password db
120 TOOL_PWD_MKDB?= ${NETBSDSRCDIR}/usr.sbin/pwd_mkdb/pwd_mkdb
122 # Remove "drivers/storage/ramdisk" component from path
123 PROGROOT:= ${.OBJDIR:S,/minix/drivers/storage/ramdisk,,}
125 # Generate dependencies rules for config files
126 .for etc in ${ETC}
127 etc/${etc}: ${NETBSDSRCDIR}/etc/${etc}
128 mkdir -p ${.OBJDIR}/etc
129 ${INSTALL} $> $@
130 .endfor
132 # LSC Force the regeneration of the proto file as it seems sometimes
133 # they are not copied over as needed.
134 # LSC ramdisk rc file != /etc/rc
135 # BJG if ${.CURDIR} == ${.OBJDIR}, we are building in-tree and install
136 # shouldn't try to install the originals over the originals. Otherwise
137 # we are building out-of-tree and the contents should be copied
138 # unconditionally in case the contents have changed after the first copy.
139 .if ${.CURDIR} != ${.OBJDIR}
140 .for file in ${EXTRA} ${PROTO} ${PROTO_FILES}
141 CLEANFILES += ${.OBJDIR}/${file}
142 ${file}: ${NETBSDSRCDIR}/minix/drivers/storage/ramdisk/${file} .PHONY
143 ${INSTALL} $> $@
144 .endfor
145 .endif
147 # Generate dependencies rules for dynamic libraries, if needed
148 .for lib in ${PROG_LIBS}
149 PROGRAMS+= ${lib}.so.0
150 CLEANFILES += ${lib}.so.0
151 ${lib}.so.0:${PROGROOT}/lib/${lib}/${lib}.so.0
152 ${INSTALL} $> $@
154 # BJG - Don't invoke parallel Makes
155 #${PROGROOT}/lib/${lib}/${lib}.so.0:
156 # ${MAKE} -C ${NETBSDSRCDIR}/lib/${lib} all
157 .endfor
159 .for lib in ${PROG_MINIXLIBS}
160 PROGRAMS+= ${lib}.so.0
161 CLEANFILES += ${lib}.so.0
162 ${lib}.so.0:${PROGROOT}/minix/lib/${lib}/${lib}.so.0
163 ${INSTALL} $> $@
165 # BJG - Don't invoke parallel Makes
166 #${PROGROOT}/minix/lib/${lib}/${lib}.so.0:
167 # ${MAKE} -C ${NETBSDSRCDIR}/minix/lib/${lib} all
168 .endfor
170 # Generate dependencies rules for binaries
171 .for prog in ${PROGRAMS}
172 ${prog}: ${PROGROOT}/${dir.${prog}}/${prog}
173 ${INSTALL} $> $@
175 # BJG - don't invoke parallel Makes
176 #${PROGROOT}/${dir.${prog}}/${prog}:
177 # ${MAKE} -C ${NETBSDSRCDIR}/${dir.${prog}} all
178 .endfor # prog
180 realall image: proto.gen ${ETC:C/^/etc\//} ${EXTRA} \
181 etc/master.passwd etc/pwd.db etc/spwd.db etc/passwd etc/group
182 ${_MKMSG_CREATE} "Generating ramdisk image"
183 ${TOOL_MKFSMFS} image proto.gen || { rm -f image; false; }
185 etc/pwd.db etc/spwd.db etc/passwd: etc/master.passwd
187 etc/master.passwd: ${NETBSDSRCDIR}/etc/master.passwd
188 mkdir -p ${.OBJDIR}/etc
189 ${INSTALL} $> $@
190 ${TOOL_PWD_MKDB} -V 0 -p -d . etc/master.passwd
192 proto.dev.mtree:
193 @echo ". type=dir uname=root gname=wheel mode=0755" \
194 >${.TARGET}.tmp && \
195 echo "./dev type=dir uname=root gname=wheel mode=0755" \
196 >>${.TARGET}.tmp && \
197 ${NETBSDSRCDIR}/minix/commands/MAKEDEV/MAKEDEV.sh -m -r \
198 >> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
200 # We have to remove the two first entries of the generated proto file, as
201 # well as the two last ones (closing $).
202 # Do not forget to double $ so that make doesn't try to expand it.
203 proto.dev: proto.dev.mtree etc/pwd.db etc/spwd.db etc/passwd etc/group
204 ${TOOL_MTREE} -f ${.TARGET}.mtree -N ${.OBJDIR}/etc -C -K device | \
205 ${TOOL_TOPROTO} | ${TOOL_SED} -e '1,4d' | \
206 ${TOOL_SED} -e '$$d' |${TOOL_SED} -e '$$d' > ${.TARGET}.tmp
207 grep console ${.TARGET}.tmp # sanity check; is there a console entry?
208 mv ${.TARGET}.tmp ${.TARGET}
210 proto.gen: ${PROTO} ${PROTO_FILES} proto.dev ${PROGRAMS}
211 ${STRIP} ${PROGRAMS}
212 # We are using the c preprocessor to generate proto.gen
213 # used in the mkfs tool.
214 ${TOOL_CAT} ${PROTO} | ${CC} \
215 ${RAMDISK_DEFINES} \
216 -E - | grep -v "^$$" | grep -v "#" >${.TARGET}
218 .include <minix.service.mk>