summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-02-05 04:37:51 +0000
committerLaurent Bercot <ska@appnovation.com>2023-02-05 04:37:51 +0000
commit4676457df2c8a73b4f589a66315b9b137ee89202 (patch)
treec9bc5310ed2930a9aa5c0b73b19cd174b8a7d43d /Makefile
parent26152eb4dfe9b6ebb2360f855663d0e30177eba1 (diff)
downloadexecline-4676457df2c8a73b4f589a66315b9b137ee89202.tar.xz
Simplify build system, add --enable-multicall
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 15 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 483403f..82f380f 100644
--- a/Makefile
+++ b/Makefile
@@ -17,9 +17,8 @@ CC = $(error Please use ./configure first)
STATIC_LIBS :=
SHARED_LIBS :=
INTERNAL_LIBS :=
-EXTRA_TARGETS :=
LIB_DEFS :=
-EXTRA_BINS :=
+BIN_SYMLINKS :=
EXTRA_TEMP :=
define library_definition
@@ -55,14 +54,14 @@ RANLIB := $(CROSS_COMPILE)ranlib
STRIP := $(CROSS_COMPILE)strip
INSTALL := ./tools/install.sh
-ALL_BINS := $(LIBEXEC_TARGETS) $(BIN_TARGETS)
+ALL_BINS := $(BIN_TARGETS) $(LIBEXEC_TARGETS)
ALL_LIBS := $(SHARED_LIBS) $(STATIC_LIBS) $(INTERNAL_LIBS)
ALL_INCLUDES := $(wildcard src/include/$(package)/*.h)
all: $(ALL_LIBS) $(ALL_BINS) $(ALL_INCLUDES)
clean:
- @exec rm -f $(ALL_LIBS) $(ALL_BINS) $(EXTRA_BINS) $(EXTRA_TEMP) $(wildcard src/*/*.o src/*/*.lo)
+ @exec rm -f $(ALL_LIBS) $(ALL_BINS) $(EXTRA_TEMP) $(wildcard src/*/*.o src/*/*.lo)
distclean: clean
@exec rm -f config.mak src/include/$(package)/config.h
@@ -86,7 +85,7 @@ 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)/%) $(EXTRA_TARGETS:%=$(DESTDIR)$(bindir)/%)
+install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%) $(BIN_SYMLINKS:%=$(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)/%)
@@ -98,7 +97,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/%) $(EXTRA_TARGETS:%=$(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/%) $(BIN_SYMLINKS:%=$(DESTDIR)$(sproot)/command/%)
$(DESTDIR)$(sproot)/command/%: $(DESTDIR)$(home)/command/%
exec $(INSTALL) -D -l ..$(subst $(sproot),,$(exthome))/command/$(<F) $@
@@ -118,11 +117,15 @@ $(DESTDIR)$(dynlibdir)/lib%.so $(DESTDIR)$(dynlibdir)/lib%.so.$(version_M): lib%
$(INSTALL) -l $(@F).$(version) $@.$(version_M) && \
exec $(INSTALL) -l $(@F).$(version_M) $@
-$(DESTDIR)$(libexecdir)/% $(DESTDIR)$(bindir)/%: % package/modes
- exec $(INSTALL) -D -m 600 $< $@
- grep -- ^$(@F) < package/modes | { read name mode owner && \
- if [ x$$owner != x ] ; then chown -- $$owner $@ ; fi && \
- chmod $$mode $@ ; }
+$(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%): $(DESTDIR)$(libexecdir)/%: % package/modes
+$(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%): $(DESTDIR)$(bindir)/%: % package/modes
+$(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%) $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%):
+ grep -- ^$(@F) < package/modes | { read name mode og && \
+ if [ x$$og != x ] ; then og="-O $${og}" ; fi && \
+ $(INSTALL) -D -m $$mode $$og $< $@ ; }
+
+$(BIN_SYMLINKS:%=$(DESTDIR)$(bindir)/%): $(BIN_SYMLINKS:%=$(DESTDIR)$(bindir)/$(SYMLINK_TARGET_%))
+ exec $(INSTALL) -l $(SYMLINK_TARGET_$(@F)) $@
$(DESTDIR)$(libdir)/lib%.a: lib%.a.xyzzy
exec $(INSTALL) -D -m 644 $< $@
@@ -136,7 +139,7 @@ $(DESTDIR)$(includedir)/$(package)/%.h: src/include/$(package)/%.h
%.lo: %.c
exec $(CC) $(CPPFLAGS_ALL) $(CFLAGS_ALL) $(CFLAGS_SHARED) -c -o $@ $<
-$(ALL_BINS) $(EXTRA_BINS):
+$(ALL_BINS):
exec $(CC) -o $@ $(CFLAGS_ALL) $(LDFLAGS_ALL) $(LDFLAGS_NOSHARED) $^ $(EXTRA_LIBS) $(LDLIBS)
lib%.a.xyzzy: