root/Whitix/branches/khorben-libc/Makefile

Revision 1969, 2.8 KB (checked in by khorben, 3 years ago)

Set DESTDIR explicitly

Line 
1#===============================#
2#=   CONFIGURATION OPTIONS     =#
3#===============================#
4
5# Change this to build for a different arch
6ARCH = i386
7
8#Change to N to produce a smaller kernel if debug functionality is not required
9CONFIG_ALLSYMS = Y
10
11PWD = $(shell pwd)
12INCLUDE_DIR := $(PWD)/include
13override CFLAGS += -I$(INCLUDE_DIR)
14CC = gcc
15TAGS = ctags -I SYMBOL_EXPORT -I PACKED
16override GENISO_FLAGS += -input-charset iso8859-1 -b Boot/isoboot -m'.svn' -no-emul-boot -c Boot/boot.cat -boot-load-size 4 -boot-info-table -iso-level 2 -l CdRoot
17
18#Make sure all makefiles can see everything
19export ARCH
20
21# All directories that are to be built or cleaned.
22KERNEL_SUBDIRS = arch/$(ARCH) devices fs kernel lib memory net video
23SUBDIRS = $(KERNEL_SUBDIRS) user
24
25DIRMODULES = CdRoot/System/Modules CdRoot/System/Modules/Core CdRoot/System/Modules/Input CdRoot/System/Modules/Network CdRoot/System/Modules/Storage CdRoot/System/Modules/Filesystems CdRoot/System/Modules/Video
26DIRLIST = CdRoot CdRoot/Applications CdRoot/Mount CdRoot/System/Devices CdRoot/System/Include CdRoot/System/Runtime CdRoot/System/Runtime/C CdRoot/System/Startup/
27
28all: cd
29        mkdir -p $(DIRLIST)
30        (cd user && $(MAKE) DESTDIR="$(PWD)/CdRoot" install)
31        genisoimage -o cd.iso $(GENISO_FLAGS)
32
33floppy: kern
34       
35ifneq ($(CONFIG_ALLSYMS),Y)
36        strip -s kern
37endif
38
39cd: kern
40        mkdir -p CdRoot/Boot
41        cp arch/$(ARCH)/boot/iso/isoboot CdRoot/Boot/isoboot
42        cp arch/$(ARCH)/boot/setup CdRoot/Boot/KeLoader
43        cp kern CdRoot/Boot/Kernel
44        cp Boot.modules CdRoot/Boot/Boot.modules
45        mv CdRoot/System/Modules/Filesystems/cdfs.sys CdRoot/System/Modules/Core/cdfs.sys
46        mv CdRoot/System/Modules/Storage/ata_ide.sys CdRoot/System/Modules/Core/ata_ide.sys
47        mv CdRoot/System/Modules/Video/console.sys CdRoot/System/Modules/Core/
48       
49        nm kern | sort -u > kernel.txt
50
51ifneq ($(CONFIG_ALLSYMS),Y)
52        strip -s kern -R .comment
53endif
54
55        genisoimage -o cd.iso $(GENISO_FLAGS)
56
57kern: subdirs
58        ld -M -T link.ld arch/$(ARCH)/boot/*.o arch/$(ARCH)/lib/*.o arch/$(ARCH)/kernel/*.o arch/$(ARCH)/mm/*.o kernel/*.o lib/*.o memory/*.o video/*.o -o kern > kernel.txt
59        mkdir -p $(DIRMODULES)
60        for i in net fs devices memory video kernel; do \
61                (cd $$i && $(MAKE) modules_install) || exit 1; \
62        done
63
64subdirs:
65        for i in $(SUBDIRS); do (cd $$i && $(MAKE)) || exit; done
66
67$(SUBDIRS):
68        (cd $@ && $(MAKE))
69
70.PHONY: subdirs $(SUBDIRS)
71
72clean:
73        @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit; done
74        rm -f cd.iso kern out.txt kernel.txt
75        rm -rf CdRoot
76
77#TODO: Update
78help:
79        @echo =====================
80        @echo = Whitix build help =
81        @echo =====================
82        @echo -
83        @echo "all - build the kernel and userspace"
84        @echo "floppy - build the kernel and construct a floppy image"
85        @echo "clean - remove all intermediate files"
86        @echo "See the readme file for more help"
87
88tags:
89        find $(KERNEL_SUBDIRS) include -name "*.[ch]" | $(TAGS) -L -
90
91# Phony targets.
92.PHONY: clean help cd tags
Note: See TracBrowser for help on using the browser.