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= \ |
| 17 | bsc \ |
| 18 | bsc-nat \ |
| 19 | bts \ |
| 20 | cbc \ |
| 21 | ccid \ |
Harald Welte | c98d9a9 | 2019-08-22 10:53:23 +0200 | [diff] [blame] | 22 | dia2gsup \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 23 | fr \ |
| 24 | fr-net \ |
| 25 | gbproxy \ |
| 26 | ggsn_tests \ |
| 27 | hlr \ |
Daniel Willmann | dd7c075 | 2022-02-17 16:32:15 +0100 | [diff] [blame] | 28 | hnbgw \ |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 29 | hnodeb \ |
Pau Espin Pedrol | ad4179b | 2023-10-10 19:12:26 +0200 | [diff] [blame] | 30 | hss \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 31 | mgw \ |
| 32 | mme \ |
| 33 | msc \ |
| 34 | ns \ |
Harald Welte | c4ac9e0 | 2021-04-22 23:07:44 +0200 | [diff] [blame] | 35 | pcap-client \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 36 | pcu \ |
| 37 | pgw \ |
| 38 | remsim \ |
| 39 | sccp \ |
| 40 | selftest \ |
| 41 | sgsn \ |
| 42 | simtrace \ |
| 43 | sip \ |
| 44 | smlc \ |
| 45 | stp \ |
| 46 | sysinfo \ |
Neels Hofmeyr | 2d29274 | 2022-06-07 23:58:05 +0200 | [diff] [blame] | 47 | upf \ |
Oliver Smith | 64d6cc4 | 2021-03-17 18:44:42 +0100 | [diff] [blame] | 48 | $(NULL) |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 49 | |
Stefan Sperling | b0ad3d8 | 2018-06-25 15:19:17 +0200 | [diff] [blame] | 50 | NPROC=$(shell nproc 2>/dev/null) |
| 51 | ifeq ($(NPROC),) |
| 52 | NPROC=1 |
| 53 | endif |
| 54 | PARALLEL_MAKE ?= -j$(NPROC) |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 55 | |
| 56 | # This master makefile allows you to do things like |
| 57 | # make clean (remove all generated binary, c++ and symlinks) |
| 58 | # make compile (compile ttcn3 into c++) |
| 59 | # make all (compile c++ into executable) |
| 60 | # |
| 61 | # as well as per-subdirectory targets like |
| 62 | # |
| 63 | # make bsc/clean |
| 64 | # make bsc/compile |
| 65 | # make bsc/all |
| 66 | # make bsc (equivalent to bsc/all) |
| 67 | |
Harald Welte | 6807982 | 2017-12-12 16:30:53 +0100 | [diff] [blame] | 68 | default: deps all |
| 69 | |
Pau Espin Pedrol | 2bd2ea2 | 2023-05-04 12:58:27 +0200 | [diff] [blame] | 70 | # Eclipse GitLab has rate limiting and sometimes to many concurrent conns fail. |
| 71 | # If -jN fails, retry with -j1. |
Harald Welte | 6807982 | 2017-12-12 16:30:53 +0100 | [diff] [blame] | 72 | .PHONY: deps |
| 73 | deps: |
Pau Espin Pedrol | 2bd2ea2 | 2023-05-04 12:58:27 +0200 | [diff] [blame] | 74 | ($(MAKE) $(PARALLEL_MAKE) -C deps || $(MAKE) -j1 -C deps) |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 75 | |
Stefan Sperling | 61c11e9 | 2018-03-20 18:25:26 +0100 | [diff] [blame] | 76 | # 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] | 77 | .PHONY: deps-update |
| 78 | deps-update: |
Stefan Sperling | 61c11e9 | 2018-03-20 18:25:26 +0100 | [diff] [blame] | 79 | $(MAKE) -C deps |
Harald Welte | 6bef5dd | 2018-02-15 18:31:22 +0100 | [diff] [blame] | 80 | |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 81 | compile: $(foreach dir,$(SUBDIRS),$(dir)/compile) |
| 82 | clean: $(foreach dir,$(SUBDIRS),$(dir)/clean) |
| 83 | all: $(foreach dir,$(SUBDIRS),$(dir)/all) |
| 84 | |
| 85 | define DIR_Makefile_template |
| 86 | $(1)/Makefile: |
| 87 | (cd $(1) && ./gen_links.sh && ./regen_makefile.sh) |
| 88 | endef |
| 89 | |
| 90 | define DIR_compile_template |
| 91 | .PHONY: $(1)/compile |
Harald Welte | f6f7846 | 2017-12-12 17:31:25 +0100 | [diff] [blame] | 92 | $(1)/compile: deps $(1)/Makefile |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 93 | $(MAKE) -C $(1) compile |
| 94 | endef |
| 95 | |
| 96 | define DIR_clean_template |
| 97 | .PHONY: $(1)/clean |
| 98 | $(1)/clean: $(1)/Makefile |
| 99 | $(MAKE) -C $(1) clean |
| 100 | (cd $(1) && ../rmlinks.sh && rm Makefile) |
| 101 | endef |
| 102 | |
| 103 | define DIR_all_template |
| 104 | $(1): $(1)/all |
| 105 | .PHONY: $(1)/all |
Harald Welte | f6f7846 | 2017-12-12 17:31:25 +0100 | [diff] [blame] | 106 | $(1)/all: deps $(1)/Makefile |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 107 | $(MAKE) -C $(1) compile |
| 108 | $(MAKE) $(PARALLEL_MAKE) -C $(1) |
| 109 | endef |
| 110 | |
| 111 | $(foreach dir,$(SUBDIRS), \ |
| 112 | $(eval $(call DIR_Makefile_template,$(dir))) \ |
| 113 | $(eval $(call DIR_compile_template,$(dir))) \ |
| 114 | $(eval $(call DIR_clean_template,$(dir))) \ |
| 115 | $(eval $(call DIR_all_template,$(dir))) \ |
| 116 | ) |
Vadim Yanitskiy | 600ebb2 | 2021-12-02 20:01:07 +0300 | [diff] [blame] | 117 | |
Pau Espin Pedrol | c24a18c | 2022-05-17 19:15:17 +0200 | [diff] [blame] | 118 | .PHONY: tags regen-diameter-types-ttcn |
Vadim Yanitskiy | 600ebb2 | 2021-12-02 20:01:07 +0300 | [diff] [blame] | 119 | tags: |
| 120 | find $(shell pwd) \ |
| 121 | -type f -name "*.ttcn" -o \ |
| 122 | -type f -name "*.ttcnpp" | \ |
| 123 | xargs ctags |
Pau Espin Pedrol | c24a18c | 2022-05-17 19:15:17 +0200 | [diff] [blame] | 124 | |
| 125 | regen-diameter-types-ttcn: |
| 126 | (cd library/ && ./regen-DIAMETER_Types_ttcn.sh) |