4 # (Oh man! This is hacky, but beautiful at the same time, much like the
9 .PHONY: all clean SyscallList all-user
11 SUBMAKE = $(MAKE) --no-print-directory
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
17 USRAPPS := init login CLIShell cat ls mount
19 USRAPPS += ip dhcpclient ping telnet irc wget telnetd
20 USRAPPS += axwin3 gui_ate gui_shell
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))
39 .PHONY: all clean install \
40 kmode all-kmode clean-kmode \
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)
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
52 all-user: $(ALL_USRLIBS) $(ALL_USRAPPS)
53 clean-user: $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
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
60 utest: $(USRLIBS:%=utest-%)
62 $(USRLIBS:%=utest-%): utest-%:
63 @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src generate_exp
64 @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src utest -k
66 # TODO: Module tests using DiskTool and NetTest
70 SyscallList: include/syscalls.h
71 include/syscalls.h: KernelLand/Kernel/Makefile KernelLand/Kernel/syscalls.lst
72 @make -C KernelLand/Kernel/ include/syscalls.h
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
79 $(ALL_DYNMODS): all-%:
80 +@echo === Dynamic Module: $* && $(_build_dynmod)$* all
81 $(ALL_MODULES): all-%:
82 +@echo === Module: $* && $(_build_stmod)$* all
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
91 $(AI_DYNMODS): allinstall-%:
92 +@echo === Dynamic Module: $* && $(_build_dynmod)$* all install
93 $(AI_MODULES): allinstall-%:
94 +@echo === Module: $* && $(_build_stmod)$* all install
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
102 # Clean up compilation
103 $(CLEAN_DYNMODS): clean-%:
104 +@$(_build_dynmod)$* clean
105 $(CLEAN_MODULES): clean-%:
106 +@$(_build_stmod)$* clean
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
119 $(INSTALL_DYNMODS): install-%:
120 @$(_build_dynmod)$* install
121 $(INSTALL_MODULES): install-%:
122 @$(_build_stmod)$* install
124 @$(SUBMAKE) install -C Usermode/Filesystem
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