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 build_comps clean_dist clean
|
---|
30 |
|
---|
31 | include Makefile.common
|
---|
32 |
|
---|
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
|
---|
38 |
|
---|
39 | build_comps: $(COMPONENTS) $(LINK).in
|
---|
40 | $(PACK) $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) arch/$(KARCH) $(COMPONENTS)
|
---|
41 |
|
---|
42 | $(INITRD).img: $(INITRD).fs
|
---|
43 | $(MKHORD) $(PAGE_SIZE) $< $@
|
---|
44 |
|
---|
45 | $(INITRD).fs: build_dist
|
---|
46 | ifeq ($(RDFMT),tmpfs)
|
---|
47 | $(MKTMPFS) $(DIST_PATH) $@
|
---|
48 | endif
|
---|
49 | ifeq ($(RDFMT),fat)
|
---|
50 | $(MKFAT) 1048576 $(DIST_PATH) $@
|
---|
51 | endif
|
---|
52 |
|
---|
53 | build_dist: clean_dist
|
---|
54 | for file in $(RD_SRVS) ; do \
|
---|
55 | cp "$$file" "$(DIST_PATH)/srv/" ; \
|
---|
56 | done
|
---|
57 | for file in $(RD_APPS) ; do \
|
---|
58 | cp "$$file" "$(DIST_PATH)/app/" ; \
|
---|
59 | done
|
---|
60 | for file in $(NET_CFG) ; do \
|
---|
61 | cp "$$file" "$(DIST_PATH)/cfg/net/" ; \
|
---|
62 | done
|
---|
63 | for drv in $(RD_DRVS) ; do \
|
---|
64 | mkdir -p "$(DIST_PATH)/$(DRVS_PATH)/$$drv" ; \
|
---|
65 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$drv/$$drv" "$(DIST_PATH)/$(DRVS_PATH)/$$drv/$$drv" ; \
|
---|
66 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$drv/$$drv.ma" "$(DIST_PATH)/$(DRVS_PATH)/$$drv/$$drv.ma" ; \
|
---|
67 | done
|
---|
68 | for file in $(RD_DRV_CFG) ; do \
|
---|
69 | cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file" "$(DIST_PATH)/$(DRVS_PATH)/$$file" ; \
|
---|
70 | done
|
---|
71 |
|
---|
72 | clean: clean_dist
|
---|
73 | $(MAKE) -f $(BUILD) clean PRECHECK=$(PRECHECK)
|
---|
74 | ifneq ($(POSTBUILD),)
|
---|
75 | $(MAKE) -f $(POSTBUILD) clean PRECHECK=$(PRECHECK)
|
---|
76 | endif
|
---|
77 | rm -fr $(SANDBOX)
|
---|
78 | rm -f $(POST_OUTPUT) $(BOOT_OUTPUT) $(DEPEND) $(DEPEND_PREV) arch/*/include/common.h
|
---|
79 | find generic/src/ arch/*/src/ genarch/src/ -name '*.o' -follow -exec rm \{\} \;
|
---|
80 |
|
---|
81 | clean_dist:
|
---|
82 | rm -f $(INITRD).fs $(INITRD).img $(COMPS_H) $(COMPS_C) $(LINK) $(LINK).comp *.co
|
---|
83 | rm -f $(USPACE_PATH)/dist/srv/*
|
---|
84 | rm -rf $(USPACE_PATH)/dist/drv/*
|
---|
85 | rm -f $(USPACE_PATH)/dist/app/*
|
---|
86 | rm -f $(USPACE_PATH)/dist/cfg/net/*
|
---|