KernelLand - Better node chaching code
[tpg/acess2.git] / Makefile
1 #
2 # Acess2 Core Makefile
3 #
4 # (Oh man! This is hacky, but beautiful at the same time, much like the
5 # rest of Acess)
6
7 -include Makefile.cfg
8
9 .PHONY: all clean SyscallList all-user
10
11 SUBMAKE = $(MAKE) --no-print-directory
12
13 USRLIBS := crt0.o acess.ld ld-acess.so libc.so libposix.so
14 USRLIBS += libreadline.so libnet.so liburi.so libpsocket.so
15 USRLIBS += libimage_sif.so libunicode.so
16
17 USRAPPS := init login CLIShell cat ls mount
18 USRAPPS += bomb lspci
19 USRAPPS += ip dhcpclient ping telnet irc wget telnetd
20 USRAPPS += axwin3 gui_ate gui_shell
21
22 ALL_DYNMODS = $(addprefix all-,$(DYNMODS))
23 ALL_MODULES := $(addprefix all-,$(MODULES))
24 ALL_USRLIBS := $(addprefix all-,$(USRLIBS))
25 ALL_USRAPPS := $(addprefix all-,$(USRAPPS))
26 CLEAN_DYNMODS := $(addprefix clean-,$(DYNMODS))
27 CLEAN_MODULES := $(addprefix clean-,$(MODULES))
28 CLEAN_USRLIBS := $(addprefix clean-,$(USRLIBS))
29 CLEAN_USRAPPS := $(addprefix clean-,$(USRAPPS))
30 INSTALL_DYNMODS := $(addprefix install-,$(DYNMODS))
31 INSTALL_MODULES := $(addprefix install-,$(MODULES))
32 INSTALL_USRLIBS := $(addprefix install-,$(USRLIBS))
33 INSTALL_USRAPPS := $(addprefix install-,$(USRAPPS))
34 AI_DYNMODS := $(addprefix allinstall-,$(DYNMODS))
35 AI_MODULES := $(addprefix allinstall-,$(MODULES))
36 AI_USRLIBS := $(addprefix allinstall-,$(USRLIBS))
37 AI_USRAPPS := $(addprefix allinstall-,$(USRAPPS))
38
39 .PHONY: all clean install \
40         kmode all-kmode clean-kmode \
41         all-user clean-user \
42         utest mtest \
43         $(ALL_MODULES) all-Kernel $(ALL_USRLIBS) $(ALL_USRAPPS) \
44         $(AI_MODULES) allinstall-Kernel $(AI_USRLIBS) $(AI_USRAPPS) \
45         $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS) \
46         $(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS)
47
48 kmode:  $(AI_MODULES) $(AI_DYNMODS) allinstall-Kernel
49 all-kmode:      $(ALL_MODULES) $(ALL_DYNMODS) all-Kernel
50 clean-kmode:    $(CLEAN_MODULES) $(CLEAN_DYNMODS) clean-Kernel
51
52 all-user: $(ALL_USRLIBS) $(ALL_USRAPPS)
53 clean-user: $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
54
55 all:    SyscallList $(ALL_USRLIBS) $(ALL_USRAPPS) $(ALL_MODULES) all-Kernel $(ALL_DYNMODS)
56 all-install:    install-Filesystem SyscallList $(AI_USRLIBS) $(AI_USRAPPS) $(AI_MODULES) allinstall-Kernel $(AI_DYNMODS)
57 clean:  $(CLEAN_DYNMODS) $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
58 install:        install-Filesystem SyscallList $(INSTALL_USRLIBS) $(INSTALL_USRAPPS) $(INSTALL_DYNMODS) $(INSTALL_MODULES) install-Kernel
59
60 utest: $(USRLIBS:%=utest-%)
61
62 $(USRLIBS:%=utest-%): utest-%:
63         @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src generate_exp
64         @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src utest -k
65
66 # TODO: Module tests using DiskTool and NetTest
67 mtest:
68         @echo > /dev/null
69
70 SyscallList: include/syscalls.h
71 include/syscalls.h: KernelLand/Kernel/Makefile KernelLand/Kernel/syscalls.lst
72         @make -C KernelLand/Kernel/ include/syscalls.h
73
74 _build_dynmod := BUILDTYPE=dynamic $(SUBMAKE) -C KernelLand/Modules/
75 _build_stmod  := BUILDTYPE=static $(SUBMAKE) -C KernelLand/Modules/
76 _build_kernel := $(SUBMAKE) -C KernelLand/Kernel
77
78 # Compile Only
79 $(ALL_DYNMODS): all-%:
80         +@echo === Dynamic Module: $* && $(_build_dynmod)$* all
81 $(ALL_MODULES): all-%:
82         +@echo === Module: $* && $(_build_stmod)$* all
83 all-Kernel:
84         +@echo === Kernel && $(_build_kernel) all
85 $(ALL_USRLIBS): all-%:
86         +@echo === User Library: $* && $(SUBMAKE) all -C Usermode/Libraries/$*_src
87 $(ALL_USRAPPS): all-%:
88         +@echo === User Application: $* && $(SUBMAKE) all -C Usermode/Applications/$*_src
89
90 # Compile & Install
91 $(AI_DYNMODS): allinstall-%:
92         +@echo === Dynamic Module: $* && $(_build_dynmod)$* all install
93 $(AI_MODULES): allinstall-%:
94         +@echo === Module: $* && $(_build_stmod)$* all install
95 allinstall-Kernel:
96         +@echo === Kernel && $(_build_kernel) all install
97 $(AI_USRLIBS): allinstall-%:
98         +@echo === User Library: $* && $(SUBMAKE) all install -C Usermode/Libraries/$*_src
99 $(AI_USRAPPS): allinstall-%:
100         +@echo === User Application: $* && $(SUBMAKE) all install -C Usermode/Applications/$*_src
101
102 # Clean up compilation
103 $(CLEAN_DYNMODS): clean-%:
104         +@$(_build_dynmod)$* clean
105 $(CLEAN_MODULES): clean-%:
106         +@$(_build_stmod)$* clean
107 clean-Kernel:
108         +@$(_build_kernel) clean
109 $(CLEAN_USRLIBS): clean-%:
110         +@$(SUBMAKE) clean -C Usermode/Libraries/$*_src
111 $(CLEAN_USRAPPS): clean-%:
112         +@$(SUBMAKE) clean -C Usermode/Applications/$*_src
113
114 # Install
115 ifeq ($(ARCH),host)
116 install-%:
117         
118 else
119 $(INSTALL_DYNMODS): install-%:
120         @$(_build_dynmod)$* install
121 $(INSTALL_MODULES): install-%:
122         @$(_build_stmod)$* install
123 install-Filesystem:
124         @$(SUBMAKE) install -C Usermode/Filesystem
125 install-Kernel:
126         @$(_build_kernel) install
127 $(INSTALL_USRLIBS): install-%:
128         @$(SUBMAKE) install -C Usermode/Libraries/$*_src
129 $(INSTALL_USRAPPS): install-%:
130         @$(SUBMAKE) install -C Usermode/Applications/$*_src
131 endif

UCC git Repository :: git.ucc.asn.au