From c74f1ceeb1d607f3cf606fae2a9dcddce67d5188 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Tue, 22 May 2012 16:59:16 +0800 Subject: [PATCH] ccan: Add ccan import logic Add make logic to import lib/ccan from lib/ccan.git. We need to set some dependencies on $(obj) to ensure the the ccan headers are available before starting the main build. Signed-off-by: Jeremy Kerr --- Makefile | 35 ++++++++++++++++++++++++++++++++--- lib/ccan.git | 2 +- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0f44811..e8fff70 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,16 @@ LDFLAGS = -fwhole-program # build configuration sbsign_objs = sbsign.o idc.o image.o sbverify_objs = sbverify.o idc.o image.o -ccan_objs = lib/ccan/libccan.a -ccan_includes = -I./lib/ccan libs = -lbfd -lcrypto +objs = $(sort $(sbsign_objs) $(sbverify_objs)) + +# ccan build configuration +ccan_dir = lib/ccan +ccan_objs = $(ccan_dir)/libccan.a +ccan_includes = -I./lib/ccan +ccan_modules = talloc +ccan_stamp = $(ccan_dir)/Makefile +ccan_config = $(ccan_dir)/config.h # install paths DESTDIR ?= @@ -33,9 +40,16 @@ gen-keyfiles: gen-keyfiles.o $(ccan_objs) $(LINK.o) -o $@ $^ $(libs) gen-keyfiles: libs = -luuid -$(ccan_objs): +# ccan build +$(ccan_objs): $(ccan_stamp) cd $(@D) && $(MAKE) +$(ccan_config): $(ccan_stamp) + cd $(@D) && $(MAKE) config.h + +# built objects may require headers from ccan +$(objs): $(ccan_stamp) $(ccan_config) + install: $(tools) $(install_dirs) $(install_bin) $(tools) @@ -44,3 +58,18 @@ install: $(tools) clean: rm -f $(tools) rm -f *.o + +distclean: clean + rm -rf $(ccan_dir) + +# ccan import +ccan_source_dir = lib/ccan.git +ccan_source_file = $(ccan_source_dir)/Makefile + +$(ccan_source_file): + git submodule init + git submodule update + +$(ccan_stamp): $(ccan_source_file) + $(ccan_source_dir)/tools/create-ccan-tree --exclude-tests \ + $(@D) $(ccan_modules) diff --git a/lib/ccan.git b/lib/ccan.git index a77cc28..ebcbbcf 160000 --- a/lib/ccan.git +++ b/lib/ccan.git @@ -1 +1 @@ -Subproject commit a77cc2824a26305f9f8bfe1807cb85ae54031687 +Subproject commit ebcbbcfafce6a239724c841d30b9ba345cef41e4