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 += 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
47 all-kmode: $(ALL_MODULES) $(ALL_DYNMODS) all-Kernel
49 all-user: $(ALL_USRLIBS) $(ALL_USRAPPS)
50 clean-user: $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
52 all: SyscallList $(ALL_USRLIBS) $(ALL_USRAPPS) $(ALL_MODULES) all-Kernel $(ALL_DYNMODS)
53 all-install: SyscallList $(AI_USRLIBS) $(AI_USRAPPS) $(AI_MODULES) allinstall-Kernel $(AI_DYNMODS)
54 clean: $(CLEAN_DYNMODS) $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
55 install: install-Filesystem SyscallList $(INSTALL_USRLIBS) $(INSTALL_USRAPPS) $(INSTALL_DYNMODS) $(INSTALL_MODULES) install-Kernel
57 SyscallList: include/syscalls.h
58 include/syscalls.h: Kernel/Makefile Kernel/syscalls.lst
59 @make -C Kernel/ include/syscalls.h
62 $(ALL_DYNMODS): all-%:
63 +@echo === Dynamic Module: $* && BUILDTYPE=dynamic $(SUBMAKE) all -C Modules/$*
64 $(ALL_MODULES): all-%:
65 +@echo === Module: $* && BUILDTYPE=static $(SUBMAKE) all -C Modules/$*
67 +@echo === Kernel && $(SUBMAKE) all -C Kernel
68 $(ALL_USRLIBS): all-%:
69 +@echo === User Library: $* && $(SUBMAKE) all -C Usermode/Libraries/$*_src
70 $(ALL_USRAPPS): all-%:
71 +@echo === User Application: $* && $(SUBMAKE) all -C Usermode/Applications/$*_src
74 $(AI_DYNMODS): allinstall-%:
75 +@echo === Dynamic Module: $* && BUILDTYPE=dynamic $(SUBMAKE) all install -C Modules/$*
76 $(AI_MODULES): allinstall-%:
77 +@echo === Module: $* && BUILDTYPE=static $(SUBMAKE) all install -C Modules/$*
79 +@echo === Kernel && $(SUBMAKE) all install -C Kernel
80 $(AI_USRLIBS): allinstall-%:
81 +@echo === User Library: $* && $(SUBMAKE) all install -C Usermode/Libraries/$*_src
82 $(AI_USRAPPS): allinstall-%:
83 +@echo === User Application: $* && $(SUBMAKE) all install -C Usermode/Applications/$*_src
85 # Clean up compilation
86 $(CLEAN_DYNMODS): clean-%:
87 +@BUILDTYPE=dynamic $(SUBMAKE) clean -C Modules/$*
88 $(CLEAN_MODULES): clean-%:
89 +@BUILDTYPE=static $(SUBMAKE) clean -C Modules/$*
91 +@$(SUBMAKE) clean -C Kernel
92 $(CLEAN_USRLIBS): clean-%:
93 +@$(SUBMAKE) clean -C Usermode/Libraries/$*_src
94 $(CLEAN_USRAPPS): clean-%:
95 +@$(SUBMAKE) clean -C Usermode/Applications/$*_src
98 $(INSTALL_DYNMODS): install-%:
99 @BUILDTYPE=dynamic $(SUBMAKE) install -C Modules/$*
100 $(INSTALL_MODULES): install-%:
101 @BUILDTYPE=static $(SUBMAKE) install -C Modules/$*
103 @$(SUBMAKE) install -C Usermode/Filesystem
105 @$(SUBMAKE) install -C Kernel
106 $(INSTALL_USRLIBS): install-%:
107 @$(SUBMAKE) install -C Usermode/Libraries/$*_src
108 $(INSTALL_USRAPPS): install-%:
109 @$(SUBMAKE) install -C Usermode/Applications/$*_src