[98376de] | 1 | #
|
---|
[df4ed85] | 2 | # Copyright (c) 2006 Martin Decky
|
---|
[98376de] | 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 |
|
---|
[4646710] | 29 | .PHONY: all build_dist clean_dist clean
|
---|
[98376de] | 30 |
|
---|
[4872160] | 31 | include Makefile.common
|
---|
[98376de] | 32 |
|
---|
[4646710] | 33 | all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(PREBUILD) build_dist
|
---|
[e540bc87] | 34 | $(MAKE) -r -f $(BUILD) PRECHECK=$(PRECHECK)
|
---|
[4872160] | 35 | ifneq ($(POSTBUILD),)
|
---|
[e540bc87] | 36 | $(MAKE) -r -f $(POSTBUILD) PRECHECK=$(PRECHECK)
|
---|
[4872160] | 37 | endif
|
---|
[98376de] | 38 |
|
---|
[4872160] | 39 | build_dist: clean_dist
|
---|
[b4a9f5d] | 40 | mkdir -p "$(DIST_PATH)/app/"
|
---|
[b08e98ba] | 41 | mkdir -p "$(DIST_PATH)/cfg/net/"
|
---|
| 42 | mkdir -p "$(DIST_PATH)/lib/"
|
---|
| 43 | mkdir -p "$(DIST_PATH)/loc/"
|
---|
| 44 | mkdir -p "$(DIST_PATH)/log/"
|
---|
| 45 | mkdir -p "$(DIST_PATH)/srv/"
|
---|
[b4a9f5d] | 46 | mkdir -p "$(DIST_PATH)/test/"
|
---|
[b08e98ba] | 47 | mkdir -p "$(DIST_PATH)/tmp/"
|
---|
[4872160] | 48 | for file in $(RD_SRVS) ; do \
|
---|
| 49 | cp "$$file" "$(DIST_PATH)/srv/" ; \
|
---|
| 50 | done
|
---|
[04803bf] | 51 | for file in $(RD_LIBS) ; do \
|
---|
| 52 | cp "$$file" "$(DIST_PATH)/lib/" ; \
|
---|
| 53 | done
|
---|
[a8010272] | 54 | ifeq ($(CONFIG_DEVEL_FILES), y)
|
---|
[b4a9f5d] | 55 | mkdir -p "$(DIST_PATH)/inc/c/"
|
---|
[a8010272] | 56 | cp -r -L "$(USPACE_PATH)/lib/c/include/." "$(DIST_PATH)/inc/c/"
|
---|
[ea906c29] | 57 | cp -r -L "$(ROOT_PATH)/abi/include/." "$(DIST_PATH)/inc/c/"
|
---|
| 58 | cp -r -L "$(USPACE_PATH)/lib/c/arch/$(UARCH)/include/." "$(DIST_PATH)/inc/c/"
|
---|
[a8010272] | 59 | cat "$(USPACE_PATH)/lib/c/arch/$(UARCH)/_link.ld" | sed 's/^STARTUP(.*)$$//g' > "$(DIST_PATH)/inc/_link.ld"
|
---|
| 60 | endif
|
---|
[4872160] | 61 | for file in $(RD_APPS) ; do \
|
---|
| 62 | cp "$$file" "$(DIST_PATH)/app/" ; \
|
---|
| 63 | done
|
---|
[356c386] | 64 | for file in $(RD_DATA) ; do \
|
---|
| 65 | cp "$$file" "$(DIST_PATH)/" ; \
|
---|
| 66 | done
|
---|
[01579ad] | 67 | ifeq ($(CONFIG_PCUT_TESTS),y)
|
---|
| 68 | echo "echo Running all tests..." >"$(DIST_PATH)/test/run_all"
|
---|
| 69 | echo "<html><head><title>HelenOS test results</title></head><body>" >"$(DIST_PATH)/test/test.html"
|
---|
| 70 | echo "<h1>HelenOS test results</h1><ul>" >>"$(DIST_PATH)/test/test.html"
|
---|
| 71 | for file in $(RD_TESTS) ; do \
|
---|
| 72 | file2=`basename $$file`; \
|
---|
| 73 | cp "$$file" "$(DIST_PATH)/test/" ; \
|
---|
| 74 | echo "echo ' ->' $$file2" >>"$(DIST_PATH)/test/run_all"; \
|
---|
| 75 | echo "/test/$$file2 | to /test/$$file2.out" >>"$(DIST_PATH)/test/run_all"; \
|
---|
| 76 | echo "cat /test/$$file2.out" >>"$(DIST_PATH)/test/run_all"; \
|
---|
| 77 | echo "cp -f /test/$$file2.out /data/web/result-$$file2.txt" >>"$(DIST_PATH)/test/run_all"; \
|
---|
| 78 | echo "<li><a href=\"result-$$file2.txt\">$$file2</a></li>" >>"$(DIST_PATH)/test/test.html"; \
|
---|
| 79 | done
|
---|
| 80 | echo "cp -f /test/test.html /data/web/test.html" >>"$(DIST_PATH)/test/run_all"
|
---|
| 81 | echo "</ul></body></html>" >>"$(DIST_PATH)/test/test.html"
|
---|
| 82 | endif
|
---|
[356c386] | 83 |
|
---|
[824208bf] | 84 | ifeq ($(CONFIG_PCUT_SELF_TESTS),y)
|
---|
| 85 | echo "echo Running all PCUT self-tests..." >"$(DIST_PATH)/test/run_pcut"
|
---|
| 86 | echo "<html><head><title>Results of PCUT self-tests on HelenOS</title></head><body>" >"$(DIST_PATH)/test/pcut.html"
|
---|
| 87 | echo "<h1>Results of PCUT self-tests on HelenOS</h1><ul>" >>"$(DIST_PATH)/test/pcut.html"
|
---|
| 88 | for file in $(USPACE_PATH)/lib/pcut/test-libpcut-*; do \
|
---|
| 89 | file2=`basename $$file`; \
|
---|
| 90 | name=`echo "$$file2" | sed 's/test-libpcut-//'`; \
|
---|
| 91 | cp "$$file" "$(DIST_PATH)/test/" ; \
|
---|
| 92 | echo "echo ' ->' $$name" >>"$(DIST_PATH)/test/run_pcut"; \
|
---|
| 93 | echo "/test/$$file2 | to /test/$$file2.out" >>"$(DIST_PATH)/test/run_pcut"; \
|
---|
| 94 | echo "cat /test/$$file2.out" >>"$(DIST_PATH)/test/run_pcut"; \
|
---|
| 95 | echo "cp -f /test/$$file2.out /data/web/result-$$file2.txt" >>"$(DIST_PATH)/test/run_pcut"; \
|
---|
| 96 | echo "<li><a href=\"result-$$file2.txt\">$$name</a></li>" >>"$(DIST_PATH)/test/pcut.html"; \
|
---|
| 97 | done
|
---|
| 98 | echo "cp -f /test/pcut.html /data/web/pcut.html" >>"$(DIST_PATH)/test/run_pcut"
|
---|
| 99 | echo "</ul></body></html>" >>"$(DIST_PATH)/test/pcut.html"
|
---|
| 100 | endif
|
---|
[356c386] | 101 |
|
---|
[c47e1a8] | 102 | for drv in $(RD_DRVS) ; do \
|
---|
[5203e256] | 103 | drv_dir="`dirname "$$drv"`" ; \
|
---|
| 104 | drv_name="`basename "$$drv"`" ; \
|
---|
| 105 | mkdir -p "$(DIST_PATH)/$(DRVS_PATH)/$$drv_name" ; \
|
---|
| 106 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$drv_dir/$$drv_name/$$drv_name" "$(DIST_PATH)/$(DRVS_PATH)/$$drv_name/" ; \
|
---|
| 107 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$drv_dir/$$drv_name/$$drv_name.ma" "$(DIST_PATH)/$(DRVS_PATH)/$$drv_name/" ; \
|
---|
[c47e1a8] | 108 | done
|
---|
| 109 | for file in $(RD_DRV_CFG) ; do \
|
---|
[5203e256] | 110 | file_dir="`dirname "$$file"`" ; \
|
---|
| 111 | file_name="`basename "$$file"`" ; \
|
---|
[3c5b86c] | 112 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/"*".dev" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
|
---|
[c47e1a8] | 113 | done
|
---|
[8a64320e] | 114 | for file in $(RD_DRVS_FW) ; do \
|
---|
[66b3e0b] | 115 | file_dir="`dirname "$$file"`" ; \
|
---|
| 116 | file_name="`basename "$$file"`" ; \
|
---|
| 117 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/$$file_name.fw" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
|
---|
| 118 | done
|
---|
[8988fde] | 119 | if ls $(DIST_OVERLAY_PATH)/* >/dev/null 2>/dev/null; then \
|
---|
[53238ba] | 120 | cp -r -L $(DIST_OVERLAY_PATH)/* "$(DIST_PATH)"; \
|
---|
| 121 | fi
|
---|
[faf9752] | 122 |
|
---|
[4872160] | 123 | clean: clean_dist
|
---|
[e540bc87] | 124 | $(MAKE) -r -f $(BUILD) clean PRECHECK=$(PRECHECK)
|
---|
[4872160] | 125 | ifneq ($(POSTBUILD),)
|
---|
[e540bc87] | 126 | $(MAKE) -r -f $(POSTBUILD) clean PRECHECK=$(PRECHECK)
|
---|
[4872160] | 127 | endif
|
---|
[4761f54] | 128 | rm -f $(POST_OUTPUT) $(BOOT_OUTPUT) arch/*/include/common.h
|
---|
[4872160] | 129 | find generic/src/ arch/*/src/ genarch/src/ -name '*.o' -follow -exec rm \{\} \;
|
---|
[c8fbbe7] | 130 | find . -name '*.d' -follow -exec rm \{\} \;
|
---|
[98376de] | 131 |
|
---|
[4872160] | 132 | clean_dist:
|
---|
[94c05b89] | 133 | rm -f $(INITRD).img $(COMPS).s $(COMPS).h $(COMPS)_desc.c $(COMPONENTS_DEFLATE) $(COMPS).o $(COMPS)_desc.o $(COMPS).zip $(LINK)
|
---|
[356c386] | 134 | find $(USPACE_PATH)/dist -mindepth 1 -maxdepth 1 -type f -exec rm \{\} \;
|
---|
[a79d88d] | 135 | rm -f $(USPACE_PATH)/dist/srv/*
|
---|
| 136 | rm -rf $(USPACE_PATH)/dist/drv/*
|
---|
[dc20e31] | 137 | rm -rf $(USPACE_PATH)/dist/lib/*
|
---|
[a8010272] | 138 | rm -rf $(USPACE_PATH)/dist/inc/*
|
---|
[4872160] | 139 | rm -f $(USPACE_PATH)/dist/app/*
|
---|
[01579ad] | 140 | rm -f $(USPACE_PATH)/dist/test/*
|
---|
[4872160] | 141 | rm -f $(USPACE_PATH)/dist/cfg/net/*
|
---|