diff --git a/bin/xbps-bin/Makefile b/bin/xbps-bin/Makefile index c942ce52440..88d7aa9d46e 100644 --- a/bin/xbps-bin/Makefile +++ b/bin/xbps-bin/Makefile @@ -1,25 +1,5 @@ +BIN = xbps-bin +OBJS = main.o ../xbps-repo/util.o + TOPDIR = ../.. -include $(TOPDIR)/vars.mk - -OBJS = main.o ../xbps-repo/util.o -BIN = xbps-bin - -all: $(BIN) -.PHONY: all - -$(BIN): $(OBJS) - $(CC) $(LDFLAGS) $^ -o $@ - -.PHONY: clean -clean: clean-bins clean-objs - -clean-bins: - -rm -f $(BIN) - -clean-objs: - -rm -f *.o - -rm -f ../xbps-repo/util.o - -install: $(BIN) - install -d $(SBINDIR) - install -m 755 $(BIN) $(SBINDIR) +include $(TOPDIR)/prog.mk diff --git a/bin/xbps-cmpver/Makefile b/bin/xbps-cmpver/Makefile index 49ffad1937d..a8e80c5d693 100644 --- a/bin/xbps-cmpver/Makefile +++ b/bin/xbps-cmpver/Makefile @@ -1,24 +1,4 @@ +BIN = xbps-cmpver + TOPDIR = ../.. -include $(TOPDIR)/vars.mk - -OBJS = main.o -BIN = xbps-cmpver - -all: $(BIN) -.PHONY: all - -$(BIN): $(OBJS) - $(CC) $(LDFLAGS) $^ -o $@ - -.PHONY: clean -clean: clean-bins clean-objs - -clean-bins: - -rm -f $(BIN) - -clean-objs: - -rm -f *.o - -install: $(BIN) - install -d $(SBINDIR) - install -m 755 $(BIN) $(SBINDIR) +include $(TOPDIR)/prog.mk diff --git a/bin/xbps-digest/Makefile b/bin/xbps-digest/Makefile index ebc7eb14592..849850f9178 100644 --- a/bin/xbps-digest/Makefile +++ b/bin/xbps-digest/Makefile @@ -1,25 +1,4 @@ +BIN = xbps-digest + TOPDIR = ../.. -include $(TOPDIR)/vars.mk - -EXTRA_CFLAGS = -funroll-all-loops -ftree-loop-linear -OBJS = main.o -BIN = xbps-digest - -all: $(BIN) -.PHONY: all - -$(BIN): $(OBJS) - $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) $^ -o $@ - -.PHONY: clean -clean: clean-bins clean-objs - -clean-bins: - -rm -f $(BIN) - -clean-objs: - -rm -f *.o - -install: $(BIN) - install -d $(SBINDIR) - install -m 755 $(BIN) $(SBINDIR) +include $(TOPDIR)/prog.mk diff --git a/bin/xbps-pkgdb/Makefile b/bin/xbps-pkgdb/Makefile index 23acf719d1e..654a86d3939 100644 --- a/bin/xbps-pkgdb/Makefile +++ b/bin/xbps-pkgdb/Makefile @@ -1,24 +1,4 @@ +BIN = xbps-pkgdb + TOPDIR = ../.. -include $(TOPDIR)/vars.mk - -OBJS = main.o -BIN = xbps-pkgdb - -all: $(BIN) -.PHONY: all - -$(BIN): $(OBJS) - $(CC) $(LDFLAGS) $^ -o $@ - -.PHONY: clean -clean: clean-bins clean-objs - -clean-bins: - -rm -f $(BIN) - -clean-objs: - -rm -f *.o - -install: $(BIN) - install -d $(SBINDIR) - install -m 755 $(BIN) $(SBINDIR) +include $(TOPDIR)/prog.mk diff --git a/bin/xbps-repo/Makefile b/bin/xbps-repo/Makefile index f6246cd86fd..d610272d6ef 100644 --- a/bin/xbps-repo/Makefile +++ b/bin/xbps-repo/Makefile @@ -1,24 +1,5 @@ +BIN = xbps-repo +OBJS = main.o util.o + TOPDIR = ../.. -include $(TOPDIR)/vars.mk - -OBJS = util.o main.o -BIN = xbps-repo - -all: $(BIN) -.PHONY: all - -$(BIN): $(OBJS) - $(CC) $(LDFLAGS) $^ -o $@ - -.PHONY: clean -clean: clean-bins clean-objs - -clean-bins: - -rm -f $(BIN) - -clean-objs: - -rm -f *.o - -install: $(BIN) - install -d $(SBINDIR) - install -m 755 $(BIN) $(SBINDIR) +include $(TOPDIR)/prog.mk diff --git a/prog.mk b/prog.mk new file mode 100644 index 00000000000..02d2709c29c --- /dev/null +++ b/prog.mk @@ -0,0 +1,22 @@ +include $(TOPDIR)/vars.mk + +OBJS ?= main.o + +all: $(BIN) +.PHONY: all + +$(BIN): $(OBJS) + $(CC) $(LDFLAGS) $^ -o $@ + +.PHONY: clean +clean: clean-bins clean-objs + +clean-bins: + -rm -f $(BIN) + +clean-objs: + -rm -f $(OBJS) + +install: $(BIN) + install -d $(SBINDIR) + install $(INSTALL_STRIPPED) -m 755 $(BIN) $(SBINDIR) diff --git a/vars.mk b/vars.mk index 9eb5ff598be..7824af0be80 100644 --- a/vars.mk +++ b/vars.mk @@ -5,6 +5,7 @@ SBINDIR ?= $(PREFIX)/sbin LIBDIR ?= $(PREFIX)/lib ETCDIR ?= $(PREFIX)/etc TOPDIR ?= .. +INSTALL_STRIPPED ?= -s LDFLAGS += -L$(TOPDIR)/lib -L$(PREFIX)/lib -lxbps CPPFLAGS += -I$(TOPDIR)/include