custom message type for VM_INFO
[minix3.git] / drivers / ramdisk / Makefile
blob606b11f026f3ddc069451cbe1c0804de2f9c1ebe
1 # Makefile for ramdisk image
3 .include <bsd.own.mk>
5 USE_BITCODE:=no
7 install:
9 all:
11 # Add a few defines we are going to use during the image
12 # creation to determine what features and binaries to include
13 # in the final image
14 # ACPI do we have/include the acpi binary
15 # RAMDISK_SMALL is the script called with MKSMALL=yes
16 # DYNAMIC does the ramdisk contain dynamic binaries?
17 RAMDISK_INC_ACPI= 0
18 RAMDISK_SMALL= 0
19 RAMDISK_DYNAMIC= 0
21 RAMDISK_DEFINES= \
22 -DRAMDISK_INC_ACPI=${RAMDISK_INC_ACPI} \
23 -DRAMDISK_SMALL=${RAMDISK_SMALL} \
24 -DRAMDISK_DYNAMIC=${RAMDISK_DYNAMIC}
26 # The name of the proto file to use
27 PROTO= proto
29 # Common to all architectures
30 ETC= system.conf group
31 EXTRA= rc
32 PROTO_FILES= proto.common.etc proto.common.dynamic
33 PROG_DRIVERS=
34 PROG_COMMANDS= mount umount grep fsck_mfs sh service loadramdisk sysenv
35 PROG_SERVERS= input mfs procfs
36 PROG_BIN=
37 PROG_SBIN=
38 PROG_USR.BIN=
39 PROG_USR.SBIN=
41 .if ${MKSMALL} != "yes"
42 RAMDISK_SMALL= 1
43 .endif
45 .if ${MACHINE_ARCH} == "i386"
46 ETC+= rs.single
47 EXTRA+=
48 PROG_DRIVERS+= at_wini floppy pci pckbd
49 PROG_COMMANDS+= cdprobe
50 PROG_USR.SBIN+= pwd_mkdb
52 .if ${MKSMALL} != "yes"
53 PROG_DRIVERS+= ahci
54 PROG_DRIVERS+= virtio_blk
55 PROG_SERVERS+= ext2
56 .endif
58 .if ${MKACPI} != "no"
59 RAMDISK_INC_ACPI= 1
60 PROG_DRIVERS+= acpi
61 .endif
62 .endif # ${MACHINE_ARCH} == "i386"
64 .if ${MACHINE_ARCH} == "earm"
65 PROG_DRIVERS+= mmc
66 .endif # ${MACHINE_ARCH} == "earm"
68 .if ${LDSTATIC} == "-dynamic"
69 RAMDISK_DYNAMIC= 1
70 PROG_LIBEXEC+= ld.elf_so
71 PROG_LIBS+= libc libminlib libcompat_minix libterminfo
72 .endif
74 PROGRAMS=${PROG_COMMANDS} \
75 ${PROG_BIN} ${PROG_SBIN} ${PROG_USR.BIN} ${PROG_USR.SBIN} \
76 ${PROG_DRIVERS} ${PROG_SERVERS} \
77 ${PROG_LIBEXEC}
79 CPPFLAGS+= -I${NETBSDSRCDIR}/servers
81 # LSC We have to take care of not erasing the source file, so never add EXTRA
82 # to CLEANFILES
83 CLEANFILES += ${PROGRAMS} ${SCRIPTS} ${ETC} image image.c t
84 CLEANFILES += proto.gen proto.dev proto.dev.mtree
85 CLEANFILES += ${PROG_LIBEXEC}
86 CLEANFILES += ${.OBJDIR}/etc/*
88 #############################################################
89 # LSC Below this point the rules should not be modified
90 #############################################################
92 # Tool to bootstrap the password db
93 TOOL_PWD_MKDB?= ${NETBSDSRCDIR}/usr.sbin/pwd_mkdb/pwd_mkdb
95 # Remove "drivers/ramdisk" component from path
96 PROGROOT:= ${.OBJDIR:S,/drivers/ramdisk,,}
98 # Generate dependencies rules for config files
99 .for etc in ${ETC}
100 etc/${etc}: ${NETBSDSRCDIR}/etc/${etc}
101 mkdir -p ${.OBJDIR}/etc
102 ${INSTALL} $> $@
103 .endfor
105 # LSC Force the regeneration of the proto file as it seems sometimes
106 # they are not copied over as needed.
107 # LSC ramdisk rc file != /etc/rc
108 # BJG if ${.CURDIR} == ${.OBJDIR}, we are building in-tree and install
109 # shouldn't try to install the originals over the originals. Otherwise
110 # we are building out-of-tree and the contents should be copied
111 # unconditionally in case the contents have changed after the first copy.
112 .if ${.CURDIR} != ${.OBJDIR}
113 .for file in ${EXTRA} ${PROTO} ${PROTO_FILES}
114 CLEANFILES += ${.OBJDIR}/${file}
115 ${file}: ${NETBSDSRCDIR}/drivers/ramdisk/${file} .PHONY
116 ${INSTALL} $> $@
117 .endfor
118 .endif
120 # Generate dependencies rules for dynamic libraries, if needed
121 .for lib in ${PROG_LIBS}
122 PROGRAMS+= ${lib}.so.0
123 CLEANFILES += ${lib}.so.0
124 ${lib}.so.0:${PROGROOT}/lib/${lib}/${lib}.so.0
125 ${INSTALL} $> $@
127 ${PROGROOT}/lib/${lib}/${lib}.so.0:
128 ${MAKE} -C ${NETBSDSRCDIR}/lib/${lib} all
129 .endfor
131 # Generate dependencies rules for binaries
132 dir.sh:= ash
133 dir.fsck_mfs:= fsck.mfs
134 .for srcdir in bin sbin commands drivers libexec servers usr.bin usr.sbin
135 .for prog in ${PROG_${srcdir:tu}}
136 ${prog}: ${PROGROOT}/${srcdir}/${dir.${prog}:U${prog}}/${prog}
137 ${INSTALL} $> $@
139 ${PROGROOT}/${srcdir}/${dir.${prog}:U${prog}}/${prog}:
140 ${MAKE} -C ${NETBSDSRCDIR}/${srcdir}/${dir.${prog}:U${prog}} all
141 .endfor # prog
142 .endfor # srcdir
144 realall image: proto.gen ${ETC:C/^/etc\//} ${EXTRA} etc/master.passwd etc/pwd.db etc/spwd.db etc/passwd etc/group
145 ${_MKMSG_CREATE} "Generating ramdisk image"
146 ${TOOL_MKFSMFS} image proto.gen || { rm -f image; false; }
147 # if fsck.mfs -s image | grep -q CLEAN; \
148 # then : ; \
149 # else echo "CLEAN sanity check of image failed." ; \
150 # echo "(Perhaps install current mkfs and fsck.)" ; \
151 # rm -f image; false; \
152 # fi
154 etc/pwd.db etc/spwd.db etc/passwd: etc/master.passwd
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 proto.dev.mtree:
163 @echo ". type=dir uname=root gname=operator mode=0755" \
164 >${.TARGET}.tmp && \
165 echo "./dev type=dir uname=root gname=operator mode=0755" \
166 >>${.TARGET}.tmp && \
167 ${NETBSDSRCDIR}/commands/MAKEDEV/MAKEDEV.sh -m -r \
168 >> ${.TARGET}.tmp && mv ${.TARGET}.tmp ${.TARGET}
170 # We have to remove the two first entries of the generated proto file, as
171 # well as the two last ones (closing $).
172 # Do not forget to double $ so that make doesn't try to expand it.
173 proto.dev: proto.dev.mtree etc/pwd.db etc/spwd.db etc/passwd etc/group
174 ${TOOL_MTREE} -f ${.TARGET}.mtree -N ${.OBJDIR}/etc -C -K device | \
175 ${TOOL_TOPROTO} | ${TOOL_SED} -e '1,4d' | \
176 ${TOOL_SED} -e '$$d' |${TOOL_SED} -e '$$d' > ${.TARGET}.tmp && \
177 mv ${.TARGET}.tmp ${.TARGET}
179 proto.gen: ${PROTO} ${PROTO_FILES} proto.dev ${PROGRAMS}
180 ${STRIP} ${PROGRAMS}
181 # We are using the c preprocessor to generate proto.gen
182 # used in the mkfs tool.
183 ${TOOL_CAT} ${PROTO} | ${CC} \
184 ${RAMDISK_DEFINES} \
185 -E - | grep -v "^$$" | grep -v "#" >${.TARGET}
187 .include <minix.service.mk>