Mercurial > projects > pwm
annotate Makefile @ 17:a08ef0674d8e
Page long output in interactive mode
author | Guido Berhoerster <guido+pwm@berhoerster.name> |
---|---|
date | Sat, 12 Aug 2017 10:41:52 +0200 |
parents | 8768fbd09bc5 |
children | 1e39a251cbe9 |
rev | line source |
---|---|
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
1 # |
6
4269feba381e
Ensure everything is built before installing
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
1
diff
changeset
|
2 # Copyright (C) 2017 Guido Berhoerster <guido+pwm@berhoerster.name> |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
3 # |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
4 # Permission is hereby granted, free of charge, to any person obtaining |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
5 # a copy of this software and associated documentation files (the |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
6 # "Software"), to deal in the Software without restriction, including |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
7 # without limitation the rights to use, copy, modify, merge, publish, |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
8 # distribute, sublicense, and/or sell copies of the Software, and to |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
9 # permit persons to whom the Software is furnished to do so, subject to |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
10 # the following conditions: |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
11 # |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
12 # The above copyright notice and this permission notice shall be included |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
13 # in all copies or substantial portions of the Software. |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
14 # |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
18 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
19 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
22 # |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
23 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
24 PACKAGE = pwm |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
25 VERSION = 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
26 DISTNAME := $(PACKAGE)-$(VERSION) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
27 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
28 # gcc, clang, icc, Sun/Solaris Studio |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
29 CC := $(CC) -std=c99 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
30 COMPILE.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(TARGET_ARCH) -c |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
31 # gcc, clang, icc |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
32 MAKEDEPEND.c = $(CC) -MM $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
33 # Sun/Solaris Studio |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
34 #MAKEDEPEND.c = $(CC) -xM1 $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
35 # X makedepend |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
36 #MAKEDEPEND.c = makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) -- |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
37 LINK.c = $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
38 LINK.o = $(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
39 CP := cp |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
40 INSTALL := install |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
41 INSTALL.exec := $(INSTALL) -D -m 0755 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
42 INSTALL.data := $(INSTALL) -D -m 0644 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
43 INSTALL.link := $(CP) -f -P |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
44 PAX := pax |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
45 GZIP := gzip |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
46 SED := sed |
1
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
47 XSLTPROC := xsltproc |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
48 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
49 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
50 --stringparam man.copyright.section.enabled 0 |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
51 |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
52 define generate-manpage-rule = |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
53 $(addsuffix .%,$(basename $1)): $(addsuffix .%.xml,$(basename $(firstword $1))) docbook-update-source-data.xsl |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
54 $$(XSLTPROC) \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
55 --xinclude \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
56 --stringparam package $$(PACKAGE) \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
57 --stringparam version $$(VERSION) \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
58 docbook-update-source-data.xsl $$< | \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
59 $$(XSLTPROC) \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
60 --xinclude \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
61 --output $(firstword $1) \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
62 $$(DOCBOOK5_MANPAGES_FLAGS) \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
63 $$(DOCBOOK5_MANPAGES_STYLESHEET) \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
64 - |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
65 for alias in $(wordlist 2,$(words $1),$1); do \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
66 ln -sf $(notdir $(firstword $1)) $$$$alias; \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
67 done |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
68 endef |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
69 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
70 DESTDIR ?= |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
71 prefix ?= /usr/local |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
72 bindir ?= $(prefix)/bin |
1
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
73 datadir ?= $(prefix)/share |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
74 mandir ?= $(datadir)/man |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
75 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
76 OS_NAME := $(shell uname -s) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
77 OS_RELEASE := $(shell uname -r) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
78 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
79 ifeq ($(OS_NAME),Linux) |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
80 HAVE_ARC4RANDOM ?= 0 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
81 HAVE_ASPRINTF ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
82 HAVE_ERR_H ?= 1 |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
83 HAVE_GETRANDOM ?= 0 |
17
a08ef0674d8e
Page long output in interactive mode
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
12
diff
changeset
|
84 HAVE_SYS_QUEUE_H ?= 0 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
85 HAVE_READPASSPHRASE_H ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
86 HAVE_SETPROGNAME ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
87 HAVE_SYS_TREE_H ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
88 else ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly),) |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
89 HAVE_ARC4RANDOM ?= 1 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
90 HAVE_ASPRINTF ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
91 HAVE_ERR_H ?= 1 |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
92 HAVE_GETRANDOM ?= 0 |
17
a08ef0674d8e
Page long output in interactive mode
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
12
diff
changeset
|
93 HAVE_SYS_QUEUE_H ?= 1 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
94 HAVE_READPASSPHRASE_H ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
95 HAVE_SETPROGNAME ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
96 HAVE_SYS_TREE_H ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
97 else ifeq ($(OS_NAME),NetBSD) |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
98 HAVE_ARC4RANDOM ?= 1 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
99 HAVE_ASPRINTF ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
100 HAVE_ERR_H ?= 1 |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
101 HAVE_GETRANDOM ?= 0 |
17
a08ef0674d8e
Page long output in interactive mode
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
12
diff
changeset
|
102 HAVE_SYS_QUEUE_H ?= 1 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
103 HAVE_READPASSPHRASE_H ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
104 HAVE_SYS_TREE_H ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
105 HAVE_SETPROGNAME ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
106 else ifeq ($(OS_NAME),OpenBSD) |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
107 HAVE_ARC4RANDOM ?= 1 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
108 HAVE_ASPRINTF ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
109 HAVE_ERR_H ?= 1 |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
110 HAVE_GETRANDOM ?= 0 |
17
a08ef0674d8e
Page long output in interactive mode
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
12
diff
changeset
|
111 HAVE_SYS_QUEUE_H ?= 1 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
112 HAVE_READPASSPHRASE_H ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
113 HAVE_SYS_TREE_H ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
114 HAVE_SETPROGNAME ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
115 else ifeq ($(OS_NAME),SunOS) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
116 ifeq ($(OS_RELEASE),5.10) |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
117 HAVE_ARC4RANDOM ?= 0 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
118 HAVE_ASPRINTF ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
119 HAVE_ERR_H ?= 0 |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
120 HAVE_GETRANDOM ?= 0 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
121 else |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
122 HAVE_ARC4RANDOM ?= 1 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
123 HAVE_ASPRINTF ?= 1 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
124 HAVE_ERR_H ?= 1 |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
125 HAVE_GETRANDOM ?= 1 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
126 endif |
17
a08ef0674d8e
Page long output in interactive mode
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
12
diff
changeset
|
127 HAVE_SYS_QUEUE_H ?= 0 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
128 HAVE_READPASSPHRASE_H ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
129 HAVE_SYS_TREE_H ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
130 HAVE_SETPROGNAME ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
131 else |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
132 HAVE_ARC4RANDOM ?= 0 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
133 HAVE_ASPRINTF ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
134 HAVE_ERR_H ?= 0 |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
135 HAVE_GETRANDOM ?= 0 |
17
a08ef0674d8e
Page long output in interactive mode
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
12
diff
changeset
|
136 HAVE_SYS_QUEUE_H ?= 0 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
137 HAVE_READPASSPHRASE_H ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
138 HAVE_SETPROGNAME ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
139 HAVE_SYS_TREE_H ?= 0 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
140 endif |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
141 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
142 OBJS = cmd.o \ |
17
a08ef0674d8e
Page long output in interactive mode
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
12
diff
changeset
|
143 pager.o \ |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
144 pw.o \ |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
145 pwfile.o \ |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
146 pwm.o \ |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
147 tok.o \ |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
148 util.o |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
149 |
1
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
150 MANPAGES = pwm.1 |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
151 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
152 .DEFAULT_TARGET = all |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
153 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
154 .PHONY: all clean clobber dist install |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
155 |
1
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
156 all: $(PACKAGE) $(MANPAGES) |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
157 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
158 XCPPFLAGS = -DPACKAGE=\"$(PACKAGE)\" \ |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
159 -DVERSION=\"$(VERSION)\" |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
160 LDLIBS = -lpws -lnettle |
8
25e227eba3da
Fix asprintf compatibility code
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
6
diff
changeset
|
161 ifeq ($(HAVE_ASPRINTF),1) |
25e227eba3da
Fix asprintf compatibility code
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
6
diff
changeset
|
162 XCPPFLAGS += -DHAVE_ASPRINTF |
25e227eba3da
Fix asprintf compatibility code
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
6
diff
changeset
|
163 else |
25e227eba3da
Fix asprintf compatibility code
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
6
diff
changeset
|
164 OBJS += compat/asprintf.o |
25e227eba3da
Fix asprintf compatibility code
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
6
diff
changeset
|
165 endif |
12
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
166 ifeq ($(HAVE_ARC4RANDOM),1) |
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
167 XCPPFLAGS += -DHAVE_ARC4RANDOM |
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
168 OBJS += rand-arc4random.o |
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
169 else ifeq ($(HAVE_GETRANDOM),1) |
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
170 XCPPFLAGS += -DHAVE_GETRANDOM |
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
171 OBJS += rand-getrandom.o |
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
172 else |
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
173 OBJS += rand-dev-random.o |
8768fbd09bc5
Add generatepassword command to generate random passwords
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
8
diff
changeset
|
174 endif |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
175 ifeq ($(HAVE_ERR_H),1) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
176 XCPPFLAGS += -DHAVE_ERR_H |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
177 else |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
178 OBJS += compat/err.o |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
179 endif |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
180 ifeq ($(HAVE_READPASSPHRASE_H),1) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
181 XCPPFLAGS += -DHAVE_READPASSPHRASE_H |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
182 else |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
183 OBJS += compat/readpassphrase.o |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
184 endif |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
185 ifeq ($(HAVE_SETPROGNAME),1) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
186 XCPPFLAGS += -DHAVE_SETPROGNAME |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
187 else |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
188 OBJS += compat/setprogname.o |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
189 endif |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
190 ifeq ($(HAVE_SYS_TREE_H),1) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
191 XCPPFLAGS += -DHAVE_SYS_TREE_H |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
192 endif |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
193 ifneq ($(findstring $(OS_NAME),FreeBSD DragonFly OpenBSD),) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
194 XCPPFLAGS += -I/usr/local/include |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
195 XLDFLAGS += -L/usr/local/lib |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
196 else ifeq ($(OS_NAME),NetBSD) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
197 XCPPFLAGS += -I/usr/pkg/include |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
198 XLDFLAGS += -L/usr/pkg/lib |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
199 endif |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
200 ifeq ($(findstring $(OS_NAME),FreeBSD DragonFly NetBSD OpenBSD),) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
201 XCPPFLAGS += -D_XOPEN_SOURCE=600 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
202 endif |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
203 ifeq ($(OS_NAME),SunOS) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
204 XCPPFLAGS += -I/usr/xpg4/include -D__EXTENSIONS__ |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
205 XLDFLAGS += -L/usr/xpg4/lib -R/usr/xpg4/lib |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
206 endif |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
207 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
208 $(PACKAGE): $(OBJS) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
209 $(LINK.o) $^ $(LDLIBS) -o $@ |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
210 |
1
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
211 $(eval $(call generate-manpage-rule,$(MANPAGES))) |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
212 |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
213 %.o: %.c |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
214 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
215 $(COMPILE.c) -o $@ $< |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
216 |
6
4269feba381e
Ensure everything is built before installing
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
1
diff
changeset
|
217 install: all |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
218 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)" |
1
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
219 for manpage in $(MANPAGES); do \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
220 if [ -L $${manpage} ]; then \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
221 $(INSTALL.link) $${manpage} \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
222 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
223 else \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
224 $(INSTALL.data) $${manpage} \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
225 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
226 fi \ |
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
227 done |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
228 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
229 clean: |
1
55281f14dc9b
Add README file and manpage
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
0
diff
changeset
|
230 rm -f $(PACKAGE) $(OBJS) $(MANPAGES) |
0
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
231 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
232 clobber: clean |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
233 rm -f $(patsubst %.o,%.d,$(OBJS)) |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
234 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
235 dist: clobber |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
236 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \ |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
237 -s ',^\.$$,,' -s ',\./,$(DISTNAME)/,' . | \ |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
238 $(GZIP) > $(DISTNAME).tar.gz |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
239 |
a7e41e1a79c8
Initial revision
Guido Berhoerster <guido+pwm@berhoerster.name>
parents:
diff
changeset
|
240 -include $(patsubst %.o,%.d,$(OBJS)) |