Skip to content

Commit

Permalink
build: don't build or install shared objects when doing a static build.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericonr committed Dec 5, 2020
1 parent 05ff04a commit cf9803e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 7 additions & 0 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ OBJS += conf.o log.o
OBJS += $(EXTOBJS) $(COMPAT_OBJS)
# unnecessary unless pkgdb format changes
# OBJS += pkgdb_conversion.o

.PHONY: all
ifdef BUILD_STATIC
all: libxbps.a
else
all: libxbps.so libxbps.a
endif

external/fetch/ftperr.h: external/fetch/ftp.errors
@printf " [GEN]\t\t$@\n"
Expand Down Expand Up @@ -92,9 +97,11 @@ libxbps.a: $(LIBFETCH_OBJS) $(LIBPROP_OBJS) $(OBJS)
install: all
install -d $(DESTDIR)$(LIBDIR)
install -m 644 libxbps.a $(DESTDIR)$(LIBDIR)
ifndef BUILD_STATIC
install -m 755 $(LIBXBPS_SHLIB) $(DESTDIR)$(LIBDIR)
cp -a libxbps.so $(DESTDIR)$(LIBDIR)
cp -a libxbps.so.$(LIBXBPS_MAJOR) $(DESTDIR)$(LIBDIR)
endif

.PHONY: uninstall
uninstall:
Expand Down
12 changes: 3 additions & 9 deletions mk/prog.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MANSECTION ?= 1
MAN ?= $(BIN).$(MANSECTION)

ifdef BUILD_STATIC
BINS += $(BIN).static
BINS = $(BIN).static
endif

CFLAGS += -Wno-unused-command-line-argument
Expand All @@ -23,21 +23,15 @@ clean:
.PHONY: install
install: all
install -d $(DESTDIR)$(SBINDIR)
install -m 755 $(BIN) $(DESTDIR)$(SBINDIR)
ifdef BUILD_STATIC
install -m 755 $(BIN).static $(DESTDIR)$(SBINDIR)
endif
install -m 755 $(BINS) $(DESTDIR)$(SBINDIR)
ifdef MAN
install -d $(DESTDIR)$(MANDIR)/man$(MANSECTION)
install -m 644 $(MAN) $(DESTDIR)$(MANDIR)/man$(MANSECTION)
endif

.PHONY: uninstall
uninstall:
-rm -f $(DESTDIR)$(SBINDIR)/$(BIN)
ifdef BUILD_STATIC
-rm -f $(DESTDIR)$(SBINDIR)/$(BIN).static
endif
-rm -f $(DESTDIR)$(SBINDIR)/$(BINS)
ifdef MAN
-rm -f $(DESTDIR)$(MANDIR)/man$(MANSECTION)/$(MAN)
endif
Expand Down

0 comments on commit cf9803e

Please sign in to comment.