Makefile cosmetics
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 24 Feb 2011 00:55:57 +0000 (16:55 -0800)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:58 +0000 (17:35 -0700)
GNUmakefile
tests/Makefrag
tests/c3po/Makefrag

index 0dc9f82..c408fe7 100644 (file)
@@ -43,6 +43,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
@@ -153,24 +154,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
index dc37c16..6d91d42 100644 (file)
@@ -10,13 +10,14 @@ TESTS_LDLIBS := -lpthread -lparlib
 
 TESTS_SRCS := $(ALL_TEST_FILES)
 
+TESTS_LDDEPENDS := $(TESTS_DIR)/%.c 
+
 TESTS_EXECS  = $(patsubst $(TESTS_DIR)/%.c, \
                            $(OBJDIR)/$(TESTS_DIR)/%, \
                            $(TESTS_SRCS))
 
-TESTS_LDDEPENDS := $(TESTS_DIR)/%.c 
-
 include $(TESTS_DIR)/c3po/Makefrag
+
 STATIC := $(findstring static,$(TESTS_CFLAGS))
 $(OBJDIR)/$(TESTS_DIR)/%: $(TESTS_LDDEPENDS)
        @echo + cc [TESTS] $<
@@ -29,8 +30,8 @@ $(OBJDIR)/$(TESTS_DIR)/%: $(TESTS_LDDEPENDS)
        fi
 
 install-tests: $(TESTS_EXECS)
-       @echo + install [TESTS] $(firstword $(INITRAMFS_PATHS))/bin/
+       @echo + install [TESTS] $(FIRST_INITRAMFS_PATH))/bin/
        $(V)for i in "$(TESTS_EXECS)"; \
        do \
-         cp $$i $(firstword $(INITRAMFS_PATHS))/bin/; \
+         cp $$i $(FIRST_INITRAMFS_PATH))/bin/; \
        done;
index e53a1c6..e8e3e31 100644 (file)
@@ -9,12 +9,12 @@ C3PO_TESTS_LDLIBS := -lc3po -lparlib -lm
 
 C3PO_TESTS_SRCS := $(ALL_C3PO_TEST_FILES)
 
+C3PO_TESTS_LDDEPENDS := $(C3PO_TESTS_DIR)/%.c 
+
 TESTS_EXECS  += $(patsubst $(C3PO_TESTS_DIR)/%.c, \
                       $(OBJDIR)/$(C3PO_TESTS_DIR)/%, \
                       $(C3PO_TESTS_SRCS))
 
-C3PO_TESTS_LDDEPENDS := $(C3PO_TESTS_DIR)/%.c 
-
 STATIC := $(findstring static,$(C3PO_TESTS_CFLAGS))
 $(OBJDIR)/$(C3PO_TESTS_DIR)/%: $(C3PO_TESTS_LDDEPENDS)
        @echo + cc [C3PO_TESTS] $<