Tools/NetTest - Add TCP retransmit test
[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 ld-acess.so libc.so libposix.so libc++.so
14 USRLIBS += libreadline.so libnet.so liburi.so libpsocket.so
15 USRLIBS += libimage_sif.so libunicode.so libm.so
16 USRLIBS += libaxwin4.so
17
18 EXTLIBS := 
19 #libspiderscript
20 # zlib libpng
21
22 USRAPPS := init login CLIShell cat ls mount automounter
23 USRAPPS += insmod
24 USRAPPS += bomb lspci
25 USRAPPS += ip dhcpclient ping telnet irc wget telnetd
26 USRAPPS += axwin3 gui_ate gui_terminal
27 USRAPPS += axwin4
28
29 define targetclasses
30  AI_$1      := $$(addprefix allinstall-,$$($1))
31  ALL_$1     := $$(addprefix all-,$$($1))
32  CLEAN_$1   := $$(addprefix clean-,$$($1))
33  INSTALL_$1 := $$(addprefix install-,$$($1))
34 endef
35
36 $(eval $(call targetclasses,DYNMODS))
37 $(eval $(call targetclasses,MODULES))
38 $(eval $(call targetclasses,USRLIBS))
39 $(eval $(call targetclasses,EXTLIBS))
40 $(eval $(call targetclasses,USRAPPS))
41
42 targetvars := $$(AI_$1) $$(ALL_$1) $$(CLEAN_$1) $$(INSTALL_$1)
43
44 .PHONY: all clean install \
45         ai-kmode all-kmode clean-kmode install-kmode \
46         ai-user all-user clean-user install-user \
47         utest mtest
48
49 .PHONY: allinstall-Kernel all-Kernel clean-Kernel install-Kernel \
50         $(call targetvars,DYNMODS) \
51         $(call targetvars,MODULES) \
52         $(call targetvars,USRLIBS) \
53         $(call targetvars,EXTLIBS) \
54         $(call targetvars,USRAPPS)
55
56 ai-kmode:       $(AI_MODULES) allinstall-Kernel $(AI_DYNMODS)
57 all-kmode:      $(ALL_MODULES) all-Kernel $(ALL_DYNMODS)
58 clean-kmode:    $(CLEAN_MODULES) $(CLEAN_DYNMODS) clean-Kernel
59 install-kmode:  $(INSTALL_MODULES) install-Kernel $(INSTALL_DYNMODS)
60
61 ai-user:        $(AI_USRLIBS) $(AI_EXTLIBS) $(AI_USRAPPS)
62 all-user:       $(ALL_USRLIBS) $(ALL_EXTLIBS) $(ALL_USRAPPS)
63 clean-user:     $(CLEAN_USRLIBS) $(CLEAN_EXTLIBS) $(CLEAN_USRAPPS)
64 install-user:   $(INSTALL_USRLIBS) $(INSTALL_EXTLIBS) $(INSTALL_USRAPPS)
65
66 all:    SyscallList all-user all-kmode
67 all-install:    install-Filesystem SyscallList ai-user ai-kmode
68 clean:  clean-kmode clean-user
69 install:        install-Filesystem SyscallList install-user install-kmode
70
71 utest-build: $(USRLIBS:%=utest-build-%)
72 utest-run: $(USRLIBS:%=utest-run-%)
73 utest: utest-build utest-run
74
75 utest-build-%:
76         @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src generate_exp
77         @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src utest-build
78 utest-run-%:
79         @CC=$(NCC) $(SUBMAKE) -C Usermode/Libraries/$*_src utest-run -k
80
81 # TODO: Module tests using DiskTool and NetTest
82 mtest: mtest-build mtest-run
83         @echo > /dev/null
84 mtest-build:
85         # Network
86         @echo "== Build Module Tests"
87         @echo "-- nativelib"
88         @CC=$(NCC) $(SUBMAKE) -C Tools/nativelib
89         @echo "-- NetTest"
90         @CC=$(NCC) $(SUBMAKE) -C Tools/NetTest
91         @echo "-- NetTest Runner"
92         @CC=$(NCC) $(SUBMAKE) -C Tools/NetTest_Runner
93 mtest-run:
94         @echo "=== Network Module Test ==="
95         @cd Tools && ./nettest_runner
96
97 SyscallList: include/syscalls.h
98 include/syscalls.h: KernelLand/Kernel/Makefile KernelLand/Kernel/syscalls.lst
99         @make -C KernelLand/Kernel/ include/syscalls.h
100
101 _build_dynmod := BUILDTYPE=dynamic $(SUBMAKE) -C KernelLand/Modules/
102 _build_stmod  := BUILDTYPE=static $(SUBMAKE) -C KernelLand/Modules/
103 _build_kernel := $(SUBMAKE) -C KernelLand/Kernel
104
105 define rules
106 $$(ALL_$1): all-%: $(CC)
107         +@echo === $2 && $3 all
108 $$(AI_$1): allinstall-%: $(CC)
109         +@echo === $2 && $3 all install
110 $$(CLEAN_$1): clean-%: $(CC)
111         +@echo === $2 && $3 clean
112 $$(INSTALL_$1): install-%: $(CC)
113         +@$3 install
114 endef
115
116 $(eval $(call rules,DYNMODS,Dynamic Module: $$*,$(_build_dynmod)$$*))
117 $(eval $(call rules,MODULES,Module: $$*,$(_build_stmod)$$*))
118 $(eval $(call rules,USRLIBS,User Library: $$*,$(SUBMAKE) -C Usermode/Libraries/$$*_src))
119 $(eval $(call rules,EXTLIBS,External Library: $$*,$(SUBMAKE) -C Externals/$$*))
120 $(eval $(call rules,USRAPPS,User Application: $$*,$(SUBMAKE) -C Usermode/Applications/$$*_src))
121 all-Kernel: $(CC)
122         +@echo === Kernel && $(_build_kernel) all
123 allinstall-Kernel: $(CC)
124         +@echo === Kernel && $(_build_kernel) all install
125 clean-Kernel: $(CC)
126         +@$(_build_kernel) clean
127 install-Kernel: $(CC)
128         @$(_build_kernel) install
129 install-Filesystem: $(CC)
130         @$(SUBMAKE) install -C Usermode/Filesystem
131
132 ifeq ($(ARCHDIR),native)
133 .PHONY: $(CC)
134 else
135 $(CC):
136         @echo ---
137         @echo $(CC) does not exist, recompiling
138         @echo ---
139         make -C Externals/cross-compiler/
140 endif

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