Pthread: stop accessing memory after it was freed
[akaros.git] / GNUmakefile
index 0dc9f82..7dfd0bb 100644 (file)
@@ -1,6 +1,9 @@
 # The ROS Top level Makefile
 # Make sure that 'all' is the first target
 
+# Keep make quiet.  Make sure you call make via $(MAKE), and not directly
+MAKE += -s 
+
 ############################################################################# 
 ########## Initial Setup so that we can build for different TARGETS #########
 ############################################################################# 
@@ -43,6 +46,7 @@ MAKE_JOBS :=
 
 # Give it a reasonable default path for initramfs to avoid build breakage
 INITRAMFS_PATHS = kern/kfs
+FIRST_INITRAMFS_PATH = $(firstword $(INITRAMFS_PATHS))
 
 # Then grab the users Makelocal file to let them override Make system variables
 # and set up other Make targets
@@ -141,7 +145,7 @@ arch:
 symlinks: error
        ln -fs ../arch/$(ROS_ARCH_DIR) kern/include/arch
        ln -fs arch/$(ROS_ARCH_DIR)/boot kern/boot
-       ln -fs $(ROS_ARCH_DIR) user/include/arch
+       ln -fs $(ROS_ARCH_DIR) user/parlib/include/arch
        @$(MAKE) -j $(MAKE_JOBS) all
 
 # Include Makefrags for subdirectories
@@ -153,24 +157,32 @@ endif
 ifeq ($(GCCPREFIX),$(TARGET_ARCH)-ros-)
 GCC_ROOT := $(shell which $(GCCPREFIX)gcc | xargs dirname)/../
 tests/: tests
-tests:
+tests: install-libs
        @$(MAKE) -j $(MAKE_JOBS) realtests
 realtests: $(TESTS_EXECS)
 # No longer automatically copying to the FS dir (deprecated)
 #      @mkdir -p fs/$(TARGET_ARCH)/tests
 #      cp -R $(OBJDIR)/$(TESTS_DIR)/* $(TOP_DIR)/fs/$(TARGET_ARCH)/tests
 
+USER_LIBS = parlib pthread c3po
 install-libs: 
-       @rm -rf $(firstword $(INITRAMFS_PATHS))/lib
-       @cp -R $(GCC_ROOT)/$(TARGET_ARCH)-ros/lib $(firstword $(INITRAMFS_PATHS))
-       @cd user/parlib; $(MAKE); $(MAKE) install
-       @cd user/pthread; $(MAKE); $(MAKE) install
-       @cd user/c3po; $(MAKE); $(MAKE) install
+       @for i in $(USER_LIBS) ; do \
+               cd user/$$i;            \
+               $(MAKE);                \
+               $(MAKE) install;        \
+               cd ../..;               \
+       done
+
+fill-kfs: install-libs
+       @rm -rf $(FIRST_INITRAMFS_PATH)/lib
+       @cp -R $(GCC_ROOT)/$(TARGET_ARCH)-ros/lib $(FIRST_INITRAMFS_PATH)
 
 userclean:
-       @cd user/parlib; $(MAKE) clean;
-       @cd user/pthread; $(MAKE) clean;
-       @cd user/c3po; $(MAKE) clean;
+       @for i in $(USER_LIBS) ; do \
+               cd user/$$i;            \
+               $(MAKE) clean;          \
+               cd ../..;               \
+       done
        @rm -rf $(OBJDIR)/$(TESTS_DIR)
 .PHONY: tests
 endif
@@ -211,7 +223,7 @@ clean:
 realclean: clean
        @rm -f kern/boot
        @rm -f kern/include/arch
-       @rm -f user/include/arch
+       @rm -f user/parlib/include/arch
 
 always:
        @: