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
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
79 SyscallList: include/syscalls.h
80 include/syscalls.h: KernelLand/Kernel/Makefile KernelLand/Kernel/syscalls.lst
81 @make -C KernelLand/Kernel/ include/syscalls.h
83 _build_dynmod := BUILDTYPE=dynamic $(SUBMAKE) -C KernelLand/Modules/
84 _build_stmod := BUILDTYPE=static $(SUBMAKE) -C KernelLand/Modules/
85 _build_kernel := $(SUBMAKE) -C KernelLand/Kernel
89 +@echo === $2 && $3 all
90 $$(AI_$1): allinstall-%:
91 +@echo === $2 && $3 all install
92 $$(CLEAN_$1): clean-%:
93 +@echo === $2 && $3 clean
94 $$(INSTALL_$1): install-%:
98 $(eval $(call rules,DYNMODS,Dynamic Module: $$*,$(_build_dynmod)$$*))
99 $(eval $(call rules,MODULES,Module: $$*,$(_build_stmod)$$*))
100 $(eval $(call rules,USRLIBS,User Library: $$*,$(SUBMAKE) -C Usermode/Libraries/$$*_src))
101 $(eval $(call rules,EXTLIBS,External Library: $$*,$(SUBMAKE) -C Externals/$$*))
102 $(eval $(call rules,USRAPPS,User Application: $$*,$(SUBMAKE) -C Usermode/Applications/$$*_src))
104 +@echo === Kernel && $(_build_kernel) all
106 +@echo === Kernel && $(_build_kernel) all install
108 +@$(_build_kernel) clean
110 @$(_build_kernel) install
112 @$(SUBMAKE) install -C Usermode/Filesystem