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
This commit is contained in:
John Koleszar 2010-05-24 10:16:44 -04:00
parent 6be1d9337e
commit ee8bcb1a7d
4 changed files with 61 additions and 31 deletions

View File

@ -18,6 +18,7 @@ ifeq ($(target),)
done done
all: .DEFAULT all: .DEFAULT
clean:: .DEFAULT clean:: .DEFAULT
install:: .DEFAULT
# Note: md5sum is not installed on OS X, but openssl is. Openssl may not be # 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)) md5sum := $(if $(filter %openssl,$(md5sum)),$(md5sum) dgst -md5,$(md5sum))
TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN))) TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
install: dist:
@for t in $(ALL_TARGETS); do \ @for t in $(ALL_TARGETS); do \
$(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\ $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\
done done
@ -94,10 +95,10 @@ clean::
rm -f $(OBJS-yes) $(OBJS-yes:.o=.d) $(OBJS-yes:.asm.s.o=.asm.s) rm -f $(OBJS-yes) $(OBJS-yes:.o=.d) $(OBJS-yes:.asm.s.o=.asm.s)
rm -f $(CLEAN-OBJS) rm -f $(CLEAN-OBJS)
.PHONY: dist
dist:
.PHONY: install .PHONY: install
install: install::
.PHONY: install-helper
install-helper:
$(BUILD_PFX)%.c.d: %.c $(BUILD_PFX)%.c.d: %.c
$(if $(quiet),@echo " [DEP] $@") $(if $(quiet),@echo " [DEP] $@")
@ -254,6 +255,9 @@ DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,DOCS)
@touch $@ @touch $@
INSTALL-DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,INSTALL-DOCS) 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)) .install-docs: .docs $(addprefix $(DIST_DIR)/,$(INSTALL-DOCS))
@touch $@ @touch $@
@ -265,6 +269,9 @@ BINS=$(call enabled,BINS)
@touch $@ @touch $@
INSTALL-BINS=$(call cond_enabled,CONFIG_INSTALL_BINS,INSTALL-BINS) 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)) .install-bins: .bins $(addprefix $(DIST_DIR)/,$(INSTALL-BINS))
@touch $@ @touch $@
@ -277,6 +284,9 @@ LIBS=$(call enabled,LIBS)
$(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib)))) $(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib))))
INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS) 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)) .install-libs: .libs $(addprefix $(DIST_DIR)/,$(INSTALL-LIBS))
@touch $@ @touch $@
@ -289,6 +299,9 @@ PROJECTS=$(call enabled,PROJECTS)
@touch $@ @touch $@
INSTALL-PROJECTS=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,INSTALL-PROJECTS) 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)) .install-projects: .projects $(addprefix $(DIST_DIR)/,$(INSTALL-PROJECTS))
@touch $@ @touch $@
@ -296,26 +309,29 @@ clean::
rm -f .projects .install-projects $(PROJECTS) rm -f .projects .install-projects $(PROJECTS)
endif 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. # system too.
ifneq ($(call enabled,INSTALL-SRCS),) ifneq ($(call enabled,DIST-SRCS),)
INSTALL-SRCS-yes += configure DIST-SRCS-yes += configure
INSTALL-SRCS-yes += build/make/configure.sh DIST-SRCS-yes += build/make/configure.sh
INSTALL-SRCS-yes += build/make/gen_asm_deps.sh DIST-SRCS-yes += build/make/gen_asm_deps.sh
INSTALL-SRCS-yes += build/make/Makefile DIST-SRCS-yes += build/make/Makefile
INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh
INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh
INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
INSTALL-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
# #
# This isn't really ARCH_ARM dependent, it's dependant on whether we're # This isn't really ARCH_ARM dependent, it's dependant on whether we're
# using assembly code or not (CONFIG_OPTIMIZATIONS maybe). Just use # using assembly code or not (CONFIG_OPTIMIZATIONS maybe). Just use
# this for now. # this for now.
INSTALL-SRCS-$(ARCH_ARM) += build/make/obj_int_extract.c DIST-SRCS-$(ARCH_ARM) += build/make/obj_int_extract.c
INSTALL-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
INSTALL-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
endif endif
INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS) 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)) .install-srcs: $(addprefix $(DIST_DIR)/src/,$(INSTALL-SRCS))
@touch $@ @touch $@
@ -329,7 +345,8 @@ endif
BUILD_TARGETS += .docs .libs .bins BUILD_TARGETS += .docs .libs .bins
INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins
all-$(target): $(BUILD_TARGETS) all-$(target): $(BUILD_TARGETS)
install: $(INSTALL_TARGETS) install:: $(INSTALL_TARGETS)
dist: $(INSTALL_TARGETS)
# #
# Development helper targets # Development helper targets

