Harald Welte | a0895f9 | 2018-03-08 11:51:23 +0100 | [diff] [blame] | 1 | SUBDIRS=bsc bsc-nat bts ggsn_tests hlr lapdm mgw msc pcu selftest sgsn sysinfo |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 2 | |
Neels Hofmeyr | faa379f | 2018-03-02 00:09:46 +0100 | [diff] [blame] | 3 | PARALLEL_MAKE ?= -j8 |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 4 | |
| 5 | # This master makefile allows you to do things like |
| 6 | # make clean (remove all generated binary, c++ and symlinks) |
| 7 | # make compile (compile ttcn3 into c++) |
| 8 | # make all (compile c++ into executable) |
| 9 | # |
| 10 | # as well as per-subdirectory targets like |
| 11 | # |
| 12 | # make bsc/clean |
| 13 | # make bsc/compile |
| 14 | # make bsc/all |
| 15 | # make bsc (equivalent to bsc/all) |
| 16 | |
Harald Welte | 6807982 | 2017-12-12 16:30:53 +0100 | [diff] [blame] | 17 | default: deps all |
| 18 | |
| 19 | .PHONY: deps |
| 20 | deps: |
| 21 | $(MAKE) -C deps |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 22 | |
Harald Welte | 6bef5dd | 2018-02-15 18:31:22 +0100 | [diff] [blame] | 23 | .PHONY: deps-update |
| 24 | deps-update: |
| 25 | $(MAKE) -C deps update |
| 26 | |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 27 | compile: $(foreach dir,$(SUBDIRS),$(dir)/compile) |
| 28 | clean: $(foreach dir,$(SUBDIRS),$(dir)/clean) |
| 29 | all: $(foreach dir,$(SUBDIRS),$(dir)/all) |
| 30 | |
| 31 | define DIR_Makefile_template |
| 32 | $(1)/Makefile: |
| 33 | (cd $(1) && ./gen_links.sh && ./regen_makefile.sh) |
| 34 | endef |
| 35 | |
| 36 | define DIR_compile_template |
| 37 | .PHONY: $(1)/compile |
Harald Welte | f6f7846 | 2017-12-12 17:31:25 +0100 | [diff] [blame] | 38 | $(1)/compile: deps $(1)/Makefile |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 39 | $(MAKE) -C $(1) compile |
| 40 | endef |
| 41 | |
| 42 | define DIR_clean_template |
| 43 | .PHONY: $(1)/clean |
| 44 | $(1)/clean: $(1)/Makefile |
| 45 | $(MAKE) -C $(1) clean |
| 46 | (cd $(1) && ../rmlinks.sh && rm Makefile) |
| 47 | endef |
| 48 | |
| 49 | define DIR_all_template |
| 50 | $(1): $(1)/all |
| 51 | .PHONY: $(1)/all |
Harald Welte | f6f7846 | 2017-12-12 17:31:25 +0100 | [diff] [blame] | 52 | $(1)/all: deps $(1)/Makefile |
Harald Welte | add12df | 2017-12-12 15:51:39 +0100 | [diff] [blame] | 53 | $(MAKE) -C $(1) compile |
| 54 | $(MAKE) $(PARALLEL_MAKE) -C $(1) |
| 55 | endef |
| 56 | |
| 57 | $(foreach dir,$(SUBDIRS), \ |
| 58 | $(eval $(call DIR_Makefile_template,$(dir))) \ |
| 59 | $(eval $(call DIR_compile_template,$(dir))) \ |
| 60 | $(eval $(call DIR_clean_template,$(dir))) \ |
| 61 | $(eval $(call DIR_all_template,$(dir))) \ |
| 62 | ) |