-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
86 lines (64 loc) · 2.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#***********************************************************************
#
# Copyright (c) 2007 Broadcom Corporation
# All Rights Reserved
#
#***********************************************************************/
# GNUMAKEFLAGS := --output-sync=target
all: autobuild_dirs
CURR_DIR := $(shell pwd)
BUILD_DIR:=$(subst /userspace, /userspace,$(CURR_DIR))
BUILD_DIR:=$(word 1, $(BUILD_DIR))
export BUILD_DIR
include $(BUILD_DIR)/make.common
ifeq ($(wildcard ../targets/config.in),)
CONSUMER_BUILD=1
endif
MODSW_GLOBAL=1
# Check to see if any autodetect files are newer than the autogenerated makefile
DUMMY := $(shell if [ `ls -tr */*/*/autodetect makefile.modsw.autogen 2>/dev/null| tail -1` != "makefile.modsw.autogen" ] ; then \
rm -f makefile.modsw.autogen makefile.modsw.autogen.mini; \
fi )
include $(BUILD_DIR)/make.modsw
#
# The build sequence of userspace is:
# public-include, circular_dep_check, autobuild_dirs
# circular_dep_check will also fail if it detects non-existent targets, see
# ouptput.txt for full output.
#
public-include: $(BUILD_DIR)/cms_dmp_flags.h
mkdir -p $(BCM_FSBUILD_DIR)/public/include
mkdir -p $(BCM_FSBUILD_DIR)/public/lib
$(MAKE) -C public/include
CIRC.MAKE := makefile.circ
CIRC.OUTPUT := circ_output.txt
circular_dep_check: public-include
@echo "include makefile.modsw.autogen.mini" > $(CIRC.MAKE)
@echo "" >> $(CIRC.MAKE)
@echo '$$(AUTODIRS) :' >> $(CIRC.MAKE)
@echo "" >> $(CIRC.MAKE)
@echo 'circ_check: $$(AUTODIRS)' >> $(CIRC.MAKE)
make -f $(CIRC.MAKE) circ_check > $(CIRC.OUTPUT) 2>&1
@if grep Circular $(CIRC.OUTPUT) ; then \
echo "ERROR!! Circular dependency detected! Abort build."; \
exit 1; \
fi
$(AUTODIRS) : circular_dep_check
autobuild_dirs: $(AUTODIRS)
.PHONY: public-include circular_dep_check autobuild_dirs
# Clean related targets
# Do special cleaning for multiarch autodirs first, then regular autodirs
AUTODIRS_CLEAN := $(addprefix _clean_,$(wildcard $(AUTODIRS)))
MULTIARCH_AUTODIRS_CLEAN := $(addprefix _multiarchclean_,$(wildcard $(MULTIARCH_AUTODIRS)))
$(MULTIARCH_AUTODIRS_CLEAN):
-$(MAKE) $(patsubst _multiarchclean_%,%,$@/multiarchclean)
multiarch_autodirs_clean: $(MULTIARCH_AUTODIRS_CLEAN)
$(AUTODIRS_CLEAN) : multiarch_autodirs_clean
-$(MAKE) $(if $(wildcard $(patsubst _clean_%,%/Bcmbuild.mk,$@)),-f Bcmbuild.mk) -C $(patsubst _clean_%,%,$@) clean
clean: $(AUTODIRS_CLEAN)
@rm -f $(CIRC.MAKE) $(CIRC.OUTPUT)
@rm -f makefile.modsw.autogen makefile.modsw.autogen.mini
@rm -f $(BUILD_DIR)/cms_dmp_flags.h
@$(MAKE) -C public/include clean
.PHONY: $(AUTODIRS_CLEAN)
.PHONY: $(MULTIARCH_AUTODIRS_CLEAN)