root/Whitix/branches/keobject/Makefile

Revision 1372, 3.0 KB (checked in by mwhitworth, 4 years ago)

We no longer install modules in the kernel directory.

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 += -c Boot/boot.catalog -R -input-charset iso8859-1 -b Boot/Grub/stage2_eltorito -m'.svn' -no-emul-boot -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/Boot CdRoot/Boot/Grub CdRoot/Applications CdRoot/Mount CdRoot/System/Devices CdRoot/System/Include CdRoot/System/Runtime CdRoot/System/Runtime/C CdRoot/System/Startup/ CdRoot/System/Config
27
28all: cd
29        mkdir -p $(DIRLIST)
30        $(MAKE) -C user 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 kern CdRoot/Boot/Kernel
42        mv CdRoot/System/Modules/Filesystems/cdfs.sys CdRoot/System/Modules/Core/cdfs.sys
43        mv CdRoot/System/Modules/Storage/ata_ide.sys CdRoot/System/Modules/Core/ata_ide.sys
44        mv CdRoot/System/Modules/Video/console.sys CdRoot/System/Modules/Core/
45       
46        nm kern | sort -u > kernel.txt
47
48ifneq ($(CONFIG_ALLSYMS),Y)
49        strip -s kern -R .comment
50endif
51
52kern: subdirs
53        ld -M -T link.ld arch/$(ARCH)/boot/*.o arch/$(ARCH)/acpi/*.o arch/$(ARCH)/lib/*.o arch/$(ARCH)/kernel/*.o \
54         arch/$(ARCH)/mm/*.o fs/icfs/*.o fs/kfs/*.o fs/vfs/*.o fs/devfs/*.o \
55         devices/kedev/*.o devices/acpi/*.o devices/misc/*.o kernel/*.o lib/*.o memory/*.o video/*.o \
56          -o kern > kernel.txt
57        mkdir -p $(DIRMODULES)
58        $(MAKE) -C net modules_install
59        $(MAKE) -C fs modules_install
60        $(MAKE) -C devices modules_install
61        $(MAKE) -C memory modules_install
62        $(MAKE) -C video modules_install
63
64subdirs:
65        for dir in $(SUBDIRS); do \
66                $(MAKE) -C $$dir || exit 1; \
67        done;
68
69$(SUBDIRS):
70        $(MAKE) -C $@
71
72.PHONY: subdirs $(SUBDIRS)
73
74clean:
75        $(MAKE) -C arch/$(ARCH) clean
76        $(MAKE) -C devices clean
77        $(MAKE) -C fs clean
78        $(MAKE) -C kernel clean
79        $(MAKE) -C lib clean
80        $(MAKE) -C net clean
81        $(MAKE) -C video clean
82        $(MAKE) -C memory clean
83        $(MAKE) -C user clean
84        rm -f cd.iso kern out.txt kernel.txt
85        rm -rf CdRoot
86
87#TODO: Update
88help:
89        @echo =====================
90        @echo = Whitix build help =
91        @echo =====================
92        @echo -
93        @echo "all - build the kernel and userspace"
94        @echo "floppy - build the kernel and construct a floppy image"
95        @echo "clean - remove all intermediate files"
96        @echo "See the readme file for more help"
97
98tags:
99        find $(KERNEL_SUBDIRS) include -name "*.[ch]" | $(TAGS) -L -
100
101# Phony targets.
102.PHONY: clean help cd tags
Note: See TracBrowser for help on using the browser.