projects/sencrypt

annotate Makefile @ 21:5f9dc8f3c53e

Release version 3
author Guido Berhoerster <guido+sencrypt@berhoerster.name>
date Mon Aug 05 11:19:02 2019 +0200 (2019-08-05)
parents 0bd16b428fc0
children 110b3a7a40c2
rev   line source
guido+sencrypt@0 1 #
guido+sencrypt@0 2 # Copyright (C) 2014 Guido Berhoerster <guido+sencrypt@berhoerster.name>
guido+sencrypt@0 3 #
guido+sencrypt@0 4 # Permission is hereby granted, free of charge, to any person obtaining
guido+sencrypt@0 5 # a copy of this software and associated documentation files (the
guido+sencrypt@0 6 # "Software"), to deal in the Software without restriction, including
guido+sencrypt@0 7 # without limitation the rights to use, copy, modify, merge, publish,
guido+sencrypt@0 8 # distribute, sublicense, and/or sell copies of the Software, and to
guido+sencrypt@0 9 # permit persons to whom the Software is furnished to do so, subject to
guido+sencrypt@0 10 # the following conditions:
guido+sencrypt@0 11 #
guido+sencrypt@0 12 # The above copyright notice and this permission notice shall be included
guido+sencrypt@0 13 # in all copies or substantial portions of the Software.
guido+sencrypt@0 14 #
guido+sencrypt@0 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
guido+sencrypt@0 16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
guido+sencrypt@0 17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
guido+sencrypt@0 18 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
guido+sencrypt@0 19 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
guido+sencrypt@0 20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
guido+sencrypt@0 21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
guido+sencrypt@0 22 #
guido+sencrypt@0 23
guido+sencrypt@0 24 PACKAGE = sencrypt
guido+sencrypt@21 25 VERSION = 3
guido+sencrypt@0 26 DISTNAME := $(PACKAGE)-$(VERSION)
guido+sencrypt@0 27 DECRYPT_ALIAS = sdecrypt
guido+sencrypt@0 28
guido+sencrypt@12 29 # gcc, clang, icc, Sun/Solaris Studio
guido+sencrypt@12 30 CC := $(CC) -std=c99
guido+sencrypt@0 31 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c
guido+sencrypt@0 32 # gcc, clang, icc
guido+sencrypt@0 33 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS)
guido+sencrypt@0 34 # Sun/Solaris Studio
guido+sencrypt@0 35 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS)
guido+sencrypt@0 36 # X makedepend
guido+sencrypt@0 37 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) --
guido+sencrypt@0 38 LINK.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
guido+sencrypt@0 39 LINK.o = $(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
guido+sencrypt@13 40 CP := cp
guido+sencrypt@0 41 INSTALL := install
guido+sencrypt@0 42 INSTALL.exec := $(INSTALL) -D -m 0755
guido+sencrypt@0 43 INSTALL.data := $(INSTALL) -D -m 0644
guido+sencrypt@13 44 INSTALL.link := $(CP) -f -P
guido+sencrypt@0 45 PAX := pax
guido+sencrypt@0 46 GZIP := gzip
guido+sencrypt@0 47 SED := sed
guido+sencrypt@1 48 XSLTPROC := xsltproc
guido+sencrypt@1 49 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
guido+sencrypt@13 50 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
guido+sencrypt@13 51 --stringparam man.copyright.section.enabled 0
guido+sencrypt@1 52
guido+sencrypt@1 53 define generate-manpage-rule =
guido+sencrypt@13 54 $(addsuffix .%,$(basename $1)): $(addsuffix .%.xml,$(basename $(firstword $1))) docbook-update-source-data.xsl
guido+sencrypt@1 55 $$(XSLTPROC) \
guido+sencrypt@1 56 --xinclude \
guido+sencrypt@1 57 --stringparam package $$(PACKAGE) \
guido+sencrypt@13 58 --stringparam version $$(VERSION) \
guido+sencrypt@1 59 docbook-update-source-data.xsl $$< | \
guido+sencrypt@1 60 $$(XSLTPROC) \
guido+sencrypt@1 61 --xinclude \
guido+sencrypt@13 62 --output $(firstword $1) \
guido+sencrypt@1 63 $$(DOCBOOK5_MANPAGES_FLAGS) \
guido+sencrypt@1 64 $$(DOCBOOK5_MANPAGES_STYLESHEET) \
guido+sencrypt@1 65 -
guido+sencrypt@13 66 for alias in $(wordlist 2,$(words $1),$1); do \
guido+sencrypt@13 67 ln -sf $(notdir $(firstword $1)) $$$$alias; \
guido+sencrypt@13 68 done
guido+sencrypt@1 69 endef
guido+sencrypt@0 70
guido+sencrypt@0 71 DESTDIR ?=
guido+sencrypt@0 72 prefix ?= /usr/local
guido+sencrypt@0 73 bindir ?= $(prefix)/bin
guido+sencrypt@0 74 datadir ?= $(prefix)/share
guido+sencrypt@1 75 mandir ?= $(datadir)/man
guido+sencrypt@0 76
guido+sencrypt@12 77 OS_NAME := $(shell uname -s)
guido+sencrypt@12 78 OS_RELEASE := $(shell uname -r)
guido+sencrypt@12 79
guido+sencrypt@12 80 ifneq ($(findstring $(OS_NAME),Linux FreeBSD DragonFly NetBSD OpenBSD),)
guido+sencrypt@12 81 HAVE_ERR_H ?= 1
guido+sencrypt@12 82 else ifeq ($(OS_NAME),SunOS)
guido+sencrypt@12 83 ifeq ($(OS_RELEASE),5.10)
guido+sencrypt@12 84 HAVE_ERR_H ?= 0
guido+sencrypt@12 85 else
guido+sencrypt@12 86 HAVE_ERR_H ?= 1
guido+sencrypt@12 87 endif
guido+sencrypt@17 88 else ifeq ($(OS_NAME),AIX)
guido+sencrypt@17 89 HAVE_ERR_H ?= 0
guido+sencrypt@12 90 endif
guido+sencrypt@0 91
guido+sencrypt@0 92 OBJS = sencrypt.o
guido+sencrypt@13 93
guido+sencrypt@1 94 MANPAGES = $(PACKAGE).1 $(DECRYPT_ALIAS).1
guido+sencrypt@0 95
guido+sencrypt@0 96 .DEFAULT_TARGET = all
guido+sencrypt@0 97
guido+sencrypt@0 98 .PHONY: all clean clobber dist install
guido+sencrypt@0 99
guido+sencrypt@12 100 all: $(PACKAGE) $(OBJS) $(MANPAGES)
guido+sencrypt@0 101
guido+sencrypt@12 102 $(PACKAGE): XCPPFLAGS = -D_XOPEN_SOURCE=600 -DOPENSSL_LOAD_CONF
guido+sencrypt@14 103 $(PACKAGE): XCFLAGS := $(shell getconf LFS_CFLAGS)
guido+sencrypt@14 104 $(PACKAGE): LDLIBS := -lcrypto
guido+sencrypt@14 105 $(PACKAGE): XLDFLAGS := $(shell getconf LFS_LDFLAGS)
guido+sencrypt@0 106 ifeq ($(HAVE_ERR_H),1)
guido+sencrypt@12 107 $(PACKAGE): XCPPFLAGS += -DHAVE_ERR_H
guido+sencrypt@12 108 else
guido+sencrypt@12 109 OBJS += err.o
guido+sencrypt@0 110 endif
guido+sencrypt@14 111 ifeq ($(OS_NAME),SunOS)
guido+sencrypt@14 112 $(PACKAGE): XCPPFLAGS += -I/usr/xpg4/include
guido+sencrypt@14 113 $(PACKAGE): XLDFLAGS += -L/usr/xpg4/lib -R/usr/xpg4/lib
guido+sencrypt@14 114 endif
guido+sencrypt@0 115 $(PACKAGE): $(OBJS)
guido+sencrypt@0 116 $(LINK.o) $^ $(LDLIBS) -o $@
guido+sencrypt@0 117
guido+sencrypt@13 118 $(eval $(call generate-manpage-rule,$(MANPAGES)))
guido+sencrypt@1 119
guido+sencrypt@0 120 %.o: %.c
guido+sencrypt@0 121 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
guido+sencrypt@0 122 $(COMPILE.c) -o $@ $<
guido+sencrypt@0 123
guido+sencrypt@0 124 install:
guido+sencrypt@0 125 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
guido+sencrypt@0 126 ln -f $(PACKAGE) "$(DESTDIR)$(bindir)/$(DECRYPT_ALIAS)"
guido+sencrypt@1 127 for manpage in $(MANPAGES); do \
guido+sencrypt@13 128 if [ -L $${manpage} ]; then \
guido+sencrypt@13 129 $(INSTALL.link) $${manpage} \
guido+sencrypt@13 130 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
guido+sencrypt@13 131 else \
guido+sencrypt@13 132 $(INSTALL.data) $${manpage} \
guido+sencrypt@13 133 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
guido+sencrypt@13 134 fi \
guido+sencrypt@1 135 done
guido+sencrypt@0 136
guido+sencrypt@0 137 clean:
guido+sencrypt@1 138 rm -f $(PACKAGE) $(OBJS) $(MANPAGES)
guido+sencrypt@0 139
guido+sencrypt@0 140 clobber: clean
guido+sencrypt@0 141 rm -f $(patsubst %.o,%.d,$(OBJS))
guido+sencrypt@0 142
guido+sencrypt@0 143 dist: clobber
guido+sencrypt@0 144 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \
guido+sencrypt@11 145 -s ',^\.$$,,' -s ',\./,$(DISTNAME)/,' . | \
guido+sencrypt@11 146 $(GZIP) > $(DISTNAME).tar.gz
guido+sencrypt@0 147
guido+sencrypt@19 148 -include local.mk
guido+sencrypt@19 149
guido+sencrypt@0 150 -include $(patsubst %.o,%.d,$(OBJS))