annotate Makefile @ 0:73af139d1a94

Initial revision
author Guido Berhoerster <guido+sencrypt@berhoerster.name>
date Tue, 28 Jan 2014 19:23:16 +0100
parents
children f0ceb0ad20e7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
1 #
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
2 # Copyright (C) 2014 Guido Berhoerster <guido+sencrypt@berhoerster.name>
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
3 #
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
4 # Permission is hereby granted, free of charge, to any person obtaining
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
5 # a copy of this software and associated documentation files (the
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
6 # "Software"), to deal in the Software without restriction, including
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
7 # without limitation the rights to use, copy, modify, merge, publish,
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
8 # distribute, sublicense, and/or sell copies of the Software, and to
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
9 # permit persons to whom the Software is furnished to do so, subject to
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
10 # the following conditions:
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
11 #
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
12 # The above copyright notice and this permission notice shall be included
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
13 # in all copies or substantial portions of the Software.
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
14 #
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
18 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
19 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
22 #
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
23
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
24 PACKAGE = sencrypt
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
25 VERSION = 1
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
26 DISTNAME := $(PACKAGE)-$(VERSION)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
27 DECRYPT_ALIAS = sdecrypt
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
28
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
29 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
30 # gcc, clang, icc
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
31 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
32 # Sun/Solaris Studio
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
33 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
34 # X makedepend
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
35 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) --
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
36 LINK.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
37 LINK.o = $(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
38 INSTALL := install
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
39 INSTALL.exec := $(INSTALL) -D -m 0755
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
40 INSTALL.data := $(INSTALL) -D -m 0644
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
41 PAX := pax
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
42 GZIP := gzip
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
43 SED := sed
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
44
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
45 DESTDIR ?=
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
46 prefix ?= /usr/local
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
47 bindir ?= $(prefix)/bin
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
48 datadir ?= $(prefix)/share
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
49
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
50 HAVE_ERR_H ?= 1
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
51
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
52 OBJS = sencrypt.o
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
53
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
54 ifeq ($(HAVE_ERR_H),0)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
55 OBJS += err.o
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
56 endif
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
57
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
58 .DEFAULT_TARGET = all
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
59
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
60 .PHONY: all clean clobber dist install
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
61
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
62 all: $(PACKAGE)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
63
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
64 $(PACKAGE): XCPPFLAGS := -DOPENSSL_LOAD_CONF
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
65 ifeq ($(HAVE_ERR_H),1)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
66 $(PACKAGE): XCPPFLAGS += -DHAVE_ERR_H
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
67 endif
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
68 $(PACKAGE): XCFLAGS := $(shell getconf LFS_CFLAGS)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
69 $(PACKAGE): LDLIBS := -lcrypto
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
70 $(PACKAGE): XLDFLAGS := $(shell getconf LFS_LDFLAGS)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
71 $(PACKAGE): $(OBJS)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
72 $(LINK.o) $^ $(LDLIBS) -o $@
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
73
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
74 %.o: %.c
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
75 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
76 $(COMPILE.c) -o $@ $<
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
77
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
78 install:
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
79 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
80 ln -f $(PACKAGE) "$(DESTDIR)$(bindir)/$(DECRYPT_ALIAS)"
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
81
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
82 clean:
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
83 rm -f $(PACKAGE) $(OBJS)
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
84
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
85 clobber: clean
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
86 rm -f $(patsubst %.o,%.d,$(OBJS))
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
87
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
88 dist: clobber
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
89 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
90 -s ',\./,$(DISTNAME)/,' . | $(GZIP) > $(DISTNAME).tar.gz
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
91
73af139d1a94 Initial revision
Guido Berhoerster <guido+sencrypt@berhoerster.name>
parents:
diff changeset
92 -include $(patsubst %.o,%.d,$(OBJS))