Fix rules in Makefiles (#15)
This commit is contained in:
parent
d3b3f63537
commit
f09a554f9a
110
Makefile
110
Makefile
@ -12,6 +12,8 @@ MLNX-SDK-DEBS=$(notdir $(wildcard src/mlnx-sdk/*.deb))
|
||||
BRCM-SDK-DEBS=$(notdir $(wildcard src/brcm-sdk/*.deb))
|
||||
CAVM-SDK-DEBS=$(notdir $(wildcard src/cavm-sdk/*.deb))
|
||||
|
||||
LIBNL-DEBS=libnl-3-200_3.2.27-1_amd64.deb libnl-genl-3-200_3.2.27-1_amd64.deb libnl-route-3-200_3.2.27-1_amd64.deb
|
||||
|
||||
## Function: build_docker, image_name save_file
|
||||
## build a docker image and save to a file
|
||||
define build_docker
|
||||
@ -20,88 +22,72 @@ define build_docker
|
||||
docker save $(1) | gzip -c > $(2)
|
||||
endef
|
||||
|
||||
## Rules
|
||||
## Rules: phony targets
|
||||
.phony : brcm-all mlnx-all cavm-all
|
||||
|
||||
## Rules: redirect to sub directory
|
||||
src/%:
|
||||
$(MAKE) -C src $(subst src/,,$@)
|
||||
|
||||
## Rules: docker-fpm
|
||||
dockers/docker-fpm/deps/fpmsyncd: src/fpmsyncd
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
dockers/docker-fpm/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
|
||||
## Rules: docker-orchagent-mlnx
|
||||
dockers/docker-orchagent-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/libsairedis_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
dockers/docker-orchagent-mlnx/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
|
||||
dockers/docker-orchagent-mlnx/deps/%: src/mlnx/%
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-orchagent/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-orchagent/deps/%: src/brcm/%
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
## Rules: docker-orchagent-cavm
|
||||
dockers/docker-orchagent-cavm/deps/libsairedis_1.0.0_amd64.deb: src/cavm/libsairedis_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
dockers/docker-orchagent-cavm/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
|
||||
dockers/docker-orchagent-cavm/deps/%: src/cavm/%
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%-mlnx/deps/syncd_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%/deps/syncd_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%-cavm/deps/syncd_1.0.0_amd64.deb: src/cavm/syncd_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%-mlnx/deps/libsairedis_1.0.0_amd64.deb: src/mlnx/syncd_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%/deps/libsairedis_1.0.0_amd64.deb: src/brcm/syncd_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
dockers/docker-%-cavm/deps/libsairedis_1.0.0_amd64.deb: src/cavm/libsairedis_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
## Rules: docker-orchagent (brcm)
|
||||
dockers/docker-orchagent/deps/libsairedis_1.0.0_amd64.deb: src/brcm/libsairedis_1.0.0_amd64.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
dockers/docker-orchagent/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
|
||||
## Rules: docker-syncd-mlnx
|
||||
$(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS)) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx-sdk/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
$(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
$(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
$(addprefix dockers/docker-syncd-mlnx/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) : dockers/docker-syncd-mlnx/deps/%.deb : src/mlnx/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
dockers/docker-syncd-mlnx/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
|
||||
dockers/docker-syncd/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
## Rules: docker-syncd-cavm
|
||||
$(addprefix dockers/docker-syncd-cavm/deps/,$(CAVM-SDK-DEBS)) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm-sdk/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
$(addprefix dockers/docker-syncd-cavm/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb) : dockers/docker-syncd-cavm/deps/%.deb : src/cavm/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
dockers/docker-syncd-cavm/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
|
||||
deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
|
||||
deps/initramfs-tools_%.deb: src/initramfs-tools/initramfs-tools_%.deb
|
||||
mkdir -p `dirname $@` && cp $< $@
|
||||
## Rules: docker-syncd (brcm)
|
||||
$(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS)) : dockers/docker-syncd/deps/%.deb : src/brcm-sdk/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
$(addprefix dockers/docker-syncd/deps/,syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb): dockers/docker-syncd/deps/%.deb : src/brcm/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
dockers/docker-syncd/deps/%.deb: src/%.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
|
||||
## Rules: docker images
|
||||
target/docker-base.gz:
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb)
|
||||
target/docker-syncd.gz: target/docker-base.gz $(addprefix dockers/docker-syncd/deps/,$(BRCM-SDK-DEBS) libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb syncd_1.0.0_amd64.deb $(LIBNL-DEBS))
|
||||
## TODO: remove placeholders for the dependencies
|
||||
touch dockers/docker-syncd/deps/{dsserve,bcmcmd}
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb)
|
||||
target/docker-syncd-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-syncd-mlnx/deps/,$(MLNX-SDK-DEBS) applibs_1.mlnx.4.2.2100_amd64.deb libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb syncd_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb $(LIBNL-DEBS))
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
@ -109,15 +95,15 @@ target/docker-syncd-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-sy
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb)
|
||||
target/docker-orchagent.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS))
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb)
|
||||
target/docker-orchagent-mlnx.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-mlnx/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb swss_1.0.0_amd64.deb $(LIBNL-DEBS))
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb orchagent swssconfig portsyncd intfsyncd neighsyncd)
|
||||
target/docker-orchagent-cavm.gz: target/docker-base.gz $(addprefix dockers/docker-orchagent-cavm/deps/,libhiredis0.13_0.13.3-2_amd64.deb libswsscommon_1.0.0_amd64.deb libsairedis_1.0.0_amd64.deb)
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
@ -129,9 +115,15 @@ target/docker-database.gz: target/docker-base.gz
|
||||
docker load < $<
|
||||
$(call build_docker,$(patsubst target/%.gz,%,$@),$@)
|
||||
|
||||
## Rules: linux image content
|
||||
deps/linux-image-3.16.0-4-amd64_%.deb: src/sonic-linux-kernel/linux-image-3.16.0-4-amd64_%.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
deps/initramfs-tools_%.deb: src/initramfs-tools/initramfs-tools_%.deb
|
||||
mkdir -p `dirname $@` && cp $< $(dir $@)
|
||||
|
||||
## Rules: linux image
|
||||
target/sonic-generic.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb
|
||||
./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=generic ./build_image.sh
|
||||
|
||||
target/sonic-aboot.bin: deps/linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb deps/initramfs-tools_0.120_all.deb
|
||||
./build_debian.sh "$(USERNAME)" "$(PASSWORD_ENCRYPTED)" && TARGET_MACHINE=aboot ./build_image.sh
|
||||
|
||||
|
@ -19,6 +19,9 @@ install_deb = \
|
||||
[ -f $(1) ] && { sudo dpkg -i $(1) || sudo apt-get -y install -f; } || return 1;
|
||||
|
||||
## Rules
|
||||
libnl-%.deb:
|
||||
pushd libnl3; ./build.sh; popd
|
||||
|
||||
quagga_0.99.24.1-2_amd64.deb:
|
||||
pushd quagga; ./build.sh; popd
|
||||
|
||||
@ -55,7 +58,6 @@ brcm/swss_1.0.0_amd64.deb brcm/intfsyncd brcm/neighsyncd brcm/orchagent brcm/por
|
||||
$(foreach dep, $^, $(call install_deb, $(dep)))
|
||||
$(call build_project, sonic-swss)
|
||||
cp swss_1.0.0_amd64.deb brcm/
|
||||
cp sonic-swss/debian/swss/usr/bin/* brcm/
|
||||
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
|
||||
|
||||
## Note: fpmsyncd is one implicit target
|
||||
@ -63,7 +65,6 @@ mlnx/swss_1.0.0_amd64.deb mlnx/intfsyncd mlnx/neighsyncd mlnx/orchagent mlnx/por
|
||||
$(foreach dep, $^, $(call install_deb, $(dep)))
|
||||
$(call build_project, sonic-swss)
|
||||
cp swss_1.0.0_amd64.deb mlnx/
|
||||
cp sonic-swss/debian/swss/usr/bin/* mlnx/
|
||||
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
|
||||
|
||||
## Note: fpmsyncd is one implicit target
|
||||
@ -71,7 +72,6 @@ cavm/swss_1.0.0_amd64.deb cavm/intfsyncd cavm/neighsyncd cavm/orchagent cavm/por
|
||||
$(foreach dep, $^, $(call install_deb, $(dep)))
|
||||
$(call build_project, sonic-swss)
|
||||
cp swss_1.0.0_amd64.deb cavm/
|
||||
cp sonic-swss/debian/swss/usr/bin/* cavm/
|
||||
cp sonic-swss/debian/swss/usr/bin/fpmsyncd .
|
||||
|
||||
$(addprefix sonic-linux-kernel/,linux-headers-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb linux-headers-3.16.0-4-common_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64-dbg_3.16.7-ckt11-2+acs8u2_amd64.deb linux-image-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb xen-linux-system-3.16.0-4-amd64_3.16.7-ckt11-2+acs8u2_amd64.deb):
|
||||
|
@ -20,3 +20,4 @@ quilt push
|
||||
dpkg-buildpackage -rfakeroot -b -us -uc
|
||||
|
||||
popd
|
||||
cp *.deb ..
|
||||
|
Loading…
Reference in New Issue
Block a user