1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
# Bugs in this Makefile:
#
# 1. $(EXEEXT) not included for scripts.
## C programs
bin_PROGRAMS = ch-checkns ch-run
headers = core.h env.h fs.h list.h mem.h misc.h log.h str.h
if HAVE_SQUASHFUSE
headers += fuse.h
endif
if HAVE_JSON
headers += json.h
endif
if HAVE_SECCOMP
headers += seccomp.h
endif
# Pattern substitution would be more robust here, but Automake doesn’t support
# it, so it becomes a no-op for reasons I don’t understand.
sources = $(headers) $(headers:.h=.c)
# checkns doesn’t actually need all of these but it simplifies this Makefile.
ch_checkns_SOURCES = ch-checkns.c $(sources)
ch_run_SOURCES = ch-run.c $(sources)
# https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html
# Without explicit dependencies of all .o files on all.h, this target runs in
# parallel with the .o builds given sufficient -j. See #2064.
$(ch_checkns_OBJECTS): all.h
$(ch_run_OBJECTS): all.h
all.h: Makefile $(headers)
echo '/* autogenerated; do not edit */' > $@
# sleep 5 # guarantee race losing
echo '#define _GNU_SOURCE' >> $@
echo '#pragma once' >> $@
for h in $(headers); \
do echo "#include \"$$h\"" >> $@; \
done
## Shell scripts - distributed as-is
dist_bin_SCRIPTS = ch-convert \
ch-fromhost \
ch-test
## Python scripts - need text processing
bin_SCRIPTS = ch-run-oci # scripts to build
EXTRA_SCRIPTS = ch-image # more scripts that *may* be built
if ENABLE_CH_IMAGE
bin_SCRIPTS += ch-image
endif
EXTRA_DIST = ch-image.py.in ch-run-oci.py.in
CLEANFILES = $(bin_SCRIPTS) $(EXTRA_SCRIPTS) all.h
ch-image: ch-image.py.in
ch-run-oci: ch-run-oci.py.in
$(bin_SCRIPTS): %: %.py.in
rm -f $@
sed -E 's|%PYTHON_SHEBANG%|@PYTHON_SHEBANG@|' < $< > $@
chmod +rx,-w $@ # respects umask
|