MakeInc.dir   [plain text]


#
# Install kernel header files
#
installhdrs: SRCROOT DSTROOT OBJROOT exporthdrs installhdrs_mi installhdrs_md 
	@echo "[ $(SRCROOT) ] make installhdrs installing Kernel.framework"; \
	kincpath=$(DSTROOT)/$(KINCDIR);					\
	kframepath=$(DSTROOT)/$(KINCFRAME);				\
	$(MKDIR) $$kincpath;						\
	chmod -R +w $$kincpath;						\
	for i in $(COMPONENT_LIST); do					\
	    if [ -d $(OBJROOT)/EXPORT_HDRS/$$i ]; then (		\
		cd $(OBJROOT)/EXPORT_HDRS/$$i;				\
		pax -ruw -s '/.*CVS.*//' . $$kincpath || true ;		\
	    ) fi							\
	done;								\
	cd $(SRCROOT)/EXTERNAL_HEADERS;					\
	    pax -ruw -s '/.*CVS.*//' . $$kincpath || true;		\
	cd $$kframepath/Versions;					\
	    [ -L Current ] || $(LN) $(KINCVERS) Current;		\
	cd $$kframepath;						\
	    [ -L Headers ] || $(LN) Versions/Current/Headers Headers;	\
	$(MKDIR) $(DSTROOT)/$(KPINCDIR);				\
	cd $$kframepath; [ -L PrivateHeaders ] ||		 	\
	    $(LN) Versions/Current/PrivateHeaders PrivateHeaders;	\
	find $$kframepath -type f | xargs -s 32000 chmod a-w

#
# Install header files order
#
.ORDER: installhdrs_mi installhdrs_md

#
# Install machine independent header files
#
installhdrs_mi:
	@echo "[ $(SOURCE) ] make installhdrs_mi ";			\
	rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));			\
	kernel_config=$(INSTALL_TYPE);					\
	arch_config=$(INSTALL_ARCH_DEFAULT);					\
	installinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};	\
	$(MKDIR) $${installinc_dir};					\
	(cd $${installinc_dir};						\
	${MAKE} KERNEL_CONFIG=$${kernel_config}				\
		ARCH_CONFIG=$${arch_config}				\
		MAKEFILES=${SOURCE}/Makefile				\
		SOURCE=${SOURCE}/					\
		TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/	\
		build_installhdrs_mi					\
	);

#
# Install machine dependent kernel header files 
#
installhdrs_md:
	@echo "[ $(SOURCE) ] make installhdrs_md ";			\
	rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));			\
	kernel_config=$(INSTALL_TYPE);					\
	for arch_config in $(INSTALL_ARCHS);				\
	do								\
	$(MKDIR) ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};	\
	(cd ${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};	\
	${MAKE} KERNEL_CONFIG=$${kernel_config}				\
		ARCH_CONFIG=$${arch_config}				\
		MAKEFILES=${SOURCE}/Makefile				\
		SOURCE=${SOURCE}/					\
		TARGET=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}/	\
		build_installhdrs_md					\
	);								\
	done;

#
# Install machine independent kernel header files 
#
do_installhdrs_mi:

build_installhdrs_mi::
	@echo "[ $(SOURCE) ] make build_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)";	\
	for installinc_subdir in $(INSTINC_SUBDIRS);			\
	do								\
		$(MKDIR) $${installinc_subdir};			\
		(cd $${installinc_subdir};				\
		${MAKE} MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile	\
			SOURCE=$(SOURCE)$${installinc_subdir}/		\
			TARGET=$(TARGET)$${installinc_subdir}/		\
		build_installhdrs_mi					\
		);							\
	done;								\
	${MAKE} do_installhdrs_mi;

#
# Install machine dependent kernel header files 
#
do_installhdrs_md:

