X-Git-Url: http://akaros.cs.berkeley.edu/gitweb/?p=akaros.git;a=blobdiff_plain;f=Makefile;h=ff6658603e8449b0c3c265ae01553d98919c363c;hp=65a2c3f62103ac19804f50533215ee3df650e0a3;hb=2cef76c05712398af3377eebaa698137667d5df5;hpb=94e62633f15acd9bd1958b9675432a527ed2ce8a diff --git a/Makefile b/Makefile index 65a2c3f..ff66586 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,10 @@ MAKEFLAGS += -rR --no-print-directory PHONY := all all: akaros-kernel +# Export the location of this top level directory +AKAROS_ROOT = $(CURDIR) +export AKAROS_ROOT + # Setup dumping ground for object files and any temporary files we need to # generate for non-kbuild targets OBJDIR ?= obj @@ -306,8 +310,9 @@ KERNEL_LD ?= kernel.ld gcc-lib := $(shell $(CC) -print-libgcc-file-name 2>/dev/null) NOSTDINC_FLAGS += -nostdinc -isystem \ $(shell $(CC) -print-file-name=include 2>/dev/null) -XCC_TARGET_ROOT := $(dir $(shell which $(CC) 2> /dev/null))../$(patsubst %-,%,\ - $(CROSS_COMPILE)) +XCC_TARGET_ROOT := $(shell $(CC) --print-sysroot 2> /dev/null) +XCC_TARGET_LIB := $(XCC_TARGET_ROOT)/usr/lib/ +XCC_TARGET_INCLUDE := $(XCC_TARGET_ROOT)/usr/include/ CFLAGS_KERNEL += -O2 -pipe -MD CFLAGS_KERNEL += -std=gnu99 -fgnu89-inline @@ -339,7 +344,7 @@ KBUILD_CHECKSRC := 0 export AKAROSINCLUDE CROSS_COMPILE export CC CPP AS AR LD OBJCOPY OBJDUMP NM STRIP export CFLAGS_KERNEL AFLAGS_KERNEL -export NOSTDINC_FLAGS XCC_TARGET_ROOT +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 @@ -390,7 +395,7 @@ $(srctree)/Makelocal: ; # We have all-arch-dirs and all-dirs, so that we can still clean even without # an arch symlink. -core-y += kern/src/ kern/drivers/ $(AKAROS_EXTERNAL_DIRS) +core-y += kern/src/ kern/drivers/ kern/lib/ $(AKAROS_EXTERNAL_DIRS) arch-y += kern/arch/$(ARCH)/ akaros-dirs := $(patsubst %/,%,$(filter %/, $(core-y) $(arch-y))) @@ -536,19 +541,23 @@ 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 -pthread: parlib +user-dirs = parlib pthread benchutil iplib ndblib bsd +benchutil: parlib +pthread: parlib benchutil +iplib: parlib +ndblib: iplib +bsd: parlib iplib PHONY += install-libs $(user-dirs) install-libs: $(user-dirs) symlinks cc-exists $(user-dirs): - @cd user/$@ && $(MAKE) && $(MAKE) install + @cd user/$@ && $(MAKE) DEPLIBS="$^" && $(MAKE) install PHONY += userclean $(clean-user-dirs) clean-user-dirs := $(addprefix _clean_user_,$(user-dirs)) -userclean: $(clean-user-dirs) testclean +userclean: $(clean-user-dirs) testclean utestclean $(clean-user-dirs): @cd user/$(patsubst _clean_user_%,%,$@) && $(MAKE) clean @@ -557,24 +566,37 @@ tests/: tests tests: install-libs @$(MAKE) -f tests/Makefile +PHONY += utest +utest: $(user-dirs) + @cd user/$@ && $(MAKE) + testclean: @$(MAKE) -f tests/Makefile clean +utestclean: + @cd user/utest && $(MAKE) clean + # KFS related stuff PHONY += fill-kfs unfill-kfs -XCC_SO_FILES = $(addprefix $(XCC_TARGET_ROOT)/lib/, *.so*) +XCC_SO_FILES = $(addprefix $(XCC_TARGET_LIB), *.so*) $(OBJDIR)/.dont-force-fill-kfs: $(Q)rm -rf $(addprefix $(FIRST_KFS_PATH)/lib/, $(notdir $(XCC_SO_FILES))) @echo "Cross Compiler 'so' files removed from KFS" - @$(MAKE) -f tests/Makefile unfill-kfs + @$(MAKE) -f tests/Makefile uninstall + @echo "Apps from /test removed from KFS" + @cd user/utest && $(MAKE) uninstall + @echo "User space tests removed from KFS" @touch $(OBJDIR)/.dont-force-fill-kfs fill-kfs: $(OBJDIR)/.dont-force-fill-kfs install-libs @mkdir -p $(FIRST_KFS_PATH)/lib $(Q)cp -uP $(XCC_SO_FILES) $(FIRST_KFS_PATH)/lib @echo "Cross Compiler 'so' files installed to KFS" - @$(MAKE) -f tests/Makefile fill-kfs + @$(MAKE) -f tests/Makefile install + @echo "Apps from /test installed to KFS" + @cd user/utest && $(MAKE) install + @echo "User space tests installed to KFS" # Use doxygen to make documentation for ROS (Untested since 2010 or so) doxygen-dir := $(CUR_DIR)/Documentation/doxygen