comparison Makefile @ 0:73af139d1a94

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