build_installhdrs_md::
	@echo "[ $(SOURCE) ] make installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)";	\
	for installinc_subdir in $($(addprefix INSTINC_SUBDIRS_, $(ARCH_CONFIG)));		\
	do								\
		$(MKDIR) $${installinc_subdir};			\
		(cd $${installinc_subdir};				\
		${MAKE} MAKEFILES=$(SOURCE)$${installinc_subdir}/Makefile	\
			SOURCE=$(SOURCE)$${installinc_subdir}/		\
			TARGET=$(TARGET)$${installinc_subdir}/		\
		build_installhdrs_md					\
		);							\
	done;								\
	${MAKE} do_installhdrs_md;

#
# Install kernel header files
#
exporthdrs: SRCROOT DSTROOT OBJROOT exporthdrs_mi exporthdrs_md 

#
# Install header files order
#
.ORDER: exporthdrs_mi exporthdrs_md

#
# Install machine independent header files
#
do_exporthdrs_mi:

exporthdrs_mi:
	@echo "[ ${SOURCE} ] make exporthdrs_mi ";			\
	rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));			\
	kernel_config=$(INSTALL_TYPE);					\
	arch_config=$(INSTALL_ARCH_DEFAULT);					\
	exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};	\
	$(MKDIR) $${exportinc_dir};					\
	(cd $${exportinc_dir};						\
	${MAKE} KERNEL_CONFIG=$${kernel_config}				\
		ARCH_CONFIG=$${arch_config}				\
		MAKEFILES=${SOURCE}/Makefile				\
		SOURCE=${SOURCE}/					\
		TARGET=$${exportinc_dir}/				\
		build_exporthdrs_mi					\
	);

#
# Install machine dependent kernel header files 
#
exporthdrs_md:
	@echo "[ $(SOURCE) ] make exporthdrs_md ";			\
	rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));			\
	kernel_config=$(INSTALL_TYPE);					\
	for arch_config in $(ARCH_CONFIGS);				\
	do								\
	exportinc_dir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};	\
	$(MKDIR) $${exportinc_dir};					\
	(cd $${exportinc_dir};						\
	${MAKE} KERNEL_CONFIG=$${kernel_config}				\
		ARCH_CONFIG=$${arch_config}				\
		MAKEFILES=${SOURCE}/Makefile				\
		SOURCE=${SOURCE}/					\
		TARGET=$${exportinc_dir}/				\
		build_exporthdrs_md					\
	);								\
	done;

#
# Install machine independent kernel header files 
#
do_exporthdrs_mi:

build_exporthdrs_mi:
	@echo "[ $(SOURCE) ] make build_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)";	\
	for exportinc_subdir in $(EXPINC_SUBDIRS);			\
	do								\
		$(MKDIR) $${exportinc_subdir};				\
		(cd $${exportinc_subdir};				\
		${MAKE} MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile	\
			SOURCE=$(SOURCE)$${exportinc_subdir}/		\
			TARGET=$(TARGET)$${exportinc_subdir}/		\
		build_exporthdrs_mi					\
		);							\
	done;								\
	${MAKE} do_exporthdrs_mi;

#
# Install machine dependent kernel header files 
#
do_exporthdrs_md:

build_exporthdrs_md:
	@echo "[ $(SOURCE) ] make exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)";	\
	for exportinc_subdir in $($(addprefix EXPINC_SUBDIRS_, $(ARCH_CONFIG)));			\
	do								\
		$(MKDIR) $${exportinc_subdir};				\
		(cd $${exportinc_subdir};				\
		${MAKE} MAKEFILES=$(SOURCE)$${exportinc_subdir}/Makefile	\
			SOURCE=$(SOURCE)$${exportinc_subdir}/		\
			TARGET=$(TARGET)$${exportinc_subdir}/		\
		build_exporthdrs_md					\
		);							\
	done;								\
	${MAKE} do_exporthdrs_md;

