Modules/VIARhineII - Implementing, won't work yet
[tpg/acess2.git] / Makefile
1 #
2 # Acess2 Core Makefile
3 #
4 # (Oh man! This is hacky, but beautiful at the same time, much like the
5 # rest of Acess)
6
7 -include Makefile.cfg
8
9 .PHONY: all clean SyscallList all-user
10
11 SUBMAKE = $(MAKE) --no-print-directory
12
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
16
17 USRAPPS := init login CLIShell cat ls mount
18 USRAPPS += bomb dhcpclient
19 USRAPPS += ip ping telnet irc
20 USRAPPS += axwin3
21
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))
38
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)
44
45 kmode:  $(AI_MODULES) $(AI_DYNMODS) allinstall-Kernel
46 all-kmode:      $(ALL_MODULES) $(ALL_DYNMODS) all-Kernel
47
48 all-user: $(ALL_USRLIBS) $(ALL_USRAPPS)
49 clean-user: $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
50
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
55
56 SyscallList: include/syscalls.h
57 include/syscalls.h: KernelLand/Kernel/Makefile KernelLand/Kernel/syscalls.lst
58         @make -C KernelLand/Kernel/ include/syscalls.h
59
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
63
64 # Compile Only
65 $(ALL_DYNMODS): all-%:
66         +@echo === Dynamic Module: $* && $(_build_dynmod)$* all
67 $(ALL_MODULES): all-%:
68         +@echo === Module: $* && $(_build_stmod)$* all
69 all-Kernel:
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
75
76 # Compile & Install
77 $(AI_DYNMODS): allinstall-%:
78         +@echo === Dynamic Module: $* && $(_build_dynmod)$* all install
79 $(AI_MODULES): allinstall-%:
80         +@echo === Module: $* && $(_build_stmod)$* all install
81 allinstall-Kernel:
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
87
88 # Clean up compilation
89 $(CLEAN_DYNMODS): clean-%:
90         +@$(_build_dynmod)$* clean
91 $(CLEAN_MODULES): clean-%:
92         +@$(_build_stmod)$* clean
93 clean-Kernel:
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
99
100 # Install
101 $(INSTALL_DYNMODS): install-%:
102         @$(_build_dynmod)$* install
103 $(INSTALL_MODULES): install-%:
104         @$(_build_stmod)$* install
105 install-Filesystem:
106         @$(SUBMAKE) install -C Usermode/Filesystem
107 install-Kernel:
108         @$(_build_kernel) install
109 $(INSTALL_USRLIBS): install-%:
110         @$(SUBMAKE) install -C Usermode/Libraries/$*_src
111 $(INSTALL_USRAPPS): install-%:
112         @$(SUBMAKE) install -C Usermode/Applications/$*_src

UCC git Repository :: git.ucc.asn.au