Usermode/ld-acess - Slight tweak to headers to stay on spec.
[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 libpsocket.so
15 USRLIBS += libimage_sif.so
16
17 USRAPPS := init login CLIShell cat ls mount
18 USRAPPS += bomb lspci
19 USRAPPS += ip dhcpclient ping telnet irc wget telnetd
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 ifeq ($(ARCH),host)
102 install-%:
103         
104 else
105 $(INSTALL_DYNMODS): install-%:
106         @$(_build_dynmod)$* install
107 $(INSTALL_MODULES): install-%:
108         @$(_build_stmod)$* install
109 install-Filesystem:
110         @$(SUBMAKE) install -C Usermode/Filesystem
111 install-Kernel:
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
117 endif

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