#
# Setup pass for  all architectures for all Configuration/Architecture options
#
setup: SRCROOT DSTROOT OBJROOT
	@echo "[ $(SOURCE) ] make setup";					\
	rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));			\
	for kernel_config in $(KERNEL_CONFIGS);				\
	do								\
	for arch_config in $(ARCH_CONFIGS);				\
	do								\
	setup_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
	$(MKDIR) $${setup_subdir};					\
	(cd $${setup_subdir};						\
	${MAKE} KERNEL_CONFIG=$${kernel_config}				\
		ARCH_CONFIG=$${arch_config}				\
		MAKEFILES=${SOURCE}/Makefile				\
		SOURCE=${SOURCE}/					\
		TARGET=$${setup_subdir}/				\
	build_setup							\
	);								\
	done;								\
	done;

do_build_setup:

build_setup:
	@echo "[ $(SOURCE) ] make build_setup $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)";	\
	for setup_subdir in $(SETUP_SUBDIRS) $($(addprefix SETUP_SUBDIRS_, $(ARCH_CONFIG)));	\
	do							\
	$(MKDIR) $${setup_subdir};				\
	(cd $${setup_subdir};					\
	${MAKE} MAKEFILES=${SOURCE}/$${setup_subdir}/Makefile	\
		SOURCE=${SOURCE}/$${setup_subdir}/		\
		TARGET=${TARGET}/$${setup_subdir}/		\
		build_setup					\
	);							\
	done;							\
	${MAKE} do_build_setup;


#
# Build all architectures for all Configuration/Architecture options
#
all: SRCROOT DSTROOT OBJROOT
	@echo "[ $(SOURCE) ] make all";					\
	rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));			\
	for kernel_config in $(KERNEL_CONFIGS);				\
	do								\
	for arch_config in $(ARCH_CONFIGS);				\
	do								\
	build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path}; \
	$(MKDIR) $${build_subdir};					\
	(cd $${build_subdir};						\
	${MAKE} KERNEL_CONFIG=$${kernel_config}				\
		ARCH_CONFIG=$${arch_config}				\
		MAKEFILES=${SOURCE}/Makefile 				\
		SOURCE=${SOURCE}/					\
		build_all						\
	);								\
	done;								\
	done;

#
# Build all architectures for all Configuration/Architecture options
#
do_build_all:

build_all: 
	@TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT);	\
	echo "[ $(SOURCE) ] make build_all $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}";	\
	for comp_subdir in $(COMP_SUBDIRS) $($(addprefix COMP_SUBDIRS_, $(ARCH_CONFIG)));				\
	do								\
		$(MKDIR) $${comp_subdir};				\
		(cd $${comp_subdir};					\
		${MAKE} MAKEFILES=${SOURCE}/$${comp_subdir}/Makefile	\
			SOURCE=${SOURCE}$${comp_subdir}/		\
			TARGET=$${TARGET}				\
		build_all						\
		);							\
	done;								\
	${MAKE} INCL_MAKEDEP=TRUE TARGET=$${TARGET} do_build_all;

#
# Build all architectures for all Configuration/Architecture options
#
mach_kernel: SRCROOT DSTROOT OBJROOT
	@echo "[ $(SOURCE) ] make mach_kernel";				\
	for kernel_config in $(KERNEL_CONFIGS);				\
	do								\
	for arch_config in $(ARCH_CONFIGS);				\
	do								\
	build_subdir=${OBJROOT}/$${kernel_config}_$${arch_config};	\
	$(MKDIR) $${build_subdir};					\
	(cd $${build_subdir};						\
	${MAKE} KERNEL_CONFIG=$${kernel_config}				\
		ARCH_CONFIG=$${arch_config}				\
		MAKEFILES=${SOURCE}/Makefile 				\
		SOURCE=${SOURCE}/					\
		TARGET=$${build_subdir}/				\
		build_mach_kernel					\
	);								\
	done;								\
	done;

#
# Build all architectures for all Configuration/Architecture options
#
do_build_mach_kernel:

build_mach_kernel: 
	@echo "[ $(SOURCE) ] make build_mach_kernel $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)";	\
	${MAKE} do_build_mach_kernel;

