From 0d3eb2c8d9fa79a158bf382d47308a4a9402a431 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Sun, 5 Jul 2015 10:43:44 +0000 Subject: [PATCH] Build rules for libopusfile --- Makefile | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 29f7e2c..494fd5e 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,35 @@ -BUILDDIR := libopusbuild +BUILDDIR := build -.PHONY: libopus clean default test build +PWD=$(dir $(realpath $(lastword $(MAKEFILE_LIST)))) +export PKG_CONFIG_PATH :=$(PWD)/$(BUILDDIR)/lib/pkgconfig:$(PKG_CONFIG_PATH) -default: libopus +.PHONY: clean distclean default test build all libopus libopusfile +# Don't delete config.h files after succesful builds +.PRECIOUS: %/config.h -build: - go build +all: libopus libopusfile -test: - go test +libopus: libopus.a +libopusfile: libopus libopusfile.a -libopus/config.h: libopus/autogen.sh - (cd libopus; ./autogen.sh) - (cd libopus; ./configure --prefix="$$PWD/../$(BUILDDIR)" --enable-fixed-point) - -libopus/autogen.sh: +%/autogen.sh: git submodule init git submodule update -libopus: libopus/config.h - $(MAKE) -C libopus - $(MAKE) -C libopus install - cp $(BUILDDIR)/lib/libopus.a . +%/config.h: %/autogen.sh + (cd "$*"; ./autogen.sh) + (cd "$*"; ./configure --prefix="$$PWD/../$(BUILDDIR)" --enable-fixed-point) + +%.a: %/config.h + $(MAKE) -C "$*" + $(MAKE) -C "$*" install + cp "$(BUILDDIR)/lib/$@" . + +clean-%: + $(MAKE) -C "$*" clean + +distclean-%: + $(MAKE) -C "$*" distclean -%clean: - $(MAKE) -C libopus $@ - rm -rf $(BUILDDIR) libopus/configure.h +clean distclean: %: %-libopus %-libopusfile + rm -rf $(BUILDDIR) *.a -- 2.48.1