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
15 USRLIBS += libimage_sif.so
17 USRAPPS := init login CLIShell cat ls mount
19 USRAPPS += ifconfig ping telnet irc
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: Kernel/Makefile Kernel/syscalls.lst
58 @make -C Kernel/ include/syscalls.h
61 $(ALL_DYNMODS): all-%:
62 +@echo === Dynamic Module: $* && BUILDTYPE=dynamic $(SUBMAKE) all -C Modules/$*
63 $(ALL_MODULES): all-%:
64 +@echo === Module: $* && BUILDTYPE=static $(SUBMAKE) all -C Modules/$*
66 +@echo === Kernel && $(SUBMAKE) all -C Kernel
67 $(ALL_USRLIBS): all-%:
68 +@echo === User Library: $* && $(SUBMAKE) all -C Usermode/Libraries/$*_src
69 $(ALL_USRAPPS): all-%:
70 +@echo === User Application: $* && $(SUBMAKE) all -C Usermode/Applications/$*_src
73 $(AI_DYNMODS): allinstall-%:
74 +@echo === Dynamic Module: $* && BUILDTYPE=dynamic $(SUBMAKE) all install -C Modules/$*
75 $(AI_MODULES): allinstall-%:
76 +@echo === Module: $* && BUILDTYPE=static $(SUBMAKE) all install -C Modules/$*
78 +@echo === Kernel && $(SUBMAKE) all install -C Kernel
79 $(AI_USRLIBS): allinstall-%:
80 +@echo === User Library: $* && $(SUBMAKE) all install -C Usermode/Libraries/$*_src
81 $(AI_USRAPPS): allinstall-%:
82 +@echo === User Application: $* && $(SUBMAKE) all install -C Usermode/Applications/$*_src
84 # Clean up compilation
85 $(CLEAN_DYNMODS): clean-%:
86 +@BUILDTYPE=dynamic $(SUBMAKE) clean -C Modules/$*
87 $(CLEAN_MODULES): clean-%:
88 +@BUILDTYPE=static $(SUBMAKE) clean -C Modules/$*
90 +@$(SUBMAKE) clean -C Kernel
91 $(CLEAN_USRLIBS): clean-%:
92 +@$(SUBMAKE) clean -C Usermode/Libraries/$*_src
93 $(CLEAN_USRAPPS): clean-%:
94 +@$(SUBMAKE) clean -C Usermode/Applications/$*_src
97 $(INSTALL_DYNMODS): install-%:
98 @BUILDTYPE=dynamic $(SUBMAKE) install -C Modules/$*
99 $(INSTALL_MODULES): install-%:
100 @BUILDTYPE=static $(SUBMAKE) install -C Modules/$*
102 @$(SUBMAKE) install -C Usermode/Filesystem
104 @$(SUBMAKE) install -C Kernel
105 $(INSTALL_USRLIBS): install-%:
106 @$(SUBMAKE) install -C Usermode/Libraries/$*_src
107 $(INSTALL_USRAPPS): install-%:
108 @$(SUBMAKE) install -C Usermode/Applications/$*_src