author | Olivier Brunel
<jjk@jjacky.com> 2023-07-23 10:56:52 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-07-23 10:57:08 UTC |
parent | f60aa7f37e43e5ff153b822145ae4d9fe4ea3b16 |
common.mk | +5 | -2 |
configure | +12 | -0 |
diff --git a/common.mk b/common.mk index 43e49fe..bdaae4b 100644 --- a/common.mk +++ b/common.mk @@ -118,6 +118,8 @@ INSTMD = $(_INST) if test -h $<; then cp -P $< $@; else install -D -m 644 $< $@; DESTDOC = $(DESTDIR)$(SHAREDIR)/doc/$(PROJECT_NAME) INSTDOC = $(_INST) install -D -m 644 $< $@ +INSTHDR = $(_INST) install -D -m 644 $< $@ + # to be generated by ./configure include config.mk @@ -156,7 +158,7 @@ $(DESTDIR)$(LIBDIR)/%.so: %.so $(DESTDIR)$(LIBDIR)/%.a: %.a $(_INST) install -D -m 644 $< $@ -# install "orivate" binaries +# install "private" binaries $(DESTDIR)$(LIBDIR)/$(PROJECT_NAME)/%: % $(_INST) install -D -m 755 $< $@ @@ -187,7 +189,8 @@ install-bins: $(BINS:%=$(DESTDIR)$(BINDIR)/%) install-libs: $(LIBS:%=$(DESTDIR)$(LIBDIR)/comain/%) \ $(STATIC_LIBS:%=$(DESTDIR)$(LIBDIR)/%) \ - $(SHARED_LIBS:%=$(DESTDIR)$(LIBDIR)/%) + $(SHARED_LIBS:%=$(DESTDIR)$(LIBDIR)/%) \ + $(HEADERS:%=$(DESTDIR)$(INCDIR)/%) install-priv: $(PRIV_STATIC_LIBS:%=$(DESTDIR)$(LIBDIR)/$(PROJECT_NAME)/%) \ $(PRIV_SHARED_LIBS:%=$(DESTDIR)$(LIBDIR)/$(PROJECT_NAME)/%) \ diff --git a/configure b/configure index ae927d6..dddf944 100755 --- a/configure +++ b/configure @@ -880,6 +880,8 @@ BLD_STATIC_LIBS= BLD_SHARED_LIBS= BLD_BINS= BLD_DOCS= +INST_HDR= +HEADERS= setupobjs() { local docs_objs @@ -908,6 +910,14 @@ setupobjs() | sed -e 's/^src\/doc\(.*\)\/\(.\+\.\(.\)\.md\)$/\$(DESTMD)\/\3\/\2: build\/doc\1\/\2\n $(INSTMD)/g' \ )"$'\n'"$BLD_DOCS" continue + elif test "$(expr substr "$name" 1 3)" = "lib"; then + objs="$(find "$d"/include -type f)" + INST_HDR="$(echo "$objs" \ + | sed -e 's/^src\/lib\(.\+\)\/include\/\(.\+\)$/$(DESTDIR)$(INCDIR)\/\2: \0\n $(INSTHDR)/g' \ + )"$'\n'"$INST_HDR" + HEADERS="$(echo "$objs" \ + | sed -e 's/^src\/lib.\+\/include\/\(.\+\)$/\1/g' \ + | tr '\n' ' ') $HEADERS" fi objs="$(find "$d" -name '*.[cS]' | sed -e s/^src/build/g \ -e s/\\.c$/.o/g -e s/\\.S/.o/g $excl | tr '\n' ' ')" @@ -1018,9 +1028,11 @@ cat <<EOF # build targets $BLD_DOCS +$INST_HDR BLD_STATIC_LIBS = $BLD_STATIC_LIBS BLD_SHARED_LIBS = $BLD_SHARED_LIBS BLD_BINS = $BLD_BINS +HEADERS = $HEADERS # some flags COMMON_CPPFLAGS += $COMMON_CPPFLAGS