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 libgcc.so libc.so
14 USRLIBS += libreadline.so libnet.so liburi.so libpsocket.so
15 USRLIBS += libimage_sif.so
17 USRAPPS := init login CLIShell cat ls mount
18 USRAPPS += bomb dhcpclient
19 USRAPPS += ip ping telnet irc wget telnetd
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 $(ALL_MODULES) all-Kernel $(ALL_USRLIBS) $(ALL_USRAPPS) \
41 $(AI_MODULES) allinstall-Kernel $(AI_USRLIBS) $(AI_USRAPPS) \
42 $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS) \
43 $(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS)
45 kmode: $(AI_MODULES) $(AI_DYNMODS) allinstall-Kernel
46 all-kmode: $(ALL_MODULES) $(ALL_DYNMODS) all-Kernel
48 all-user: $(ALL_USRLIBS) $(ALL_USRAPPS)
49 clean-user: $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
51 all: SyscallList $(ALL_USRLIBS) $(ALL_USRAPPS) $(ALL_MODULES) all-Kernel $(ALL_DYNMODS)
52 all-install: install-Filesystem SyscallList $(AI_USRLIBS) $(AI_USRAPPS) $(AI_MODULES) allinstall-Kernel $(AI_DYNMODS)
53 clean: $(CLEAN_DYNMODS) $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
54 install: install-Filesystem SyscallList $(INSTALL_USRLIBS) $(INSTALL_USRAPPS) $(INSTALL_DYNMODS) $(INSTALL_MODULES) install-Kernel
56 SyscallList: include/syscalls.h
57 include/syscalls.h: KernelLand/Kernel/Makefile KernelLand/Kernel/syscalls.lst
58 @make -C KernelLand/Kernel/ include/syscalls.h
60 _build_dynmod := BUILDTYPE=dynamic $(SUBMAKE) -C KernelLand/Modules/
61 _build_stmod := BUILDTYPE=static $(SUBMAKE) -C KernelLand/Modules/
62 _build_kernel := $(SUBMAKE) $1 -C KernelLand/Kernel
65 $(ALL_DYNMODS): all-%:
66 +@echo === Dynamic Module: $* && $(_build_dynmod)$* all
67 $(ALL_MODULES): all-%:
68 +@echo === Module: $* && $(_build_stmod)$* all
70 +@echo === Kernel && $(_build_kernel) all
71 $(ALL_USRLIBS): all-%:
72 +@echo === User Library: $* && $(SUBMAKE) all -C Usermode/Libraries/$*_src
73 $(ALL_USRAPPS): all-%:
74 +@echo === User Application: $* && $(SUBMAKE) all -C Usermode/Applications/$*_src
77 $(AI_DYNMODS): allinstall-%:
78 +@echo === Dynamic Module: $* && $(_build_dynmod)$* all install
79 $(AI_MODULES): allinstall-%:
80 +@echo === Module: $* && $(_build_stmod)$* all install
82 +@echo === Kernel && $(_build_kernel) all install
83 $(AI_USRLIBS): allinstall-%:
84 +@echo === User Library: $* && $(SUBMAKE) all install -C Usermode/Libraries/$*_src
85 $(AI_USRAPPS): allinstall-%:
86 +@echo === User Application: $* && $(SUBMAKE) all install -C Usermode/Applications/$*_src
88 # Clean up compilation
89 $(CLEAN_DYNMODS): clean-%:
90 +@$(_build_dynmod)$* clean
91 $(CLEAN_MODULES): clean-%:
92 +@$(_build_stmod)$* clean
94 +@$(_build_kernel) clean
95 $(CLEAN_USRLIBS): clean-%:
96 +@$(SUBMAKE) clean -C Usermode/Libraries/$*_src
97 $(CLEAN_USRAPPS): clean-%:
98 +@$(SUBMAKE) clean -C Usermode/Applications/$*_src
105 $(INSTALL_DYNMODS): install-%:
106 @$(_build_dynmod)$* install
107 $(INSTALL_MODULES): install-%:
108 @$(_build_stmod)$* install
110 @$(SUBMAKE) install -C Usermode/Filesystem
112 @$(_build_kernel) install
113 $(INSTALL_USRLIBS): install-%:
114 @$(SUBMAKE) install -C Usermode/Libraries/$*_src
115 $(INSTALL_USRAPPS): install-%:
116 @$(SUBMAKE) install -C Usermode/Applications/$*_src