#
#
# Install dependencies order
#
.ORDER: SRCROOT DSTROOT OBJROOT SYMROOT installhdrs exporthdrs all

#
# Install kernel based on RC_ARCHS for all INSTALL_TYPES
# Install kernel header files based on RC_ARCHS
#
install: SRCROOT DSTROOT OBJROOT SYMROOT installhdrs all
	@echo "[ $(SOURCE) ] make install";				\
	rel_path=$(shell $(RELPATH) $(SRCROOT) $(SOURCE));			\
	for kernel_config in $(INSTALL_TYPE);				\
	do								\
	for arch_config in $(INSTALL_ARCHS);				\
	do								\
	install_subdir=${OBJROOT}/$${kernel_config}_$${arch_config}/$${rel_path};	\
	$(MKDIR) $${install_subdir};					\
	(cd $${install_subdir};						\
	${MAKE} KERNEL_CONFIG=$${kernel_config}				\
		ARCH_CONFIG=$${arch_config}				\
		MAKEFILES=${SOURCE}/Makefile 				\
		SOURCE=${SOURCE}/					\
		build_install						\
	);								\
	done;								\
	done;

#
# Install for all architectures for all Configuration/Architecture options
#
setup_build_install:

do_build_install:

build_install: 
	@TARGET=${OBJROOT}/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT);	\
	echo "[ $(SOURCE) ] make build_install $(COMPONENT) $(KERNEL_CONFIG) $(ARCH_CONFIG) $${TARGET}";	\
	${MAKE} TARGET=$${TARGET} setup_build_install;			\
	kernel_config=$(KERNEL_CONFIG);					\
	for install_subdir in $(INST_SUBDIRS);				\
	do								\
		$(MKDIR) $${install_subdir};				\
		(cd $${install_subdir};					\
		${MAKE} KERNEL_CONFIG=$${kernel_config}			\
			MAKEFILES=${SOURCE}/$${install_subdir}/Makefile	\
			SOURCE=${SOURCE}$${install_subdir}/		\
			TARGET=$${TARGET}				\
		build_install						\
		);							\
	done;								\
	${MAKE} TARGET=$${TARGET} do_build_install;


#
# Install source tree
#
installsrc: SRCROOT
	pax -rw . ${SRCROOT}



#
# Clean up source tree
#
clean: SRCROOT

#
# Build source file list for cscope database and tags
#
cscope.files:
	@echo "Building file list for cscope and tags"
	@find . -name '*.h' -type f > _cscope.files 2> /dev/null
	@echo bsd/ufs/ufs/ufs_readwrite.c >> _cscope.files 2> /dev/null
	@for i in `echo ${ALL_SUBDIRS}`; \
	do \
		cat ${SRCROOT}/$${i}/conf/files ${SRCROOT}/$${i}/conf/files.ppc; \
		cat ${SRCROOT}/$${i}/conf/files.i386; \
	done | \
	sed -e '/^#/d' -e '/^[ 	]*$$/d' -e '/^OPTIONS\//d' | \
	sed -e '1,$$s/^\([^ 	]*\)[ 	].*$$/\1/' >> _cscope.files 2> /dev/null
	@sort < _cscope.files > cscope.files 2> /dev/null
	@rm -f _cscope.files 2> /dev/null

#
# Build cscope database
#
cscope: cscope.files
	@echo "Building cscope database"
	@cscope -b 2> /dev/null

#
# Build tags
#

tags: cscope.files
	@echo "Building ctags"
	@-xargs ctags -dtw < cscope.files 2> /dev/null || \
		echo "Phantom files detected!" 2>&1 > /dev/null
	@echo "Building etags"
	@-cat cscope.files | etags -l auto -S - 2> /dev/null

	
SRCROOT DSTROOT OBJROOT SYMROOT: ALWAYS
	@if [ -n "${$@}" ];						\
	then								\
		exit 0;							\
	else								\
		echo Must define $@;					\
		exit 1;							\
	fi

ALWAYS: