[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 |
|
---|
[4872160] | 29 | .PHONY: all build_dist build_comps clean_dist clean
|
---|
[98376de] | 30 |
|
---|
[4872160] | 31 | include Makefile.common
|
---|
[98376de] | 32 |
|
---|
[4872160] | 33 | all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(PREBUILD)
|
---|
| 34 | $(MAKE) -f $(BUILD) PRECHECK=$(PRECHECK)
|
---|
| 35 | ifneq ($(POSTBUILD),)
|
---|
| 36 | $(MAKE) -f $(POSTBUILD) PRECHECK=$(PRECHECK)
|
---|
| 37 | endif
|
---|
[98376de] | 38 |
|
---|
[4872160] | 39 | build_comps: $(COMPONENTS) $(LINK).in
|
---|
| 40 | $(PACK) $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) arch/$(KARCH) $(COMPONENTS)
|
---|
[98376de] | 41 |
|
---|
[fb48a0e] | 42 | $(INITRD).img: build_dist
|
---|
[4872160] | 43 | ifeq ($(RDFMT),tmpfs)
|
---|
| 44 | $(MKTMPFS) $(DIST_PATH) $@
|
---|
| 45 | endif
|
---|
| 46 | ifeq ($(RDFMT),fat)
|
---|
[14f2100] | 47 | $(MKFAT) 1048576 $(DIST_PATH) $@
|
---|
[4872160] | 48 | endif
|
---|
[cc1a727] | 49 | ifeq ($(RDFMT),ext2fs)
|
---|
| 50 | $(MKEXT2) 1048576 $(DIST_PATH) $@
|
---|
| 51 | endif
|
---|
[41f7564] | 52 |
|
---|
[4872160] | 53 | build_dist: clean_dist
|
---|
| 54 | for file in $(RD_SRVS) ; do \
|
---|
| 55 | cp "$$file" "$(DIST_PATH)/srv/" ; \
|
---|
| 56 | done
|
---|
[04803bf] | 57 | for file in $(RD_LIBS) ; do \
|
---|
| 58 | cp "$$file" "$(DIST_PATH)/lib/" ; \
|
---|
| 59 | done
|
---|
[a8010272] | 60 | ifeq ($(CONFIG_DEVEL_FILES), y)
|
---|
| 61 | mkdir "$(DIST_PATH)/inc/c/"
|
---|
| 62 | cp -r -L "$(USPACE_PATH)/lib/c/include/." "$(DIST_PATH)/inc/c/"
|
---|
| 63 | cat "$(USPACE_PATH)/lib/c/arch/$(UARCH)/_link.ld" | sed 's/^STARTUP(.*)$$//g' > "$(DIST_PATH)/inc/_link.ld"
|
---|
| 64 | endif
|
---|
[4872160] | 65 | for file in $(RD_APPS) ; do \
|
---|
| 66 | cp "$$file" "$(DIST_PATH)/app/" ; \
|
---|
| 67 | done
|
---|
[c47e1a8] | 68 | for drv in $(RD_DRVS) ; do \
|
---|
[5203e256] | 69 | drv_dir="`dirname "$$drv"`" ; \
|
---|
| 70 | drv_name="`basename "$$drv"`" ; \
|
---|
| 71 | mkdir -p "$(DIST_PATH)/$(DRVS_PATH)/$$drv_name" ; \
|
---|
| 72 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$drv_dir/$$drv_name/$$drv_name" "$(DIST_PATH)/$(DRVS_PATH)/$$drv_name/" ; \
|
---|
| 73 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$drv_dir/$$drv_name/$$drv_name.ma" "$(DIST_PATH)/$(DRVS_PATH)/$$drv_name/" ; \
|
---|
[c47e1a8] | 74 | done
|
---|
| 75 | for file in $(RD_DRV_CFG) ; do \
|
---|
[5203e256] | 76 | file_dir="`dirname "$$file"`" ; \
|
---|
| 77 | file_name="`basename "$$file"`" ; \
|
---|
| 78 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/$$file_name.dev" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
|
---|
[c47e1a8] | 79 | done
|
---|
[faf9752] | 80 |
|
---|
[4872160] | 81 | clean: clean_dist
|
---|
| 82 | $(MAKE) -f $(BUILD) clean PRECHECK=$(PRECHECK)
|
---|
| 83 | ifneq ($(POSTBUILD),)
|
---|
| 84 | $(MAKE) -f $(POSTBUILD) clean PRECHECK=$(PRECHECK)
|
---|
| 85 | endif
|
---|
| 86 | rm -fr $(SANDBOX)
|
---|
| 87 | rm -f $(POST_OUTPUT) $(BOOT_OUTPUT) $(DEPEND) $(DEPEND_PREV) arch/*/include/common.h
|
---|
| 88 | find generic/src/ arch/*/src/ genarch/src/ -name '*.o' -follow -exec rm \{\} \;
|
---|
[98376de] | 89 |
|
---|
[4872160] | 90 | clean_dist:
|
---|
[fb48a0e] | 91 | rm -f $(INITRD).img $(COMPS_H) $(COMPS_C) $(LINK) $(LINK).comp *.co
|
---|
[a79d88d] | 92 | rm -f $(USPACE_PATH)/dist/srv/*
|
---|
| 93 | rm -rf $(USPACE_PATH)/dist/drv/*
|
---|
[04803bf] | 94 | rm -f $(USPACE_PATH)/dist/lib/*
|
---|
[a8010272] | 95 | rm -rf $(USPACE_PATH)/dist/inc/*
|
---|
[4872160] | 96 | rm -f $(USPACE_PATH)/dist/app/*
|
---|
| 97 | rm -f $(USPACE_PATH)/dist/cfg/net/*
|
---|