From ee8bcb1a7dcecc4dd393129237f234cbb619bab4 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Mon, 24 May 2010 10:16:44 -0400 Subject: [PATCH] make: make install target behave as expected Split the 'make install' target into two: install and dist. dist retains the old make install behavior of building a "distribution" release, with source files, build system, etc. install does what one one expects -- installs into a tree in the filesystem, /usr/local by default. Change-Id: I0805681ac10f853ef94cdc3aa70981c6bea81b45 --- build/make/Makefile | 53 ++++++++++++++++++++++++++++++--------------- configure | 14 +++++++++--- docs.mk | 10 ++++----- examples.mk | 15 ++++++++----- 4 files changed, 61 insertions(+), 31 deletions(-) diff --git a/build/make/Makefile b/build/make/Makefile index 93db44d3a..5ea1f229e 100755 --- a/build/make/Makefile +++ b/build/make/Makefile @@ -18,6 +18,7 @@ ifeq ($(target),) done all: .DEFAULT clean:: .DEFAULT +install:: .DEFAULT # Note: md5sum is not installed on OS X, but openssl is. Openssl may not be @@ -29,7 +30,7 @@ md5sum := $(firstword $(wildcard \ md5sum := $(if $(filter %openssl,$(md5sum)),$(md5sum) dgst -md5,$(md5sum)) TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN))) -install: +dist: @for t in $(ALL_TARGETS); do \ $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\ done @@ -94,10 +95,10 @@ clean:: rm -f $(OBJS-yes) $(OBJS-yes:.o=.d) $(OBJS-yes:.asm.s.o=.asm.s) rm -f $(CLEAN-OBJS) +.PHONY: dist +dist: .PHONY: install -install: -.PHONY: install-helper -install-helper: +install:: $(BUILD_PFX)%.c.d: %.c $(if $(quiet),@echo " [DEP] $@") @@ -254,6 +255,9 @@ DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,DOCS) @touch $@ INSTALL-DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,INSTALL-DOCS) +ifeq ($(MAKECMDGOALS),dist) +INSTALL-DOCS+=$(call cond_enabled,CONFIG_INSTALL_DOCS,DIST-DOCS) +endif .install-docs: .docs $(addprefix $(DIST_DIR)/,$(INSTALL-DOCS)) @touch $@ @@ -265,6 +269,9 @@ BINS=$(call enabled,BINS) @touch $@ INSTALL-BINS=$(call cond_enabled,CONFIG_INSTALL_BINS,INSTALL-BINS) +ifeq ($(MAKECMDGOALS),dist) +INSTALL-BINS+=$(call cond_enabled,CONFIG_INSTALL_BINS,DIST-BINS) +endif .install-bins: .bins $(addprefix $(DIST_DIR)/,$(INSTALL-BINS)) @touch $@ @@ -277,6 +284,9 @@ LIBS=$(call enabled,LIBS) $(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib)))) INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS) +ifeq ($(MAKECMDGOALS),dist) +INSTALL-LIBS+=$(call cond_enabled,CONFIG_INSTALL_LIBS,DIST-LIBS) +endif .install-libs: .libs $(addprefix $(DIST_DIR)/,$(INSTALL-LIBS)) @touch $@ @@ -289,6 +299,9 @@ PROJECTS=$(call enabled,PROJECTS) @touch $@ INSTALL-PROJECTS=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,INSTALL-PROJECTS) +ifeq ($(MAKECMDGOALS),dist) +INSTALL-PROJECTS+=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,DIST-PROJECTS) +endif .install-projects: .projects $(addprefix $(DIST_DIR)/,$(INSTALL-PROJECTS)) @touch $@ @@ -296,26 +309,29 @@ clean:: rm -f .projects .install-projects $(PROJECTS) endif -# If there are any source files to be installed, then include the build +# If there are any source files to be distributed, then include the build # system too. -ifneq ($(call enabled,INSTALL-SRCS),) - INSTALL-SRCS-yes += configure - INSTALL-SRCS-yes += build/make/configure.sh - INSTALL-SRCS-yes += build/make/gen_asm_deps.sh - INSTALL-SRCS-yes += build/make/Makefile - INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh - INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh - INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh - INSTALL-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh +ifneq ($(call enabled,DIST-SRCS),) + DIST-SRCS-yes += configure + DIST-SRCS-yes += build/make/configure.sh + DIST-SRCS-yes += build/make/gen_asm_deps.sh + DIST-SRCS-yes += build/make/Makefile + DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh + DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh + DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh + DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh # # This isn't really ARCH_ARM dependent, it's dependant on whether we're # using assembly code or not (CONFIG_OPTIMIZATIONS maybe). Just use # this for now. - INSTALL-SRCS-$(ARCH_ARM) += build/make/obj_int_extract.c - INSTALL-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl - INSTALL-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk + DIST-SRCS-$(ARCH_ARM) += build/make/obj_int_extract.c + DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl + DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk endif INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS) +ifeq ($(MAKECMDGOALS),dist) +INSTALL-SRCS += $(call cond_enabled,CONFIG_INSTALL_SRCS,DIST-SRCS) +endif .install-srcs: $(addprefix $(DIST_DIR)/src/,$(INSTALL-SRCS)) @touch $@ @@ -329,7 +345,8 @@ endif BUILD_TARGETS += .docs .libs .bins INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins all-$(target): $(BUILD_TARGETS) -install: $(INSTALL_TARGETS) +install:: $(INSTALL_TARGETS) +dist: $(INSTALL_TARGETS) # # Development helper targets diff --git a/configure b/configure index 3083343b4..e017f528c 100755 --- a/configure +++ b/configure @@ -135,11 +135,12 @@ if [ ${doxy_major:-0} -ge 1 ]; then [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable doxygen fi -# install everything, by default +# install everything except the sources, by default. sources will have +# to be enabled when doing dist builds, since that's no longer a common +# case. enabled doxygen && php -v >/dev/null 2>&1 && enable install_docs enable install_bins enable install_libs -enable install_srcs enable optimizations enable fast_unaligned #allow unaligned accesses, if supported by hw @@ -366,7 +367,14 @@ process_targets() { local ver=`"$source_path/build/make/version.sh" --bare $source_path` DIST_DIR="${DIST_DIR}-${ver}" fi - enabled child || echo "DIST_DIR?=${DIST_DIR}" >> config.mk + enabled child || cat <> config.mk +ifeq (\$(MAKECMDGOALS),dist) +DESTDIR?=${DIST_DIR} +else +DESTDIR?=/usr/local +endif +DIST_DIR?=\$(DESTDIR) +EOF enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk # diff --git a/docs.mk b/docs.mk index 3e7b5cdeb..868bcb995 100644 --- a/docs.mk +++ b/docs.mk @@ -47,8 +47,8 @@ docs/html/index.html: doxyfile $(CODEC_DOX) $(TXT_DOX) @doxygen $< DOCS-yes += docs/html/index.html -INSTALL-DOCS-yes = $(wildcard docs/html/*) -INSTALL-DOCS-$(CONFIG_CODEC_SRCS) += $(addprefix src/,$(CODEC_DOX)) -INSTALL-DOCS-$(CONFIG_CODEC_SRCS) += src/libs.doxy_template -INSTALL-DOCS-yes += CHANGELOG -INSTALL-DOCS-yes += README +DIST-DOCS-yes = $(wildcard docs/html/*) +DIST-DOCS-$(CONFIG_CODEC_SRCS) += $(addprefix src/,$(CODEC_DOX)) +DIST-DOCS-$(CONFIG_CODEC_SRCS) += src/libs.doxy_template +DIST-DOCS-yes += CHANGELOG +DIST-DOCS-yes += README diff --git a/examples.mk b/examples.mk index 036a423e4..fa22e12d6 100644 --- a/examples.mk +++ b/examples.mk @@ -23,9 +23,11 @@ ivfenc.SRCS += args.c args.h vpx_ports/config.h ivfenc.SRCS += vpx_ports/mem_ops.h vpx_ports/mem_ops_aligned.h ivfenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1 ivfenc.DESCRIPTION = Full featured encoder -UTILS-$(CONFIG_DECODERS) += example_xma.c -example_xma.GUID = A955FC4A-73F1-44F7-135E-30D84D32F022 -example_xma.DESCRIPTION = External Memory Allocation mode usage + +# XMA example disabled for now, not used in VP8 +#UTILS-$(CONFIG_DECODERS) += example_xma.c +#example_xma.GUID = A955FC4A-73F1-44F7-135E-30D84D32F022 +#example_xma.DESCRIPTION = External Memory Allocation mode usage GEN_EXAMPLES-$(CONFIG_DECODERS) += simple_decoder.c simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC @@ -99,6 +101,7 @@ LDFLAGS += $(addprefix -L,$(LIB_PATH)) UTILS = $(call enabled,UTILS) GEN_EXAMPLES = $(call enabled,GEN_EXAMPLES) ALL_EXAMPLES = $(UTILS) $(GEN_EXAMPLES) +UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS)) ALL_SRCS = $(foreach ex,$(ALL_EXAMPLES),$($(ex:.c=).SRCS)) CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS)) @@ -120,8 +123,10 @@ $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_OBJS,BUILD_OBJS):=yes) # Create build/install dependencies for all examples. The common case # is handled here. The MSVS case is handled below. NOT_MSVS = $(if $(CONFIG_MSVS),,yes) -INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=)) -INSTALL-SRCS-yes += $(ALL_SRCS) +DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=)) +INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=)) +DIST-SRCS-yes += $(ALL_SRCS) +INSTALL-SRCS-yes += $(UTIL_SRCS) OBJS-$(NOT_MSVS) += $(if $(BUILD_OBJS),$(call objs,$(ALL_SRCS))) BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=)) -- 2.40.0