4 # (Oh man! This is hacky, but beautiful at the same time, much like the
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 += libaxwin2.so libimage_sif.so
17 USRAPPS := init login CLIShell cat ls mount
20 USRAPPS += ifconfig ping telnet irc
23 ALL_DYNMODS = $(addprefix all-,$(DYNMODS))
24 ALL_MODULES := $(addprefix all-,$(MODULES))
25 ALL_USRLIBS := $(addprefix all-,$(USRLIBS))
26 ALL_USRAPPS := $(addprefix all-,$(USRAPPS))
27 CLEAN_DYNMODS := $(addprefix clean-,$(DYNMODS))
28 CLEAN_MODULES := $(addprefix clean-,$(MODULES))
29 CLEAN_USRLIBS := $(addprefix clean-,$(USRLIBS))
30 CLEAN_USRAPPS := $(addprefix clean-,$(USRAPPS))
31 INSTALL_DYNMODS := $(addprefix install-,$(DYNMODS))
32 INSTALL_MODULES := $(addprefix install-,$(MODULES))
33 INSTALL_USRLIBS := $(addprefix install-,$(USRLIBS))
34 INSTALL_USRAPPS := $(addprefix install-,$(USRAPPS))
35 AI_DYNMODS := $(addprefix allinstall-,$(DYNMODS))
36 AI_MODULES := $(addprefix allinstall-,$(MODULES))
37 AI_USRLIBS := $(addprefix allinstall-,$(USRLIBS))
38 AI_USRAPPS := $(addprefix allinstall-,$(USRAPPS))
40 .PHONY: all clean install \
41 $(ALL_MODULES) all-Kernel $(ALL_USRLIBS) $(ALL_USRAPPS) \
42 $(AI_MODULES) allinstall-Kernel $(AI_USRLIBS) $(AI_USRAPPS) \
43 $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS) \
44 $(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS)
46 kmode: $(AI_MODULES) $(AI_DYNMODS) allinstall-Kernel
48 all-user: $(ALL_USRLIBS) $(ALL_USRAPPS)
49 clean-user: $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
51 all: $(ALL_DYNMODS) $(ALL_MODULES) all-Kernel $(ALL_USRLIBS) $(ALL_USRAPPS)
52 all-install: $(AI_DYNMODS) $(AI_MODULES) allinstall-Kernel $(AI_USRLIBS) $(AI_USRAPPS)
53 clean: $(CLEAN_DYNMODS) $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
54 install: install-Filesystem $(INSTALL_DYNMODS) $(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS)
57 $(ALL_DYNMODS): all-%:
58 +@echo === Dynamic Module: $* && BUILDTYPE=dynamic $(SUBMAKE) all -C Modules/$*
59 $(ALL_MODULES): all-%:
60 +@echo === Module: $* && BUILDTYPE=static $(SUBMAKE) all -C Modules/$*
62 +@echo === Kernel && $(SUBMAKE) all -C Kernel
63 $(ALL_USRLIBS): all-%:
64 +@echo === User Library: $* && $(SUBMAKE) all -C Usermode/Libraries/$*_src
65 $(ALL_USRAPPS): all-%:
66 +@echo === User Application: $* && $(SUBMAKE) all -C Usermode/Applications/$*_src
69 $(AI_DYNMODS): allinstall-%:
70 +@echo === Dynamic Module: $* && BUILDTYPE=dynamic $(SUBMAKE) all install -C Modules/$*
71 $(AI_MODULES): allinstall-%:
72 +@echo === Module: $* && BUILDTYPE=static $(SUBMAKE) all install -C Modules/$*
74 +@echo === Kernel && $(SUBMAKE) all install -C Kernel
75 $(AI_USRLIBS): allinstall-%:
76 +@echo === User Library: $* && $(SUBMAKE) all install -C Usermode/Libraries/$*_src
77 $(AI_USRAPPS): allinstall-%:
78 +@echo === User Application: $* && $(SUBMAKE) all install -C Usermode/Applications/$*_src
80 # Clean up compilation
81 $(CLEAN_DYNMODS): clean-%:
82 +@BUILDTYPE=dynamic $(SUBMAKE) clean -C Modules/$*
83 $(CLEAN_MODULES): clean-%:
84 +@BUILDTYPE=static $(SUBMAKE) clean -C Modules/$*
86 +@$(SUBMAKE) clean -C Kernel
87 $(CLEAN_USRLIBS): clean-%:
88 +@$(SUBMAKE) clean -C Usermode/Libraries/$*_src
89 $(CLEAN_USRAPPS): clean-%:
90 +@$(SUBMAKE) clean -C Usermode/Applications/$*_src
93 $(INSTALL_DYNMODS): install-%:
94 @BUILDTYPE=dynamic $(SUBMAKE) install -C Modules/$*
95 $(INSTALL_MODULES): install-%:
96 @BUILDTYPE=static $(SUBMAKE) install -C Modules/$*
98 @$(SUBMAKE) install -C Usermode/Filesystem
100 @$(SUBMAKE) install -C Kernel
101 $(INSTALL_USRLIBS): install-%:
102 @$(SUBMAKE) install -C Usermode/Libraries/$*_src
103 $(INSTALL_USRAPPS): install-%:
104 @$(SUBMAKE) install -C Usermode/Applications/$*_src