From f3d781e6a2c83bf014611301cb8e0466fa3b52d0 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 22 Sep 2023 07:00:02 +0000 Subject: Simpler Makefile Signed-off-by: Laurent Bercot --- Makefile | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 0d34c7a..b82361b 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,9 @@ CC = $(error Please use ./configure first) STATIC_LIBS := SHARED_LIBS := +INTERNAL_LIBS := +EXTRA_TARGETS := LIB_DEFS := -BIN_SYMLINKS := -EXTRA_TEMP := define library_definition LIB$(firstword $(subst =, ,$(1))) := lib$(lastword $(subst =, ,$(1))).$(if $(DO_ALLSTATIC),a,so).xyzzy @@ -53,14 +53,14 @@ RANLIB := $(CROSS_COMPILE)ranlib STRIP := $(CROSS_COMPILE)strip INSTALL := ./tools/install.sh -ALL_BINS := $(BIN_TARGETS) $(LIBEXEC_TARGETS) +ALL_BINS := $(LIBEXEC_TARGETS) $(BIN_TARGETS) ALL_LIBS := $(SHARED_LIBS) $(STATIC_LIBS) $(INTERNAL_LIBS) ALL_INCLUDES := $(wildcard src/include/$(package)/*.h) -all: $(ALL_LIBS) $(ALL_BINS) $(ALL_INCLUDES) +all: $(ALL_LIBS) $(ALL_BINS) $(ALL_INCLUDES) $(EXTRA_INCLUDES) clean: - @exec rm -f $(ALL_LIBS) $(ALL_BINS) $(EXTRA_TEMP) $(wildcard src/*/*.o src/*/*.lo) + @exec rm -f $(ALL_LIBS) $(ALL_BINS) $(wildcard src/*/*.o src/*/*.lo) $(EXTRA_TARGETS) distclean: clean @exec rm -f config.mak src/include/$(package)/config.h @@ -84,10 +84,9 @@ endif install: install-dynlib install-libexec install-bin install-lib install-include install-dynlib: $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(dynlibdir)/lib%.so) install-libexec: $(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%) -install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%) $(BIN_SYMLINKS:%=$(DESTDIR)$(bindir)/%) +install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%) install-lib: $(STATIC_LIBS:lib%.a.xyzzy=$(DESTDIR)$(libdir)/lib%.a) -install-include: $(ALL_INCLUDES:src/include/$(package)/%.h=$(DESTDIR)$(includedir)/$(package)/%.h) -install-data: $(ALL_DATA:src/etc/%=$(DESTDIR)$(datadir)/%) +install-include: $(ALL_INCLUDES:src/include/$(package)/%.h=$(DESTDIR)$(includedir)/$(package)/%.h) $(EXTRA_INCLUDES:src/include/%.h=$(DESTDIR)$(includedir)/%.h) ifneq ($(exthome),) @@ -96,7 +95,7 @@ $(DESTDIR)$(exthome): $(DESTDIR)$(home) update: $(DESTDIR)$(exthome) -global-links: $(DESTDIR)$(exthome) $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(sproot)/library.so/lib%.so.$(version_M)) $(BIN_TARGETS:%=$(DESTDIR)$(sproot)/command/%) $(BIN_SYMLINKS:%=$(DESTDIR)$(sproot)/command/%) +global-links: $(DESTDIR)$(exthome) $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(sproot)/library.so/lib%.so.$(version_M)) $(BIN_TARGETS:%=$(DESTDIR)$(sproot)/command/%) $(DESTDIR)$(sproot)/command/%: $(DESTDIR)$(home)/command/% exec $(INSTALL) -D -l ..$(subst $(sproot),,$(exthome))/command/$(