| 1 | #
|
|---|
| 2 | # Copyright (c) 2006 Martin Decky
|
|---|
| 3 | # All rights reserved.
|
|---|
| 4 | #
|
|---|
| 5 | # Redistribution and use in source and binary forms, with or without
|
|---|
| 6 | # modification, are permitted provided that the following conditions
|
|---|
| 7 | # are met:
|
|---|
| 8 | #
|
|---|
| 9 | # - Redistributions of source code must retain the above copyright
|
|---|
| 10 | # notice, this list of conditions and the following disclaimer.
|
|---|
| 11 | # - Redistributions in binary form must reproduce the above copyright
|
|---|
| 12 | # notice, this list of conditions and the following disclaimer in the
|
|---|
| 13 | # documentation and/or other materials provided with the distribution.
|
|---|
| 14 | # - The name of the author may not be used to endorse or promote products
|
|---|
| 15 | # derived from this software without specific prior written permission.
|
|---|
| 16 | #
|
|---|
| 17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 27 | #
|
|---|
| 28 |
|
|---|
| 29 | .PHONY: all build_dist clean_dist clean
|
|---|
| 30 |
|
|---|
| 31 | include Makefile.common
|
|---|
| 32 |
|
|---|
| 33 | all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(PREBUILD) build_dist
|
|---|
| 34 | $(MAKE) -r -f $(BUILD) PRECHECK=$(PRECHECK)
|
|---|
| 35 | ifneq ($(POSTBUILD),)
|
|---|
| 36 | $(MAKE) -r -f $(POSTBUILD) PRECHECK=$(PRECHECK)
|
|---|
| 37 | endif
|
|---|
| 38 |
|
|---|
| 39 | build_dist: clean_dist
|
|---|
| 40 | mkdir -p "$(DIST_PATH)/app/"
|
|---|
| 41 | mkdir -p "$(DIST_PATH)/cfg/net/"
|
|---|
| 42 | mkdir -p "$(DIST_PATH)/data/cfg/"
|
|---|
| 43 | mkdir -p "$(DIST_PATH)/lib/"
|
|---|
| 44 | mkdir -p "$(DIST_PATH)/loc/"
|
|---|
| 45 | mkdir -p "$(DIST_PATH)/log/"
|
|---|
| 46 | mkdir -p "$(DIST_PATH)/srv/"
|
|---|
| 47 | mkdir -p "$(DIST_PATH)/test/"
|
|---|
| 48 | mkdir -p "$(DIST_PATH)/tmp/"
|
|---|
| 49 | mkdir -p "$(DIST_PATH)/vol/"
|
|---|
| 50 | for file in $(RD_SRVS) ; do \
|
|---|
| 51 | cp "$$file" "$(DIST_PATH)/srv/" ; \
|
|---|
| 52 | done
|
|---|
| 53 | for file in $(RD_LIBS) ; do \
|
|---|
| 54 | cp "$$file" "$(DIST_PATH)/lib/" ; \
|
|---|
| 55 | done
|
|---|
| 56 | ifeq ($(CONFIG_DEVEL_FILES), y)
|
|---|
| 57 | mkdir -p "$(DIST_PATH)/inc/c/"
|
|---|
| 58 | cp -r -L "$(USPACE_PATH)/lib/c/include/." "$(DIST_PATH)/inc/c/"
|
|---|
| 59 | cp -r -L "$(ROOT_PATH)/abi/include/." "$(DIST_PATH)/inc/c/"
|
|---|
| 60 | cp -r -L "$(USPACE_PATH)/lib/c/arch/$(UARCH)/include/." "$(DIST_PATH)/inc/c/"
|
|---|
| 61 | cat "$(USPACE_PATH)/lib/c/arch/$(UARCH)/_link.ld" | sed 's/^STARTUP(.*)$$//g' > "$(DIST_PATH)/inc/_link.ld"
|
|---|
| 62 | endif
|
|---|
| 63 | for file in $(RD_APPS) ; do \
|
|---|
| 64 | cp "$$file" "$(DIST_PATH)/app/" ; \
|
|---|
| 65 | done
|
|---|
| 66 | for file in $(RD_DATA) ; do \
|
|---|
| 67 | cp "$$file" "$(DIST_PATH)/" ; \
|
|---|
| 68 | done
|
|---|
| 69 | ifeq ($(CONFIG_PCUT_TESTS),y)
|
|---|
| 70 | echo "echo Running all tests..." >"$(DIST_PATH)/test/run_all"
|
|---|
| 71 | echo "<html><head><title>HelenOS test results</title></head><body>" >"$(DIST_PATH)/test/test.html"
|
|---|
| 72 | echo "<h1>HelenOS test results</h1><ul>" >>"$(DIST_PATH)/test/test.html"
|
|---|
| 73 | for file in $(RD_TESTS) ; do \
|
|---|
| 74 | file2=`basename $$file`; \
|
|---|
| 75 | cp "$$file" "$(DIST_PATH)/test/" ; \
|
|---|
| 76 | echo "echo ' ->' $$file2" >>"$(DIST_PATH)/test/run_all"; \
|
|---|
| 77 | echo "/test/$$file2 | to /test/$$file2.out" >>"$(DIST_PATH)/test/run_all"; \
|
|---|
| 78 | echo "cat /test/$$file2.out" >>"$(DIST_PATH)/test/run_all"; \
|
|---|
| 79 | echo "cp -f /test/$$file2.out /data/web/result-$$file2.txt" >>"$(DIST_PATH)/test/run_all"; \
|
|---|
| 80 | echo "<li><a href=\"result-$$file2.txt\">$$file2</a></li>" >>"$(DIST_PATH)/test/test.html"; \
|
|---|
| 81 | done
|
|---|
| 82 | echo "cp -f /test/test.html /data/web/test.html" >>"$(DIST_PATH)/test/run_all"
|
|---|
| 83 | echo "</ul></body></html>" >>"$(DIST_PATH)/test/test.html"
|
|---|
| 84 | endif
|
|---|
| 85 |
|
|---|
| 86 | ifeq ($(CONFIG_PCUT_SELF_TESTS),y)
|
|---|
| 87 | echo "echo Running all PCUT self-tests..." >"$(DIST_PATH)/test/run_pcut"
|
|---|
| 88 | echo "<html><head><title>Results of PCUT self-tests on HelenOS</title></head><body>" >"$(DIST_PATH)/test/pcut.html"
|
|---|
| 89 | echo "<h1>Results of PCUT self-tests on HelenOS</h1><ul>" >>"$(DIST_PATH)/test/pcut.html"
|
|---|
| 90 | for file in $(USPACE_PATH)/lib/pcut/test-libpcut-*; do \
|
|---|
| 91 | file2=`basename $$file`; \
|
|---|
| 92 | name=`echo "$$file2" | sed 's/test-libpcut-//'`; \
|
|---|
| 93 | cp "$$file" "$(DIST_PATH)/test/" ; \
|
|---|
| 94 | echo "echo ' ->' $$name" >>"$(DIST_PATH)/test/run_pcut"; \
|
|---|
| 95 | echo "/test/$$file2 | to /test/$$file2.out" >>"$(DIST_PATH)/test/run_pcut"; \
|
|---|
| 96 | echo "cat /test/$$file2.out" >>"$(DIST_PATH)/test/run_pcut"; \
|
|---|
| 97 | echo "cp -f /test/$$file2.out /data/web/result-$$file2.txt" >>"$(DIST_PATH)/test/run_pcut"; \
|
|---|
| 98 | echo "<li><a href=\"result-$$file2.txt\">$$name</a></li>" >>"$(DIST_PATH)/test/pcut.html"; \
|
|---|
| 99 | done
|
|---|
| 100 | echo "cp -f /test/pcut.html /data/web/pcut.html" >>"$(DIST_PATH)/test/run_pcut"
|
|---|
| 101 | echo "</ul></body></html>" >>"$(DIST_PATH)/test/pcut.html"
|
|---|
| 102 | endif
|
|---|
| 103 |
|
|---|
| 104 | for drv in $(RD_DRVS) ; do \
|
|---|
| 105 | drv_dir="`dirname "$$drv"`" ; \
|
|---|
| 106 | drv_name="`basename "$$drv"`" ; \
|
|---|
| 107 | mkdir -p "$(DIST_PATH)/$(DRVS_PATH)/$$drv_name" ; \
|
|---|
| 108 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$drv_dir/$$drv_name/$$drv_name" "$(DIST_PATH)/$(DRVS_PATH)/$$drv_name/" ; \
|
|---|
| 109 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$drv_dir/$$drv_name/$$drv_name.ma" "$(DIST_PATH)/$(DRVS_PATH)/$$drv_name/" ; \
|
|---|
| 110 | done
|
|---|
| 111 | for file in $(RD_DRV_CFG) ; do \
|
|---|
| 112 | file_dir="`dirname "$$file"`" ; \
|
|---|
| 113 | file_name="`basename "$$file"`" ; \
|
|---|
| 114 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/"*".dev" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
|
|---|
| 115 | done
|
|---|
| 116 | for file in $(RD_DRVS_FW) ; do \
|
|---|
| 117 | file_dir="`dirname "$$file"`" ; \
|
|---|
| 118 | file_name="`basename "$$file"`" ; \
|
|---|
| 119 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/$$file_name.fw" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
|
|---|
| 120 | done
|
|---|
| 121 | if ls $(DIST_OVERLAY_PATH)/* >/dev/null 2>/dev/null; then \
|
|---|
| 122 | cp -r -L $(DIST_OVERLAY_PATH)/* "$(DIST_PATH)"; \
|
|---|
| 123 | fi
|
|---|
| 124 |
|
|---|
| 125 | clean: clean_dist
|
|---|
| 126 | $(MAKE) -r -f $(BUILD) clean PRECHECK=$(PRECHECK)
|
|---|
| 127 | ifneq ($(POSTBUILD),)
|
|---|
| 128 | $(MAKE) -r -f $(POSTBUILD) clean PRECHECK=$(PRECHECK)
|
|---|
| 129 | endif
|
|---|
| 130 | rm -f $(POST_OUTPUT) $(BOOT_OUTPUT) arch/*/include/common.h
|
|---|
| 131 | find generic/src/ arch/*/src/ genarch/src/ -name '*.o' -follow -exec rm \{\} \;
|
|---|
| 132 | find . -name '*.d' -follow -exec rm \{\} \;
|
|---|
| 133 |
|
|---|
| 134 | clean_dist:
|
|---|
| 135 | rm -f $(INITRD).img $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) $(COMPS).o $(COMPS)_desc.o $(COMPS).zip $(LINK)
|
|---|
| 136 | find $(USPACE_PATH)/dist -mindepth 1 -maxdepth 1 -type f -exec rm \{\} \;
|
|---|
| 137 | rm -f $(USPACE_PATH)/dist/srv/*
|
|---|
| 138 | rm -rf $(USPACE_PATH)/dist/drv/*
|
|---|
| 139 | rm -rf $(USPACE_PATH)/dist/lib/*
|
|---|
| 140 | rm -rf $(USPACE_PATH)/dist/inc/*
|
|---|
| 141 | rm -f $(USPACE_PATH)/dist/app/*
|
|---|
| 142 | rm -f $(USPACE_PATH)/dist/test/*
|
|---|
| 143 | rm -f $(USPACE_PATH)/dist/cfg/net/*
|
|---|