Obsolete
/
libipc-old
Archived
3
0
Fork 0

project.zsh and Makefile: handle dependencies correctly. `make dist` ok.

more_to_read
Philippe PITTOLI 2020-04-27 03:43:11 +02:00
parent 9c61ea5093
commit 290a693572
2 changed files with 48 additions and 94 deletions

106
Makefile
View File

@ -1,4 +1,4 @@
PACKAGE = 'ipc'
PACKAGE = 'libipc'
VERSION = '0.5.1'
PREFIX := /usr/local
@ -16,7 +16,7 @@ LDFLAGS :=
Q := @
all: libipc src/ipc.h src/usocket.h src/message.h src/fs.h src/utils.h man/libipc.7
all: libipc man/libipc.7
@:
libipc: libipc.so libipc.a
@ -27,66 +27,6 @@ libipc.clean: libipc.so.clean libipc.a.clean
libipc.uninstall: libipc.so.uninstall libipc.a.uninstall
src/ipc.h.install: src/ipc.h src
@echo ' IN > $(INCLUDEDIR)/ipc.h'
$(Q)mkdir -p '$(DESTDIR)$(INCLUDEDIR)'
$(Q)install -m0644 src/ipc.h $(DESTDIR)$(INCLUDEDIR)/ipc.h
src/ipc.h.clean: src/ipc.h
$(Q):
src/ipc.h.uninstall:
@echo ' RM > $(INCLUDEDIR)/ipc.h'
$(Q)rm -f '$(DESTDIR)$(INCLUDEDIR)/ipc.h'
src/usocket.h.install: src/usocket.h src
@echo ' IN > $(INCLUDEDIR)/usocket.h'
$(Q)mkdir -p '$(DESTDIR)$(INCLUDEDIR)'
$(Q)install -m0644 src/usocket.h $(DESTDIR)$(INCLUDEDIR)/usocket.h
src/usocket.h.clean: src/usocket.h
$(Q):
src/usocket.h.uninstall:
@echo ' RM > $(INCLUDEDIR)/usocket.h'
$(Q)rm -f '$(DESTDIR)$(INCLUDEDIR)/usocket.h'
src/message.h.install: src/message.h src
@echo ' IN > $(INCLUDEDIR)/message.h'
$(Q)mkdir -p '$(DESTDIR)$(INCLUDEDIR)'
$(Q)install -m0644 src/message.h $(DESTDIR)$(INCLUDEDIR)/message.h
src/message.h.clean: src/message.h
$(Q):
src/message.h.uninstall:
@echo ' RM > $(INCLUDEDIR)/message.h'
$(Q)rm -f '$(DESTDIR)$(INCLUDEDIR)/message.h'
src/fs.h.install: src/fs.h src
@echo ' IN > $(INCLUDEDIR)/fs.h'
$(Q)mkdir -p '$(DESTDIR)$(INCLUDEDIR)'
$(Q)install -m0644 src/fs.h $(DESTDIR)$(INCLUDEDIR)/fs.h
src/fs.h.clean: src/fs.h
$(Q):
src/fs.h.uninstall:
@echo ' RM > $(INCLUDEDIR)/fs.h'
$(Q)rm -f '$(DESTDIR)$(INCLUDEDIR)/fs.h'
src/utils.h.install: src/utils.h src
@echo ' IN > $(INCLUDEDIR)/utils.h'
$(Q)mkdir -p '$(DESTDIR)$(INCLUDEDIR)'
$(Q)install -m0644 src/utils.h $(DESTDIR)$(INCLUDEDIR)/utils.h
src/utils.h.clean: src/utils.h
$(Q):
src/utils.h.uninstall:
@echo ' RM > $(INCLUDEDIR)/utils.h'
$(Q)rm -f '$(DESTDIR)$(INCLUDEDIR)/utils.h'
man/libipc.7: man/libipc.7.scd man
@echo ' MAN > man/libipc.7'
$(Q)scdoc < 'man/libipc.7.scd' > 'man/libipc.7'
@ -105,7 +45,7 @@ man/libipc.7.uninstall:
@echo ' RM > $(MANDIR)/man7/libipc.7'
$(Q)rm -f '$(DESTDIR)$(MANDIR)/man7/libipc.7'
libipc.so: src/communication.o src/error.o src/fs.o src/message.o src/network.o src/print.o src/usocket.o src/utils.o
libipc.so: src/communication.o src/error.o src/fs.o src/message.o src/network.o src/print.o src/usocket.o src/utils.o src/fs.h src/ipc.h src/message.h src/usocket.h src/utils.h
@echo ' LD > libipc.so'
$(Q)$(CC) -o libipc.so -shared $(LDFLAGS) src/communication.o src/error.o src/fs.o src/message.o src/network.o src/print.o src/usocket.o src/utils.o
@ -134,7 +74,7 @@ libipc.so.uninstall:
@echo ' RM > $(LIBDIR)/libipc.so'
$(Q)rm -f '$(DESTDIR)$(LIBDIR)/libipc.so'
libipc.a: src/communication.o src/error.o src/fs.o src/message.o src/network.o src/print.o src/usocket.o src/utils.o
libipc.a: src/communication.o src/error.o src/fs.o src/message.o src/network.o src/print.o src/usocket.o src/utils.o src/fs.h src/ipc.h src/message.h src/usocket.h src/utils.h
@echo ' LD > libipc.a'
$(Q)$(AR) rc 'libipc.a' src/communication.o src/error.o src/fs.o src/message.o src/network.o src/print.o src/usocket.o src/utils.o
@ -247,10 +187,10 @@ src/utils.o.clean:
src/utils.o.uninstall:
src:
$(Q)mkdir -p src
man:
$(Q)mkdir -p man
src:
$(Q)mkdir -p src
$(DESTDIR)$(PREFIX):
@echo ' DIR > $(PREFIX)'
$(Q)mkdir -p $(DESTDIR)$(PREFIX)
@ -269,13 +209,13 @@ $(DESTDIR)$(INCLUDEDIR):
$(DESTDIR)$(MANDIR):
@echo ' DIR > $(MANDIR)'
$(Q)mkdir -p $(DESTDIR)$(MANDIR)
install: libipc.install src/ipc.h.install src/usocket.h.install src/message.h.install src/fs.h.install src/utils.h.install man/libipc.7.install libipc.so.install libipc.a.install src/communication.o.install src/error.o.install src/fs.o.install src/message.o.install src/network.o.install src/print.o.install src/usocket.o.install src/utils.o.install src/communication.o.install src/error.o.install src/fs.o.install src/message.o.install src/network.o.install src/print.o.install src/usocket.o.install src/utils.o.install
install: libipc.install man/libipc.7.install libipc.so.install libipc.a.install src/communication.o.install src/error.o.install src/fs.o.install src/message.o.install src/network.o.install src/print.o.install src/usocket.o.install src/utils.o.install src/communication.o.install src/error.o.install src/fs.o.install src/message.o.install src/network.o.install src/print.o.install src/usocket.o.install src/utils.o.install
@:
uninstall: libipc.uninstall src/ipc.h.uninstall src/usocket.h.uninstall src/message.h.uninstall src/fs.h.uninstall src/utils.h.uninstall man/libipc.7.uninstall libipc.so.uninstall libipc.a.uninstall src/communication.o.uninstall src/error.o.uninstall src/fs.o.uninstall src/message.o.uninstall src/network.o.uninstall src/print.o.uninstall src/usocket.o.uninstall src/utils.o.uninstall src/communication.o.uninstall src/error.o.uninstall src/fs.o.uninstall src/message.o.uninstall src/network.o.uninstall src/print.o.uninstall src/usocket.o.uninstall src/utils.o.uninstall
uninstall: libipc.uninstall man/libipc.7.uninstall libipc.so.uninstall libipc.a.uninstall src/communication.o.uninstall src/error.o.uninstall src/fs.o.uninstall src/message.o.uninstall src/network.o.uninstall src/print.o.uninstall src/usocket.o.uninstall src/utils.o.uninstall src/communication.o.uninstall src/error.o.uninstall src/fs.o.uninstall src/message.o.uninstall src/network.o.uninstall src/print.o.uninstall src/usocket.o.uninstall src/utils.o.uninstall
@:
clean: libipc.clean src/ipc.h.clean src/usocket.h.clean src/message.h.clean src/fs.h.clean src/utils.h.clean man/libipc.7.clean libipc.so.clean libipc.a.clean src/communication.o.clean src/error.o.clean src/fs.o.clean src/message.o.clean src/network.o.clean src/print.o.clean src/usocket.o.clean src/utils.o.clean src/communication.o.clean src/error.o.clean src/fs.o.clean src/message.o.clean src/network.o.clean src/print.o.clean src/usocket.o.clean src/utils.o.clean
clean: libipc.clean man/libipc.7.clean libipc.so.clean libipc.a.clean src/communication.o.clean src/error.o.clean src/fs.o.clean src/message.o.clean src/network.o.clean src/print.o.clean src/usocket.o.clean src/utils.o.clean src/communication.o.clean src/error.o.clean src/fs.o.clean src/message.o.clean src/network.o.clean src/print.o.clean src/usocket.o.clean src/utils.o.clean
distclean: clean
dist: dist-gz dist-xz dist-bz2
$(Q)rm -- $(PACKAGE)-$(VERSION)
@ -288,10 +228,12 @@ dist-gz: $(PACKAGE)-$(VERSION).tar.gz
$(PACKAGE)-$(VERSION).tar.gz: distdir
@echo ' TAR > $(PACKAGE)-$(VERSION).tar.gz'
$(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \
$(PACKAGE)-$(VERSION)/libipc.so \
$(PACKAGE)-$(VERSION)/libipc.a \
$(PACKAGE)-$(VERSION)/man/libipc.7.scd \
$(PACKAGE)-$(VERSION)/man/libipc.7 \
$(PACKAGE)-$(VERSION)/Makefile \
$(PACKAGE)-$(VERSION)/project.zsh \
$(PACKAGE)-$(VERSION)/src/ipc.h \
$(PACKAGE)-$(VERSION)/man/libipc.7.scd \
$(PACKAGE)-$(VERSION)/src/communication.c \
$(PACKAGE)-$(VERSION)/src/error.c \
$(PACKAGE)-$(VERSION)/src/fs.c \
@ -300,6 +242,7 @@ $(PACKAGE)-$(VERSION).tar.gz: distdir
$(PACKAGE)-$(VERSION)/src/print.c \
$(PACKAGE)-$(VERSION)/src/usocket.c \
$(PACKAGE)-$(VERSION)/src/utils.c \
$(PACKAGE)-$(VERSION)/src/ipc.h \
$(PACKAGE)-$(VERSION)/src/fs.h \
$(PACKAGE)-$(VERSION)/src/message.h \
$(PACKAGE)-$(VERSION)/src/usocket.h \
@ -309,10 +252,12 @@ dist-xz: $(PACKAGE)-$(VERSION).tar.xz
$(PACKAGE)-$(VERSION).tar.xz: distdir
@echo ' TAR > $(PACKAGE)-$(VERSION).tar.xz'
$(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \
$(PACKAGE)-$(VERSION)/libipc.so \
$(PACKAGE)-$(VERSION)/libipc.a \
$(PACKAGE)-$(VERSION)/man/libipc.7.scd \
$(PACKAGE)-$(VERSION)/man/libipc.7 \
$(PACKAGE)-$(VERSION)/Makefile \
$(PACKAGE)-$(VERSION)/project.zsh \
$(PACKAGE)-$(VERSION)/src/ipc.h \
$(PACKAGE)-$(VERSION)/man/libipc.7.scd \
$(PACKAGE)-$(VERSION)/src/communication.c \
$(PACKAGE)-$(VERSION)/src/error.c \
$(PACKAGE)-$(VERSION)/src/fs.c \
@ -321,6 +266,7 @@ $(PACKAGE)-$(VERSION).tar.xz: distdir
$(PACKAGE)-$(VERSION)/src/print.c \
$(PACKAGE)-$(VERSION)/src/usocket.c \
$(PACKAGE)-$(VERSION)/src/utils.c \
$(PACKAGE)-$(VERSION)/src/ipc.h \
$(PACKAGE)-$(VERSION)/src/fs.h \
$(PACKAGE)-$(VERSION)/src/message.h \
$(PACKAGE)-$(VERSION)/src/usocket.h \
@ -330,10 +276,12 @@ dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2
$(PACKAGE)-$(VERSION).tar.bz2: distdir
@echo ' TAR > $(PACKAGE)-$(VERSION).tar.bz2'
$(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \
$(PACKAGE)-$(VERSION)/libipc.so \
$(PACKAGE)-$(VERSION)/libipc.a \
$(PACKAGE)-$(VERSION)/man/libipc.7.scd \
$(PACKAGE)-$(VERSION)/man/libipc.7 \
$(PACKAGE)-$(VERSION)/Makefile \
$(PACKAGE)-$(VERSION)/project.zsh \
$(PACKAGE)-$(VERSION)/src/ipc.h \
$(PACKAGE)-$(VERSION)/man/libipc.7.scd \
$(PACKAGE)-$(VERSION)/src/communication.c \
$(PACKAGE)-$(VERSION)/src/error.c \
$(PACKAGE)-$(VERSION)/src/fs.c \
@ -342,13 +290,14 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
$(PACKAGE)-$(VERSION)/src/print.c \
$(PACKAGE)-$(VERSION)/src/usocket.c \
$(PACKAGE)-$(VERSION)/src/utils.c \
$(PACKAGE)-$(VERSION)/src/ipc.h \
$(PACKAGE)-$(VERSION)/src/fs.h \
$(PACKAGE)-$(VERSION)/src/message.h \
$(PACKAGE)-$(VERSION)/src/usocket.h \
$(PACKAGE)-$(VERSION)/src/utils.h
help:
@echo ' :: ipc-0.5.1'
@echo ' :: libipc-0.5.1'
@echo ''
@echo 'Generic targets:'
@echo ' - help  Prints this help message.'
@ -374,11 +323,6 @@ help:
@echo ''
@echo 'Project targets: '
@echo ' - libipc  library'
@echo ' - src/ipc.h  header'
@echo ' - src/usocket.h  header'
@echo ' - src/message.h  header'
@echo ' - src/fs.h  header'
@echo ' - src/utils.h  header'
@echo ' - man/libipc.7  scdocman'
@echo ''
@echo 'Makefile options:'

View File

@ -1,21 +1,31 @@
package=ipc
version=0.5.1
package=libipc # Package name.
version=0.5.1 # Package version.
# Our targets are the library and its documentation.
targets=(libipc man/libipc.7)
# The libipc target is a library ("for the C language" is implied).
# The `library` type automatically adds tho targets:
# `target`.so of type `sharedlib`
# `target`.a of type `staticlib`
type[libipc]=library
# Sources are added by default to the tarball.
sources[libipc]="$(ls src/*.c)"
depends[libipc]=$(ls src/*.h)
# We need to add extra compilation flags.
variables+=(CFLAGS "-Wall -Wextra -g")
targets=(libipc src/ipc.h src/usocket.h src/message.h src/fs.h src/utils.h man/libipc.7)
type[libipc]=library
sources[libipc]="$(ls src/*.c)"
# Let's add some CFLAGS, with another syntax.
cflags[libipc]="-std=c11"
type[src/ipc.h]=header
type[src/usocket.h]=header
type[src/message.h]=header
type[src/fs.h]=header
type[src/utils.h]=header
# The man/libipc.7 target is a manual generated with `scdoc`.
# `scdocman` is one of the many back-ends of build.zsh: https://git.baguette.netlib.re/Baguette/build.zsh
type[man/libipc.7]=scdocman
dist=(Makefile project.zsh src/ipc.h man/*.scd)
# Finally, we tell what we want in the tarball, generated with `make dist`.
dist=(libipc.so libipc.a) # The library in both shared and static versions.
dist+=(man/*.scd man/*.[1-9]) # Manual pages (and sources).
dist+=(Makefile project.zsh) # The generated Makefile and this project.zsh.