14
configure vendored
View File

@ -135,11 +135,12 @@ if [ ${doxy_major:-0} -ge 1 ]; then
[ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable doxygen [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable doxygen
fi 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 enabled doxygen && php -v >/dev/null 2>&1 && enable install_docs
enable install_bins enable install_bins
enable install_libs enable install_libs
enable install_srcs
enable optimizations enable optimizations
enable fast_unaligned #allow unaligned accesses, if supported by hw 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` local ver=`"$source_path/build/make/version.sh" --bare $source_path`
DIST_DIR="${DIST_DIR}-${ver}" DIST_DIR="${DIST_DIR}-${ver}"
fi fi
enabled child || echo "DIST_DIR?=${DIST_DIR}" >> config.mk enabled child || cat <<EOF >> 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 enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
# #

10
docs.mk
View File

@ -47,8 +47,8 @@ docs/html/index.html: doxyfile $(CODEC_DOX) $(TXT_DOX)
@doxygen $< @doxygen $<
DOCS-yes += docs/html/index.html DOCS-yes += docs/html/index.html
INSTALL-DOCS-yes = $(wildcard docs/html/*) DIST-DOCS-yes = $(wildcard docs/html/*)
INSTALL-DOCS-$(CONFIG_CODEC_SRCS) += $(addprefix src/,$(CODEC_DOX)) DIST-DOCS-$(CONFIG_CODEC_SRCS) += $(addprefix src/,$(CODEC_DOX))
INSTALL-DOCS-$(CONFIG_CODEC_SRCS) += src/libs.doxy_template DIST-DOCS-$(CONFIG_CODEC_SRCS) += src/libs.doxy_template
INSTALL-DOCS-yes += CHANGELOG DIST-DOCS-yes += CHANGELOG
INSTALL-DOCS-yes += README DIST-DOCS-yes += README

View File

@ -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.SRCS += vpx_ports/mem_ops.h vpx_ports/mem_ops_aligned.h
ivfenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1 ivfenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
ivfenc.DESCRIPTION = Full featured encoder ivfenc.DESCRIPTION = Full featured encoder
UTILS-$(CONFIG_DECODERS) += example_xma.c
example_xma.GUID = A955FC4A-73F1-44F7-135E-30D84D32F022 # XMA example disabled for now, not used in VP8
example_xma.DESCRIPTION = External Memory Allocation mode usage #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 GEN_EXAMPLES-$(CONFIG_DECODERS) += simple_decoder.c
simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
@ -99,6 +101,7 @@ LDFLAGS += $(addprefix -L,$(LIB_PATH))
UTILS = $(call enabled,UTILS) UTILS = $(call enabled,UTILS)
GEN_EXAMPLES = $(call enabled,GEN_EXAMPLES) GEN_EXAMPLES = $(call enabled,GEN_EXAMPLES)
ALL_EXAMPLES = $(UTILS) $(GEN_EXAMPLES) ALL_EXAMPLES = $(UTILS) $(GEN_EXAMPLES)
UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
ALL_SRCS = $(foreach ex,$(ALL_EXAMPLES),$($(ex:.c=).SRCS)) ALL_SRCS = $(foreach ex,$(ALL_EXAMPLES),$($(ex:.c=).SRCS))
CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS)) 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 # Create build/install dependencies for all examples. The common case
# is handled here. The MSVS case is handled below. # is handled here. The MSVS case is handled below.
NOT_MSVS = $(if $(CONFIG_MSVS),,yes) NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=)) DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=))
INSTALL-SRCS-yes += $(ALL_SRCS) 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))) OBJS-$(NOT_MSVS) += $(if $(BUILD_OBJS),$(call objs,$(ALL_SRCS)))
BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=)) BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=))