sonic-buildimage/platform/broadcom/saibcm-modules/make/Make.depend
Guohan Lu aa2e340f5a [broadcom]: build broadcom kernel modules from gpl source codes
Signed-off-by: Guohan Lu <gulv@microsoft.com>
2018-08-11 09:09:03 +00:00

110 lines
3.1 KiB
Plaintext

#
# Unless you and Broadcom execute a separate written software license
# agreement governing use of this software, this software is licensed to
# you under the terms of the GNU General Public License version 2 (the
# "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
# with the following added to such license:
#
# As a special exception, the copyright holders of this software give
# you permission to link this software with independent modules, and to
# copy and distribute the resulting executable under terms of your
# choice, provided that you also meet, for each linked independent
# module, the terms and conditions of the license of that module. An
# independent module is a module which is not derived from this
# software. The special exception does not apply to any modifications
# of the software.
#
# $Id: Make.depend,v 1.14 Broadcom SDK $
# $Copyright: (c) 2005 Broadcom Corp.
# All Rights Reserved.$
#
# Default rule to build dependencies. This builds a x.d file for each
# x.c file that describes the dependencies. We then conditionally include
# the generated .d files.
#
#
# If making 'clean', do not include any .d files. If they are included,
# gmake intrinsically tries to remake them all.
#
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
ZFS :=$(wildcard *.zf)
ZFC := $(ZFS:.zf=.c)
ifdef GENERATE_C_FILES
ifndef GEN_INCS
$(error "GEN_INCS was not defined")
endif
ZF_GEN = ${SDK}/tools/zFrameCodeGen.pl
# 1=.zf
define ZFS_RULE
$(1:.zf=Console.c) : $(1:.zf=.c)
@echo updated $$@ from $$?
$(1:.zf=.c) : $(1) $(ZF_GEN)
@$(PERL) $(ZF_GEN) -s -z . -p . -g $1 -t c
@echo generated ${LOCALDIR}/$$@ from $(1)
@mv $$(*F).cx $$@
@if [ -e $$(*F)Console.cx ] ; then \
mv $$(*F)Console.cx $$(*F)Console.c; \
echo Created $$(*F)Console.c ;\
fi
@if [ -e $$(*F)Console.hx ] ; then \
echo Created $(GEN_INCS)/$$(*F)Console.hx ;\
mv $$(*F)Console.hx $(GEN_INCS)/ ; \
fi
@mv $$(*F).hx $(GEN_INCS)/
endef
$(foreach zf,$(ZFS),$(eval $(call ZFS_RULE,$(zf))))
${BLDDIR}/%.P : ${BLDDIR}/.tree %.c
.PHONY: GENFILES
GENFILES: $(ZFC)
$(BOBJS) : $(ZFC)
else
#
# Attempt to build the depend files. If it fails, the depend file is
# removed so that it is not included in later builds.
#
${BLDDIR}/%.P : %.c ${BLDDIR}/.tree
@$(ECHO) Dependencies for ${LOCALDIR}/$<
${BLDDIR}/%.P : %.cc ${BLDDIR}/.tree
@$(ECHO) Dependencies for ${LOCALDIR}/$<
endif
#
# If there are C or C++ files in this directory, include the
# depend files for them.
#
ifeq ($(findstring _COMPILER,$(MAKECMDGOALS))$(findstring variable,$(MAKECMDGOALS)),)
ifneq ($(strip ${LSRCS}),)
ifneq (,$(findstring .o,$(MAKECMDGOALS)))
-include $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.P)) $(addprefix ${BLDDIR}/,$(MAKECMDGOALS:.o=.sig))
else
-include $(addprefix ${BLDDIR}/,$(addsuffix .P,$(basename $(LSRCS)))) $(addprefix ${BLDDIR}/,$(addsuffix .sig,$(basename $(LSRCS))))
endif
endif
endif
endif # !CLEANING
clean_d::
ifdef QUIET
@$(ECHO) Cleaning dependencies for ${LOCALDIR}
endif
ifdef GENERATE_C_FILES
$Q$(RM) $(ZFC:%=$(SDK)/$(LOCALDIR)/%) $(ZFC:%.c=$(SDK)/$(LOCALDIR)/%Console.c)
endif
clean:: clean_d