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 libc++.so libposix.so
14 USRLIBS += libreadline.so libnet.so liburi.so libpsocket.so
15 USRLIBS += libimage_sif.so libunicode.so libm.so
21 USRAPPS := init login CLIShell cat ls mount automounter
24 USRAPPS += ip dhcpclient ping telnet irc wget telnetd
25 USRAPPS += axwin3 gui_ate gui_terminal
28 AI_$1 := $$(addprefix allinstall-,$$($1))
29 ALL_$1 := $$(addprefix all-,$$($1))
30 CLEAN_$1 := $$(addprefix clean-,$$($1))
31 INSTALL_$1 := $$(addprefix install-,$$($1))
34 $(eval $(call targetclasses,DYNMODS))
35 $(eval $(call targetclasses,MODULES))
36 $(eval $(call targetclasses,USRLIBS))
37 $(eval $(call targetclasses,EXTLIBS))
38 $(eval $(call targetclasses,USRAPPS))
40 targetvars := $$(AI_$1) $$(ALL_$1) $$(CLEAN_$1) $$(INSTALL_$1)
42 .PHONY: all clean install \
43 ai-kmode all-kmode clean-kmode install-kmode \
44 ai-user all-user clean-user install-user \
47 .PHONY: allinstall-Kernel all-Kernel clean-Kernel install-Kernel \
48 $(call targetvars,DYNMODS) \
49 $(call targetvars,MODULES) \
50 $(call targetvars,USRLIBS) \
51 $(call targetvars,EXTLIBS) \
52 $(call targetvars,USRAPPS)
54 ai-kmode: $(AI_MODULES) allinstall-Kernel $(AI_DYNMODS)
55 all-kmode: $(ALL_MODULES) all-Kernel $(ALL_DYNMODS)
56 clean-kmode: $(CLEAN_MODULES) $(CLEAN_DYNMODS) clean-Kernel
57 install-kmode: $(INSTALL_MODULES) install-Kernel $(INSTALL_DYNMODS)
59 ai-user: $(AI_USRLIBS) $(AI_EXTLIBS) $(AI_USRAPPS)
60 all-user: $(ALL_USRLIBS) $(ALL_EXTLIBS) $(ALL_USRAPPS)
61 clean-user: $(CLEAN_USRLIBS) $(CLEAN_EXTLIBS) $(CLEAN_USRAPPS)
62 install-user: $(INSTALL_USRLIBS) $(INSTALL_EXTLIBS) $(INSTALL_USRAPPS)
64 all: SyscallList all-user all-kmode
65 all-install: install-Filesystem SyscallList ai-user ai-kmode
66 clean: clean-kmode clean-user
67 install: install-Filesystem SyscallList install-user install-kmode
69 utest: $(USRLIBS:%=utest-%)
71 $(USRLIBS:%=utest-%): utest-%:
72 @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src generate_exp
73 @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src utest -k
75 # TODO: Module tests using DiskTool and NetTest
80 @$(SUBMAKE) -C Tools/nativelib
81 @$(SUBMAKE) -C Tools/NetTest
82 @$(SUBMAKE) -C Tools/NetTest_Runner
83 @cd Tools && ./nettest_runner
85 SyscallList: include/syscalls.h
86 include/syscalls.h: KernelLand/Kernel/Makefile KernelLand/Kernel/syscalls.lst
87 @make -C KernelLand/Kernel/ include/syscalls.h
89 _build_dynmod := BUILDTYPE=dynamic $(SUBMAKE) -C KernelLand/Modules/
90 _build_stmod := BUILDTYPE=static $(SUBMAKE) -C KernelLand/Modules/
91 _build_kernel := $(SUBMAKE) -C KernelLand/Kernel
95 +@echo === $2 && $3 all
96 $$(AI_$1): allinstall-%:
97 +@echo === $2 && $3 all install
98 $$(CLEAN_$1): clean-%:
99 +@echo === $2 && $3 clean
100 $$(INSTALL_$1): install-%:
104 $(eval $(call rules,DYNMODS,Dynamic Module: $$*,$(_build_dynmod)$$*))
105 $(eval $(call rules,MODULES,Module: $$*,$(_build_stmod)$$*))
106 $(eval $(call rules,USRLIBS,User Library: $$*,$(SUBMAKE) -C Usermode/Libraries/$$*_src))
107 $(eval $(call rules,EXTLIBS,External Library: $$*,$(SUBMAKE) -C Externals/$$*))
108 $(eval $(call rules,USRAPPS,User Application: $$*,$(SUBMAKE) -C Usermode/Applications/$$*_src))
110 +@echo === Kernel && $(_build_kernel) all
112 +@echo === Kernel && $(_build_kernel) all install
114 +@$(_build_kernel) clean
116 @$(_build_kernel) install
118 @$(SUBMAKE) install -C Usermode/Filesystem