X-Git-Url: http://akaros.cs.berkeley.edu/gitweb/?p=akaros.git;a=blobdiff_plain;f=Makefile;h=57e79e71a957f741bd872c3f75280df51988841c;hp=12fe6c331c09672217f11055eff85f052d520f22;hb=c985f1a4260cb22f932c67e25f74e9cdbf677087;hpb=c709a2e5e2fce235ac9ea6b6b3fb1cda94dd4704 diff --git a/Makefile b/Makefile index 12fe6c3..57e79e7 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,9 @@ # # - There are a few other TODOs sprinkled throughout the makefile. +# Number of make jobs to spawn. Can override this in Makelocal +MAKE_JOBS ?= $(shell expr `cat /proc/cpuinfo | grep processor | wc -l` - 1) + # Allow people to override our setting of the --no-print-directory option in # their Makelocal. This is useful, for example, to allow emacs to find the # correct file when errors are encountered using its builtin 'M-x compile' @@ -56,7 +59,7 @@ NO_PRINT_DIRECTORY ?= --no-print-directory export_parent_env := $(shell export | sed 's/$$/;/') # Save the ability to clear the current environment for future use -clear_current_env := for c in $$(env | cut -d '=' -f 1); do unset $$c; done; +clear_current_env := for c in $$(awk 'BEGIN{for (v in ENVIRON){print v}}'); do unset $$c; done; define export_user_variables CROSS_COMPILE="$(CROSS_COMPILE)"\ @@ -71,14 +74,14 @@ define make_as_parent $(clear_current_env)\ $(export_parent_env)\ $(call export_user_variables)\ - $(MAKE) $(NO_PRINT_DIRECTORY) $(1) + $(MAKE) $(NO_PRINT_DIRECTORY) -j $(MAKE_JOBS) $(1) endef # Do not: # o use make's built-in rules and variables # (this increases performance and avoids hard-to-debug behaviour); # o print "Entering directory ..."; -MAKEFLAGS += -rR $(NO_PRINT_DIRECTORY) +MAKEFLAGS += -rR $(NO_PRINT_DIRECTORY) -j $(MAKE_JOBS) # That's our default target when none is given on the command line # This can be overriden with a Makelocal @@ -206,7 +209,7 @@ export CONFIG_SHELL HOSTCC HOSTCXX HOSTCFLAGS HOSTCXXFLAGS # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< # # If $(quiet) is empty, the whole command will be printed. -# If it is set to "quiet_", only the short version will be printed. +# If it is set to "quiet_", only the short version will be printed. # If it is set to "silent_", nothing will be printed at all, since # the variable $(silent_cmd_cc_o_c) doesn't exist. # @@ -330,10 +333,10 @@ endif # $(dot-config) AKAROSINCLUDE := -I$(srctree)/kern/include/ # CROSS_COMPILE is defined per-arch. Each arch can set other makeflags, kbuild -# directories, etc. +# directories, etc. -include $(srctree)/kern/arch/$(ARCH)/Makefile -CC := $(CROSS_COMPILE)gcc +CC := $(CROSS_COMPILE)gcc CPP := $(CROSS_COMPILE)g++ AS := $(CROSS_COMPILE)as AR := $(CROSS_COMPILE)ar @@ -360,8 +363,8 @@ CFLAGS_KERNEL += -O2 -pipe -MD CFLAGS_KERNEL += -std=gnu99 -fgnu89-inline CFLAGS_KERNEL += -fno-strict-aliasing -fno-omit-frame-pointer CFLAGS_KERNEL += -fno-stack-protector -CFLAGS_KERNEL += -Wall -Wno-format -Wno-unused -Werror -CFLAGS_KERNEL += -DROS_KERNEL +CFLAGS_KERNEL += -Wall -Wno-format -Wno-unused -Werror -Wreturn-type +CFLAGS_KERNEL += -DROS_KERNEL CFLAGS_KERNEL += -include include/generated/autoconf.h -include include/common.h CFLAGS_KERNEL += -fplan9-extensions ifeq ($(CONFIG_64BIT),y) @@ -393,7 +396,7 @@ export NOSTDINC_FLAGS XCC_TARGET_ROOT XCC_TARGET_LIB XCC_TARGET_INCLUDE export KBUILD_BUILTIN KBUILD_CHECKSRC CFLAGS_USER += -O2 -std=gnu99 -fno-stack-protector -fgnu89-inline \ - -Wsystem-headers + -Wsystem-headers -Werror -Wreturn-type CXXFLAGS_USER += -O2 CFLAGS_USER_LIBS += -fPIC -static -fno-omit-frame-pointer -g @@ -430,7 +433,7 @@ $(srctree)/Makelocal: ; # Akaros Kernel Build # ========================================================================= # Add top level directories, either to an existing entry (core-y) or to its -# own. +# own. # # From these, we determine deps and dirs. We recursively make through the # dirs, generating built-in.o at each step, which are the deps from which we @@ -537,7 +540,7 @@ $(ext2_bdev_obj): $(ext2-bdev) # Not the worlds most elegant link command. link-kernel takes the obj output # name, then the linker script, then everything else you'd dump on the ld # command line, including linker options and objects to link together. -# +# # After the script is done, we run the arch-specific command directly. quiet_cmd_link-akaros = LINK $@ cmd_link-akaros = $(CONFIG_SHELL) scripts/link-kernel.sh $@ \ @@ -588,19 +591,28 @@ endif #ifeq ($(mixed-targets),1) # List all userspace directories here, and state any dependencies between them, # such as how pthread depends on parlib. -user-dirs = parlib pthread benchutil iplib ndblib vmm perfmon +# Critical libraries, also built during the toolchain install +user-base-dirs = parlib pthread benchutil iplib ndblib perfmon benchutil: parlib pthread: parlib benchutil iplib: parlib ndblib: iplib -vmm: parlib benchutil -PHONY += install-libs $(user-dirs) -install-libs: $(user-dirs) symlinks cc-exists +# Higher-level libraries. Built before tests/, but after apps-install. +# TODO: would like to move perfmon here, since it's not meant to be low-level. +# But the apps-install has perf, which depends on user/perfmon. +user-extra-dirs = vmm electric-fence +$(user-extra-dirs): $(user-base-dirs) + +user-dirs = $(user-base-dirs) $(user-extra-dirs) + +PHONY += install-base-libs $(user-dirs) +install-base-libs: $(user-base-dirs) symlinks cc-exists $(user-dirs): @$(MAKE) -C user/$@ DEPLIBS="$^" && $(MAKE) -C user/$@ install +PHONY += user user: $(user-dirs) PHONY += userclean $(clean-user-dirs) @@ -611,7 +623,7 @@ $(clean-user-dirs): @$(MAKE) -C user/$(patsubst _clean_user_%,%,$@) clean tests/: tests -tests: install-libs +tests: user @$(MAKE) -f tests/Makefile PHONY += utest @@ -639,7 +651,7 @@ $(OBJDIR)/.dont-force-fill-kfs: @echo "User space tests removed from KFS" @touch $(OBJDIR)/.dont-force-fill-kfs -fill-kfs: $(OBJDIR)/.dont-force-fill-kfs install-libs tests +fill-kfs: $(OBJDIR)/.dont-force-fill-kfs user tests @mkdir -p $(FIRST_KFS_PATH)/lib $(Q)cp -uP $(xcc-so-files) $(FIRST_KFS_PATH)/lib @echo "Cross Compiler 'so' files installed to KFS" @@ -650,7 +662,7 @@ fill-kfs: $(OBJDIR)/.dont-force-fill-kfs install-libs tests # Use doxygen to make documentation for ROS (Untested since 2010 or so) doxygen-dir := $(CUR_DIR)/Documentation/doxygen -docs: +docs: @echo " Making doxygen" @doxygen-dir=$(doxygen-dir) doxygen $(doxygen-dir)/rosdoc.cfg @if [ ! -d $(doxygen-dir)/rosdoc/html/img ]; \ @@ -686,18 +698,31 @@ $(app-dirs-clean): PHONY += apps-install apps-install: $(app-dirs-install) - @$(call make_as_parent, -C tools/apps/busybox) - @$(call make_as_parent, -C tools/apps/ipconfig install) - @$(call make_as_parent, -C tools/dev-libs/elfutils install) - @$(call make_as_parent, -C tools/dev-util/perf install) - @$(call make_as_parent, -C tools/sys-apps/bash install) + @$(shell mkdir -p $(AKAROS_ROOT)/build_logs) + @$(call make_as_parent, -C tools/apps/busybox) > build_logs/busybox_install.log 2>&1 + @echo busybox install succeeded. + @$(call make_as_parent, -C tools/apps/ipconfig install) > build_logs/ipconfig_install.log 2>&1 + @echo ipconfig install succeeded. + @$(call make_as_parent, -C tools/dev-libs/elfutils install) > build_logs/elfutils_install.log 2>&1 + @echo elfutils install succeeded. + @$(call make_as_parent, -C tools/dev-util/perf install) > build_logs/perf_install.log 2>&1 + @echo perf install succeeded. + @$(call make_as_parent, -C tools/sys-apps/bash install) > build_logs/bash_install.log 2>&1 + @echo bash install succeeded. PHONY += apps-clean apps-clean: $(app-dirs-clean) - @$(call make_as_parent, -C tools/apps/busybox clean) - @$(call make_as_parent, -C tools/apps/ipconfig clean) - @$(call make_as_parent, -C tools/dev-libs/elfutils clean) - @$(call make_as_parent, -C tools/dev-util/perf clean) + @$(shell mkdir -p $(AKAROS_ROOT)/build_logs) + @$(call make_as_parent, -C tools/apps/busybox clean) > build_logs/busybox_clean.log 2>&1 + @echo busybox clean succeeded. + @$(call make_as_parent, -C tools/apps/ipconfig clean) > build_logs/ipconfig_clean.log 2>&1 + @echo ipconfig clean succeeded. + @$(call make_as_parent, -C tools/dev-libs/elfutils clean) > build_logs/elfutils_clean.log 2>&1 + @echo elfutils clean succeeded. + @$(call make_as_parent, -C tools/dev-util/perf clean) > build_logs/perf_clean.log 2>&1 + @echo perf clean succeeded. + @$(call make_as_parent, -C tools/sys-apps/bash clean) > build_logs/bash_clean.log 2>&1 + @echo bash clean succeeded. # Cross Compiler # ========================================================================= @@ -733,11 +758,11 @@ $(xcc_subcmd_goals): PHONY += xcc-upgrade xcc-upgrade: xcc @$(MAKE) userclean - @$(MAKE) install-libs + @$(MAKE) install-base-libs @$(MAKE) testclean utestclean - @$(MAKE) tests utest @$(call make_as_parent, apps-clean) @$(call make_as_parent, apps-install) + @$(MAKE) tests utest @$(MAKE) fill-kfs @$(MAKE) akaros-kernel