Harald Welte | 0cdf071 | 2019-06-19 18:15:38 +0200 | [diff] [blame] | 1 | # Copyright 2017 Harald Welte |
| 2 | # Copyright 2018 sysmocom - s.f.m.c. GmbH |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 16 | SUBDIRS= \ |
Pau Espin Pedrol | 37ee0ed | 2024-03-28 21:17:12 +0100 | [diff] [blame] | 17 | asterisk \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 18 | bsc \ |
| 19 | bsc-nat \ |
| 20 | bts \ |
| 21 | cbc \ |
| 22 | ccid \ |
Harald Welte | c98d9a9 | 2019-08-22 10:53:23 +0200 | [diff] [blame] | 23 | dia2gsup \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 24 | fr \ |
| 25 | fr-net \ |
Pau Espin Pedrol | 965ac64 | 2023-10-16 18:12:45 +0200 | [diff] [blame] | 26 | epdg \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 27 | gbproxy \ |
| 28 | ggsn_tests \ |
| 29 | hlr \ |
Daniel Willmann | dd7c075 | 2022-02-17 16:32:15 +0100 | [diff] [blame] | 30 | hnbgw \ |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 31 | hnodeb \ |
Pau Espin Pedrol | ad4179b | 2023-10-10 19:12:26 +0200 | [diff] [blame] | 32 | hss \ |
Philipp Maier | bb169b2 | 2024-03-04 11:09:00 +0100 | [diff] [blame] | 33 | ipad \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 34 | mgw \ |
| 35 | mme \ |
| 36 | msc \ |
| 37 | ns \ |
Harald Welte | c4ac9e0 | 2021-04-22 23:07:44 +0200 | [diff] [blame] | 38 | pcap-client \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 39 | pcu \ |
| 40 | pgw \ |
| 41 | remsim \ |
Vadim Yanitskiy | 95cd935 | 2024-05-31 18:29:17 +0700 | [diff] [blame] | 42 | s1gw \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 43 | sccp \ |
| 44 | selftest \ |
| 45 | sgsn \ |
| 46 | simtrace \ |
| 47 | sip \ |
| 48 | smlc \ |
| 49 | stp \ |
| 50 | sysinfo \ |
Neels Hofmeyr | 2d29274 | 2022-06-07 23:58:05 +0200 | [diff] [blame] | 51 | upf \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 52 | $(NULL) |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 53 | |
Stefan Sperling | b0ad3d8 | 2018-06-25 15:19:17 +0200 | [diff] [blame] | 54 | NPROC=$(shell nproc 2>/dev/null) |
| 55 | ifeq ($(NPROC),) |
| 56 | NPROC=1 |
| 57 | endif |
| 58 | PARALLEL_MAKE ?= -j$(NPROC) |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 59 | |
| 60 | # This master makefile allows you to do things like |
| 61 | # make clean (remove all generated binary, c++ and symlinks) |
| 62 | # make compile (compile ttcn3 into c++) |
| 63 | # make all (compile c++ into executable) |
| 64 | # |
| 65 | # as well as per-subdirectory targets like |
| 66 | # |
| 67 | # make bsc/clean |
| 68 | # make bsc/compile |
| 69 | # make bsc/all |
| 70 | # make bsc (equivalent to bsc/all) |
| 71 | |
Harald Welte | 6807982 | 2017-12-12 16:30:53 +0100 | [diff] [blame] | 72 | default: deps all |
| 73 | |
Pau Espin Pedrol | 2bd2ea2 | 2023-05-04 12:58:27 +0200 | [diff] [blame] | 74 | # Eclipse GitLab has rate limiting and sometimes to many concurrent conns fail. |
| 75 | # If -jN fails, retry with -j1. |
Harald Welte | 6807982 | 2017-12-12 16:30:53 +0100 | [diff] [blame] | 76 | .PHONY: deps |
| 77 | deps: |
Pau Espin Pedrol | 2bd2ea2 | 2023-05-04 12:58:27 +0200 | [diff] [blame] | 78 | ($(MAKE) $(PARALLEL_MAKE) -C deps || $(MAKE) -j1 -C deps) |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 79 | |
Stefan Sperling | 61c11e9 | 2018-03-20 18:25:26 +0100 | [diff] [blame] | 80 | # deps-update target for backwards compat; now does the same as 'make deps' |
Harald Welte | 6bef5dd | 2018-02-15 18:31:22 +0100 | [diff] [blame] | 81 | .PHONY: deps-update |
| 82 | deps-update: |
Stefan Sperling | 61c11e9 | 2018-03-20 18:25:26 +0100 | [diff] [blame] | 83 | $(MAKE) -C deps |
Harald Welte | 6bef5dd | 2018-02-15 18:31:22 +0100 | [diff] [blame] | 84 | |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 85 | compile: $(foreach dir,$(SUBDIRS),$(dir)/compile) |
| 86 | clean: $(foreach dir,$(SUBDIRS),$(dir)/clean) |
| 87 | all: $(foreach dir,$(SUBDIRS),$(dir)/all) |
| 88 | |
| 89 | define DIR_Makefile_template |
Vadim Yanitskiy | d2ce381 | 2024-06-19 23:59:03 +0700 | [diff] [blame^] | 90 | $(1)/Makefile: $(1)/gen_links.sh $(1)/regen_makefile.sh |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 91 | (cd $(1) && ./gen_links.sh && ./regen_makefile.sh) |
| 92 | endef |
| 93 | |
| 94 | define DIR_compile_template |
| 95 | .PHONY: $(1)/compile |
Harald Welte | f6f7846 | 2017-12-12 17:31:25 +0100 | [diff] [blame] | 96 | $(1)/compile: deps $(1)/Makefile |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 97 | $(MAKE) -C $(1) compile |
| 98 | endef |
| 99 | |
| 100 | define DIR_clean_template |
| 101 | .PHONY: $(1)/clean |
| 102 | $(1)/clean: $(1)/Makefile |
| 103 | $(MAKE) -C $(1) clean |
| 104 | (cd $(1) && ../rmlinks.sh && rm Makefile) |
| 105 | endef |
| 106 | |
| 107 | define DIR_all_template |
| 108 | $(1): $(1)/all |
| 109 | .PHONY: $(1)/all |
Harald Welte | f6f7846 | 2017-12-12 17:31:25 +0100 | [diff] [blame] | 110 | $(1)/all: deps $(1)/Makefile |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 111 | $(MAKE) -C $(1) compile |
| 112 | $(MAKE) $(PARALLEL_MAKE) -C $(1) |
| 113 | endef |
| 114 | |
| 115 | $(foreach dir,$(SUBDIRS), \ |
| 116 | $(eval $(call DIR_Makefile_template,$(dir))) \ |
| 117 | $(eval $(call DIR_compile_template,$(dir))) \ |
| 118 | $(eval $(call DIR_clean_template,$(dir))) \ |
| 119 | $(eval $(call DIR_all_template,$(dir))) \ |
| 120 | ) |
Vadim Yanitskiy | 600ebb2 | 2021-12-02 20:01:07 +0300 | [diff] [blame] | 121 | |
Pau Espin Pedrol | c24a18c | 2022-05-17 19:15:17 +0200 | [diff] [blame] | 122 | .PHONY: tags regen-diameter-types-ttcn |
Vadim Yanitskiy | 600ebb2 | 2021-12-02 20:01:07 +0300 | [diff] [blame] | 123 | tags: |
| 124 | find $(shell pwd) \ |
| 125 | -type f -name "*.ttcn" -o \ |
| 126 | -type f -name "*.ttcnpp" | \ |
| 127 | xargs ctags |
Pau Espin Pedrol | c24a18c | 2022-05-17 19:15:17 +0200 | [diff] [blame] | 128 | |
| 129 | regen-diameter-types-ttcn: |
| 130 | (cd library/ && ./regen-DIAMETER_Types_ttcn.sh) |