Skip to content

Commit 4002a91

Browse files
author
Arjen Roodselaar
committed
Split install into subtargets
When building a cross-compile toolchain for a freestanding platform one may not want to build and install shared objects.
1 parent 705cbae commit 4002a91

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

Makefile

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ OLM_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR)
4040
endif
4141
endif
4242

43-
.PHONY: all check test clean distclean install
43+
.PHONY: all check test clean distclean \
44+
install install-static install-shared install-pkgconfig install-headers
4445

4546
all: libopenlibm.a libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
4647

@@ -74,12 +75,21 @@ openlibm.pc: openlibm.pc.in Make.inc Makefile
7475
echo "version=${VERSION}" >> openlibm.pc
7576
cat openlibm.pc.in >> openlibm.pc
7677

77-
install: all openlibm.pc
78+
install-static: libopenlibm.a
79+
mkdir -p $(DESTDIR)$(libdir)
80+
cp -f -a libopenlibm.a $(DESTDIR)$(libdir)/
81+
82+
install-shared: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
7883
mkdir -p $(DESTDIR)$(shlibdir)
84+
cp -f -a libopenlibm.*$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/
85+
86+
install-pkgconfig: openlibm.pc
7987
mkdir -p $(DESTDIR)$(pkgconfigdir)
88+
cp -f -a openlibm.pc $(DESTDIR)$(pkgconfigdir)/
89+
90+
install-headers:
8091
mkdir -p $(DESTDIR)$(includedir)/openlibm
81-
cp -f -a libopenlibm.*$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/
82-
cp -f -a libopenlibm.a $(DESTDIR)$(libdir)/
8392
cp -f -a include/*.h $(DESTDIR)$(includedir)/openlibm
8493
cp -f -a src/*.h $(DESTDIR)$(includedir)/openlibm
85-
cp -f -a openlibm.pc $(DESTDIR)$(pkgconfigdir)/
94+
95+
install: install-static install-shared install-pkgconfig install-headers

0 commit comments

Comments
 (0)