From: Ben Gras Date: Sat, 31 Mar 2012 16:09:06 +0000 (+0200) Subject: clean up master Makefile a bit X-Git-Tag: v3.2.1~622 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.rndc.html?a=commitdiff_plain;h=29a24b06a32fdc288b8026f881df7c606ff5cf12;p=minix.git 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 --- diff --git a/Makefile b/Makefile index fa49ec775..cb4e7cc60 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,6 @@ usage: @echo " make libraries # Compile and install libraries" @echo " make commands # Compile all, commands, but don't install" @echo " make install # Compile and install commands" - @echo " make gnu-includes # Install include files for GCC" @echo " make clean # Remove all compiler results" @echo "" @echo "Run 'make' in tools/ to create a new MINIX configuration." @@ -31,101 +30,84 @@ usage: # etcfiles has to be done first. world: mkfiles etcfiles includes libraries dep-all install etcforce -mkfiles: - make -C share/mk install - -includes: - $(MAKE) -C include includes - $(MAKE) -C lib includes NBSD_LIBC=yes - $(MAKE) -C sys includes - -MKHEADERSS=/usr/pkg/gcc*/libexec/gcc/*/*/install-tools/mkheaders -gnu-includes: includes - SHELL=/bin/sh; for d in $(MKHEADERSS); do if [ -f $$d ] ; then sh -e $$d ; fi; done - -libraries: includes - $(MAKE) -C lib dependall install - -commands: includes libraries - $(MAKE) -C commands all - $(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: - $(MAKE) -C sys dependall - $(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: - $(MAKE) -C etc install - -etcforce: - $(MAKE) -C etc installforce - -all: - $(MAKE) -C sys all - $(MAKE) -C commands all - $(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: - $(MAKE) -C sys install - $(MAKE) -C libexec install - $(MAKE) -C man install makedb - $(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 - $(MAKE) -C sys clean - $(MAKE) -C commands clean - $(MAKE) -C bin clean - $(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 - $(MAKE) -C lib cleandepend - $(MAKE) -C sys cleandepend - $(MAKE) -C commands cleandepend - $(MAKE) -C bin cleandepend - $(MAKE) -C sbin cleandepend - $(MAKE) -C usr.bin cleandepend - $(MAKE) -C external cleandepend - $(MAKE) -C libexec cleandepend - $(MAKE) -C usr.sbin cleandepend - $(MAKE) -C tools cleandepend - -# Warn usage change -elf-libraries: +# subdirs where userland utilities and other executables live +CMDSDIRS=commands bin sbin usr.bin usr.sbin libexec external + +# subdirs where system stuff lives +SYSDIRS=sys kernel servers drivers + +# combination +CMDSYSDIRS=$(CMDSDIRS) $(SYSDIRS) + +etcfiles: .PHONY .MAKE + ${MAKEDIRTARGET} etc install + +etcforce: .PHONY .MAKE + ${MAKEDIRTARGET} etc installforce + +mkfiles: .PHONY .MAKE + ${MAKEDIRTARGET} share/mk install + +includes: .PHONY .MAKE + ${MAKEDIRTARGET} include includes + ${MAKEDIRTARGET} lib includes + ${MAKEDIRTARGET} sys includes + +.for dir in lib lib/csu lib/libc +do-${dir:S/\//-/g}: .PHONY .MAKE + ${MAKEDIRTARGET} ${dir} dependall + ${MAKEDIRTARGET} ${dir} install +.endfor + +# libraries are built by building and installing csu, then libc, then +# the rest +libraries: includes .PHONY .MAKE do-lib-csu .WAIT do-lib-libc .WAIT do-lib + +commands: includes libraries .PHONY .MAKE +.for dir in $(CMDSDIRS) + ${MAKEDIRTARGET} ${dir} dependall +.endfor + +dep-all: .PHONY .MAKE +.for dir in $(CMDSYSDIRS) + ${MAKEDIRTARGET} ${dir} dependall +.endfor + +install: .PHONY .MAKE +.for dir in $(CMDSYSDIRS) + ${MAKEDIRTARGET} ${dir} install +.endfor + ${MAKEDIRTARGET} man install + ${MAKEDIRTARGET} man makedb + ${MAKEDIRTARGET} share install + ${MAKEDIRTARGET} tools install + +clean: mkfiles .PHONY .MAKE +.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." false + +gnu-includes: .PHONY + echo "That target is obsolete." + echo "Current MINIX GCC packages don't require it any more." + false +