UDI/ne2000 - RX code implemented
[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 libc.so libposix.so
14 USRLIBS += libreadline.so libnet.so liburi.so libpsocket.so
15 USRLIBS += libimage_sif.so libunicode.so
16
17 EXTLIBS := 
18 #libspiderscript
19 # zlib libpng
20
21 USRAPPS := init login CLIShell cat ls mount automounter
22 USRAPPS += insmod
23 USRAPPS += bomb lspci
24 USRAPPS += ip dhcpclient ping telnet irc wget telnetd
25 USRAPPS += axwin3 gui_ate gui_terminal
26
27 define targetclasses
28  AI_$1      := $$(addprefix allinstall-,$$($1))
29  ALL_$1     := $$(addprefix all-,$$($1))
30  CLEAN_$1   := $$(addprefix clean-,$$($1))
31  INSTALL_$1 := $$(addprefix install-,$$($1))
32 endef
33
34 $(eval $(call targetclasses,DYNMODS))
35 $(eval $(call targetclasses,MODULES))
36 $(eval $(call targetclasses,USRLIBS))
37 $(eval $(call targetclasses,EXTLIBS))
38 $(eval $(call targetclasses,USRAPPS))
39
40 targetvars := $$(AI_$1) $$(ALL_$1) $$(CLEAN_$1) $$(INSTALL_$1)
41
42 .PHONY: all clean install \
43         ai-kmode all-kmode clean-kmode install-kmode \
44         ai-user all-user clean-user install-user \
45         utest mtest
46
47 .PHONY: allinstall-Kernel all-Kernel clean-Kernel install-Kernel \
48         $(call targetvars,DYNMODS) \
49         $(call targetvars,MODULES) \
50         $(call targetvars,USRLIBS) \
51         $(call targetvars,EXTLIBS) \
52         $(call targetvars,USRAPPS)
53
54 ai-kmode:       $(AI_MODULES) allinstall-Kernel $(AI_DYNMODS)
55 all-kmode:      $(ALL_MODULES) all-Kernel $(ALL_DYNMODS)
56 clean-kmode:    $(CLEAN_MODULES) $(CLEAN_DYNMODS) clean-Kernel
57 install-kmode:  $(INSTALL_MODULES) install-Kernel $(INSTALL_DYNMODS)
58
59 ai-user:        $(AI_USRLIBS) $(AI_EXTLIBS) $(AI_USRAPPS)
60 all-user:       $(ALL_USRLIBS) $(ALL_EXTLIBS) $(ALL_USRAPPS)
61 clean-user:     $(CLEAN_USRLIBS) $(CLEAN_EXTLIBS) $(CLEAN_USRAPPS)
62 install-user:   $(INSTALL_USRLIBS) $(INSTALL_EXTLIBS) $(INSTALL_USRAPPS)
63
64 all:    SyscallList all-user all-kmode
65 all-install:    install-Filesystem SyscallList ai-user ai-kmode
66 clean:  clean-kmode clean-user
67 install:        install-Filesystem SyscallList install-user install-kmode
68
69 utest: $(USRLIBS:%=utest-%)
70
71 $(USRLIBS:%=utest-%): utest-%:
72         @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src generate_exp
73         @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src utest -k
74
75 # TODO: Module tests using DiskTool and NetTest
76 mtest:
77         @echo > /dev/null
78
79 SyscallList: include/syscalls.h
80 include/syscalls.h: KernelLand/Kernel/Makefile KernelLand/Kernel/syscalls.lst
81         @make -C KernelLand/Kernel/ include/syscalls.h
82
83 _build_dynmod := BUILDTYPE=dynamic $(SUBMAKE) -C KernelLand/Modules/
84 _build_stmod  := BUILDTYPE=static $(SUBMAKE) -C KernelLand/Modules/
85 _build_kernel := $(SUBMAKE) -C KernelLand/Kernel
86
87 define rules
88 $$(ALL_$1): all-%:
89         +@echo === $2 && $3 all
90 $$(AI_$1): allinstall-%:
91         +@echo === $2 && $3 all install
92 $$(CLEAN_$1): clean-%:
93         +@echo === $2 && $3 clean
94 $$(INSTALL_$1): install-%:
95         +@$3 install
96 endef
97
98 $(eval $(call rules,DYNMODS,Dynamic Module: $$*,$(_build_dynmod)$$*))
99 $(eval $(call rules,MODULES,Module: $$*,$(_build_stmod)$$*))
100 $(eval $(call rules,USRLIBS,User Library: $$*,$(SUBMAKE) -C Usermode/Libraries/$$*_src))
101 $(eval $(call rules,EXTLIBS,External Library: $$*,$(SUBMAKE) -C Externals/$$*))
102 $(eval $(call rules,USRAPPS,User Application: $$*,$(SUBMAKE) -C Usermode/Applications/$$*_src))
103 all-Kernel:
104         +@echo === Kernel && $(_build_kernel) all
105 allinstall-Kernel:
106         +@echo === Kernel && $(_build_kernel) all install
107 clean-Kernel:
108         +@$(_build_kernel) clean
109 install-Kernel:
110         @$(_build_kernel) install
111 install-Filesystem:
112         @$(SUBMAKE) install -C Usermode/Filesystem

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