xref: /minix/releasetools/Makefile (revision 6c8f7fc3)
1# Makefile for the kernel image.
2.include <bsd.own.mk>
3.include "nbsd.config"
4
5.include <bsd.own.mk>
6.include <bsd.sys.mk>
7
8u=/usr
9MDEC=	/usr/mdec
10GEN_FILES=	*.bak image kernel *.iso *.iso.gz cdfdimage rootimage src
11
12# LSC detect where were built the objects files
13PROGROOT:= ..
14.if "${MAKEOBJDIR:S,${.CURDIR},,}" != ""
15PROGROOT:= ${MAKEOBJDIR:S,releasetools,,}
16.endif
17
18# Specify the programs that are part of the system image.
19KERNEL= ${PROGROOT}/kernel/kernel
20# PROGRAMS are in the order they should be loaded by boot
21PROGRAMS+= ${PROGROOT}/servers/ds/ds
22PROGRAMS+= ${PROGROOT}/servers/rs/rs
23PROGRAMS+= ${PROGROOT}/servers/pm/pm
24PROGRAMS+= ${PROGROOT}/servers/sched/sched
25PROGRAMS+= ${PROGROOT}/servers/vfs/vfs
26PROGRAMS+= ${PROGROOT}/drivers/memory/memory
27PROGRAMS+= ${PROGROOT}/drivers/tty/tty
28PROGRAMS+= ${PROGROOT}/servers/mfs/mfs
29PROGRAMS+= ${PROGROOT}/servers/vm/vm
30PROGRAMS+= ${PROGROOT}/servers/pfs/pfs
31PROGRAMS+= ${PROGROOT}/servers/init/init
32
33usage:
34	@echo " " >&2
35	@echo "Master Makefile to create new MINIX configuration." >& 2
36	@echo "Root privileges are required." >&2
37	@echo " " >&2
38	@echo "Usage:" >&2
39	@echo "	make includes   # Install include files" >&2
40	@echo "	make depend     # Generate dependency files" >&2
41	@echo "	make services   # Compile and install all services" >&2
42	@echo "	make install    # Make image, and install to hard disk" >&2
43	@echo "	make hdboot     # Make image, and install to hard disk" >&2
44	@echo "	make bootable   # Make hard disk bootable" >&2
45	@echo "	make nbsd_fetch	# Download current NetBSD reference sources" >&2
46	@echo "	make nbsd_diff	# Update minix-port.patch in NetBSD sources" >&2
47	@echo "	make clean      # Remove all compiler results, except libs" >&2
48	@echo " " >&2
49	@echo "To create a fresh MINIX configuration, try:" >&2
50	@echo "	make clean install      # new boot image" >&2
51	@echo " " >&2
52
53all: services
54
55# rebuild the program or system libraries
56includes:
57	${MAKE} -C ../ includes
58
59libraries: includes
60	${MAKE} -C ../ do-lib
61
62depend: includes .gitignore
63	${MAKE} -C ../ depend
64
65kernel: libraries
66	${MAKE} -C ../kernel
67
68servers: libraries
69	${MAKE} -C ../servers all install
70
71drivers: libraries servers
72	${MAKE} -C ../drivers all install
73
74services: kernel servers drivers
75
76.gitignore: Makefile
77	echo ${GEN_FILES} | tr ' ' '\n' >.gitignore
78
79# make bootable and place system images
80bootable:
81	exec su root mkboot bootable ${DESTDIR}
82
83hdboot install: services .WAIT do-hdboot
84
85do-hdboot:
86	@rm -rf ${DESTDIR}/boot/minix/.temp/
87	${INSTALL_DIR} ${DESTDIR}/boot/minix/.temp
88# mod_0 is used to make alphabetical order equal to the boot order
89	@n=0;							\
90	for i in ${PROGRAMS};					\
91	do							\
92	n=`expr $$n + 1`;					\
93	[ "$$n" -ge 10 ] && prefix="mod" || prefix="mod0";	\
94	newname="${DESTDIR}/boot/minix/.temp/$${prefix}$${n}_`basename $$i`"; \
95	${INSTALL_FILE} $$i $$newname;				\
96	echo ${INSTALL_FILE} $$i $$newname;			\
97	done
98	@cp ${PROGROOT}/kernel/kernel ${DESTDIR}/boot/minix/.temp/
99	@if [ "${MKINSTALLBOOT:Uno}" != "no" ] ; then		\
100	${STRIP} -s ${DESTDIR}/boot/minix/.temp/* ;		\
101	gzip ${DESTDIR}/boot/minix/.temp/mod* ;			\
102	${HOST_SH} mkboot hdboot ${DESTDIR};			\
103	${HOST_SH} ../commands/update_bootcfg/update_bootcfg.sh;\
104	else							\
105	${INSTALL_DIR} ${DESTDIR}/multiboot;			\
106	${INSTALL_FILE} ${DESTDIR}/boot/minix/.temp/* ${DESTDIR}/multiboot; \
107	fi
108
109# download and update NetBSD reference sources.
110nbsd_fetch:
111	export CVS_RSH=ssh; 							\
112	export OLDPWD=`pwd`;							\
113	echo "retrieving hierarchies from ${NBSD_CVSROOT}";			\
114	IFS=,;									\
115	cd ..;									\
116	cat releasetools/nbsd_ports | grep -v '^#' | while read port ;		\
117	do	set $$port;							\
118		date=$$1; minixpath=$$2; origpath=$$3;				\
119		if [ $$# -lt 3 ]; then origpath=$$2; fi;			\
120		echo "retrieving $$origpath ..";				\
121		cvs -q -d ${NBSD_CVSROOT} co -N -D "$$date UTC" -d nbsdsrc "src/$$origpath" ; \
122	done;									\
123	cd $${OLDPWD};
124
125nbsd_diff:
126	find .. -name minix-port.patch | xargs rm
127	cat nbsd_ports | grep -v '^#' | \
128	( cd .. && awk -F, '{ minixpath=$$2; origpath=$$3; if(NF < 3) { origpath=$$2; } system("sh releasetools/nbsd_diff.sh " \
129	   "nbsdsrc/src/"origpath" "minixpath" "minixpath"/minix-port.patch");}' )
130	find .. -name minix-port.patch | xargs wc -l | sort -n
131
132
133# clean up compile results
134clean:
135	${MAKE} -C ../lib $@
136	${MAKE} -C ../kernel $@
137	${MAKE} -C ../servers $@
138	${MAKE} -C ../drivers $@
139	rm -rf ${GEN_FILES}
140
141cleandir:
142	${MAKE} -C ../lib $@
143	${MAKE} -C ../kernel $@
144	${MAKE} -C ../servers $@
145	${MAKE} -C ../drivers $@
146