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 <jeremy.kerr@canonical.com>
This commit is contained in:
parent
90c4c8718e
commit
c74f1ceeb1
2 changed files with 33 additions and 4 deletions
35
Makefile
35
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)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a77cc2824a26305f9f8bfe1807cb85ae54031687
|
||||
Subproject commit ebcbbcfafce6a239724c841d30b9ba345cef41e4
|
Loading…
Reference in a new issue