clean up master Makefile a bit

. a bit more abstraction (macros) and less duplication
	. also build and install csu, libc, then rest of libraries
	  for future dependency
This commit is contained in:
Ben Gras 2012-03-31 18:09:06 +02:00
parent 4eddbf774c
commit 29a24b06a3

152
Makefile
View file

@ -15,7 +15,6 @@ usage:
@echo " make libraries # Compile and install libraries" @echo " make libraries # Compile and install libraries"
@echo " make commands # Compile all, commands, but don't install" @echo " make commands # Compile all, commands, but don't install"
@echo " make install # Compile and install commands" @echo " make install # Compile and install commands"
@echo " make gnu-includes # Install include files for GCC"
@echo " make clean # Remove all compiler results" @echo " make clean # Remove all compiler results"
@echo "" @echo ""
@echo "Run 'make' in tools/ to create a new MINIX configuration." @echo "Run 'make' in tools/ to create a new MINIX configuration."
@ -31,101 +30,84 @@ usage:
# etcfiles has to be done first. # etcfiles has to be done first.
world: mkfiles etcfiles includes libraries dep-all install etcforce world: mkfiles etcfiles includes libraries dep-all install etcforce
mkfiles: # subdirs where userland utilities and other executables live
make -C share/mk install CMDSDIRS=commands bin sbin usr.bin usr.sbin libexec external
includes: # subdirs where system stuff lives
$(MAKE) -C include includes SYSDIRS=sys kernel servers drivers
$(MAKE) -C lib includes NBSD_LIBC=yes
$(MAKE) -C sys includes
MKHEADERSS=/usr/pkg/gcc*/libexec/gcc/*/*/install-tools/mkheaders # combination
gnu-includes: includes CMDSYSDIRS=$(CMDSDIRS) $(SYSDIRS)
SHELL=/bin/sh; for d in $(MKHEADERSS); do if [ -f $$d ] ; then sh -e $$d ; fi; done
libraries: includes etcfiles: .PHONY .MAKE
$(MAKE) -C lib dependall install ${MAKEDIRTARGET} etc install
commands: includes libraries etcforce: .PHONY .MAKE
$(MAKE) -C commands all ${MAKEDIRTARGET} etc installforce
$(MAKE) -C bin all
$(MAKE) -C sbin all
$(MAKE) -C usr.bin all
$(MAKE) -C external all
$(MAKE) -C libexec all
$(MAKE) -C usr.sbin all
dep-all: mkfiles: .PHONY .MAKE
$(MAKE) -C sys dependall ${MAKEDIRTARGET} share/mk install
$(MAKE) -C commands dependall
$(MAKE) -C bin dependall
$(MAKE) -C sbin dependall
$(MAKE) -C usr.bin dependall
$(MAKE) -C external dependall
$(MAKE) -C libexec dependall
$(MAKE) -C usr.sbin dependall
$(MAKE) -C kernel dependall
$(MAKE) -C servers dependall
$(MAKE) -C drivers dependall
etcfiles: includes: .PHONY .MAKE
$(MAKE) -C etc install ${MAKEDIRTARGET} include includes
${MAKEDIRTARGET} lib includes
${MAKEDIRTARGET} sys includes
etcforce: .for dir in lib lib/csu lib/libc
$(MAKE) -C etc installforce do-${dir:S/\//-/g}: .PHONY .MAKE
${MAKEDIRTARGET} ${dir} dependall
${MAKEDIRTARGET} ${dir} install
.endfor
all: # libraries are built by building and installing csu, then libc, then
$(MAKE) -C sys all # the rest
$(MAKE) -C commands all libraries: includes .PHONY .MAKE do-lib-csu .WAIT do-lib-libc .WAIT do-lib
$(MAKE) -C bin all
$(MAKE) -C sbin all
$(MAKE) -C usr.bin all
$(MAKE) -C external all
$(MAKE) -C libexec all
$(MAKE) -C usr.sbin all
$(MAKE) -C tools all
install: commands: includes libraries .PHONY .MAKE
$(MAKE) -C sys install .for dir in $(CMDSDIRS)
$(MAKE) -C libexec install ${MAKEDIRTARGET} ${dir} dependall
$(MAKE) -C man install makedb .endfor
$(MAKE) -C commands install
$(MAKE) -C bin install
$(MAKE) -C sbin install
$(MAKE) -C usr.bin install
$(MAKE) -C external install
$(MAKE) -C usr.sbin install
$(MAKE) -C servers install
$(MAKE) -C share install
$(MAKE) -C tools install
clean: mkfiles dep-all: .PHONY .MAKE
$(MAKE) -C sys clean .for dir in $(CMDSYSDIRS)
$(MAKE) -C commands clean ${MAKEDIRTARGET} ${dir} dependall
$(MAKE) -C bin clean .endfor
$(MAKE) -C sbin clean
$(MAKE) -C usr.bin clean
$(MAKE) -C external clean
$(MAKE) -C libexec clean
$(MAKE) -C usr.sbin clean
$(MAKE) -C share clean
$(MAKE) -C tools clean
$(MAKE) -C lib clean
$(MAKE) -C test clean
cleandepend: mkfiles install: .PHONY .MAKE
$(MAKE) -C lib cleandepend .for dir in $(CMDSYSDIRS)
$(MAKE) -C sys cleandepend ${MAKEDIRTARGET} ${dir} install
$(MAKE) -C commands cleandepend .endfor
$(MAKE) -C bin cleandepend ${MAKEDIRTARGET} man install
$(MAKE) -C sbin cleandepend ${MAKEDIRTARGET} man makedb
$(MAKE) -C usr.bin cleandepend ${MAKEDIRTARGET} share install
$(MAKE) -C external cleandepend ${MAKEDIRTARGET} tools install
$(MAKE) -C libexec cleandepend
$(MAKE) -C usr.sbin cleandepend
$(MAKE) -C tools cleandepend
# Warn usage change clean: mkfiles .PHONY .MAKE
elf-libraries: .for dir in $(CMDSDIRS)
${MAKEDIRTARGET} ${dir} clean
.endfor
${MAKEDIRTARGET} sys clean
${MAKEDIRTARGET} tools clean
${MAKEDIRTARGET} lib clean
${MAKEDIRTARGET} test clean
cleandepend: mkfiles .PHONY .MAKE
.for dir in $(CMDSYSDIRS)
${MAKEDIRTARGET} ${dir} cleandepend
.endfor
${MAKEDIRTARGET} lib cleandepend
# Shorthands
all: .PHONY .MAKE dep-all
${MAKEDIRTARGET} tools all
# Obsolete targets
elf-libraries: .PHONY
echo "That target is just libraries now." echo "That target is just libraries now."
false false
gnu-includes: .PHONY
echo "That target is obsolete."
echo "Current MINIX GCC packages don't require it any more."
false