-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_makefile
114 lines (89 loc) · 3.48 KB
/
_makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# -*- makefile -*-
##
# make-variant-agnostic makefile invoked by both BSD and GNU make.
# no non-agnostic constructs should be in this file.
#
# the text between ##+ and ##- is spit out by the "help" target:
##+
# The following targets are useful:
# help produce this message
# all build stuff
# install install everything but desktop into $(PREFIX)
# clean clean up temp files
# distclean clean + reset to virgin state
# dist cook dist-version.tar.gz tarball
##-
BINARIES=osdhud
MAKESYS?=GNUmakefile BSDmakefile _makefile bsd gnu generic configure
SUDIRS?=
MANSECT?=1
MANEXT?=$(MANSECT)
## Can be set per-OS
MANSRC?=osdhud.mandoc
MANPAGE?=osdhud.$(MANEXT)
DOCS?=$(MANSRC)
FILES?=osdhud.c freebsd.c openbsd.c osdhud.h $(DOCS)
DIST_NAME?=$(PACKAGE_NAME)
DIST_TMP?=$(DIST_NAME)-$(DIST_VERS)
DIST_LIST?=PACKAGE VERSION *.md *.in $(MAKESYS) $(SUBDIRS) $(FILES)
DIST_TAR?=$(DIST_NAME)-$(DIST_VERS).tar
DIST_TAR_GZ?=$(DIST_TAR).gz
DOC_EPHEM?=README.aux README.glo README.idx README.ist README.log README.out README.tex README.pdf README.toc $(MANPAGE)
default: all
help::
@$(SED) -e '1,/^##+/d' -e '/^##-/,$$d' -e 's/^# //' < _makefile
@$(ECHO) Install prefix: $(PREFIX) '(override with PREFIX=... on command-line)'
@$(ECHO) ' bin dir: ' $(BINDIR)
@$(ECHO) ' man dir: ' $(MANDIR)
all:: $(BINARIES) man-page
osdhud: osdhud.o movavg.o $(UNAME).o
$(CC) $(LDFLAGS) -o $@ osdhud.o movavg.o $(UNAME).o $(LIBS)
## My thinking here is that I'm just going to go with OpenBSD mandoc
## since osdhud is so far only really usable under OpenBSD. I would
## like to explore writing manuals in multimarkdown and producing
## mandoc output but it doesn't seem like the tools that exist right
## now are that great there... a lot of mandoc features are not
## accessible this way, or maybe I'm missing something.
##
## osdhud.mandoc therefore is just a straight mandoc source file,
## unashamedly OpenBSD-specific. I'm writing that way to get
## experience with how to use mandoc well. Since I want @VERSION@
## expanded in the final osdhud.1 I'll use my Perl keyword expander to
## do that. If I have to write man pages for other OSes then I'll try
## doing something in mmd and translating to nroff -man. I could then
## take the opportunity to see how hard it would be to go the extra
## mile to mandoc that is equivalent to the hand-written mandoc file.
MANIFY?=$(SUSS) VERSION=$(VERSION)
man-page:: $(MANPAGE)
$(MANPAGE):: $(MANSRC) VERSION
$(MANIFY) < $(MANSRC) > $(MANPAGE)
WEBFILES=web/osdhud.html web/osdhud.pdf
web: $(WEBFILES)
web/osdhud.html: osdhud.1
$(MANDOC) -T html osdhud.1 > $@
web/osdhud.pdf: osdhud.1
$(MANDOC) -T pdf osdhud.1 > $@
osdhud.o: osdhud.c osdhud.h movavg.h config.h version.h
movavg.o: movavg.h
# config.h doesn't need to be regenerated normally
version.h: version.h.in VERSION
$(SUSS) -file=version.h VERSION=$(VERSION)
$(UNAME).o: $(UNAME).c osdhud.h movavg.h
.c.o:
$(CC) -c $(CFLAGS) -o $@ $<
install:: all
$(INSTALL_X) $(BINARIES) $(BINDIR)
$(INSTALL) $(MANPAGE) $(MANDIR)/man$(MANEXT)/
clean::
$(RM) -f osdhud.o movavg.o $(UNAME).o osdhud version.h $(DOC_EPHEM)
distclean:: clean
$(RM) -f $(DIST_TAR) $(DIST_TAR_GZ) Makefile config.h config.mk
$(RM) -rf $(DIST_TMP)
dist: distclean $(DIST_TAR_GZ)
$(DIST_TAR): $(DIST_TMP)
$(TAR_CF) $(DIST_TAR) $(DIST_TMP)
$(DIST_TAR_GZ): $(DIST_TAR)
$(GZIP) $(DIST_TAR)
$(DIST_TMP):
$(MKDIR) -p $(DIST_TMP)
($(TAR_CF) - $(DIST_LIST)) | (cd $(DIST_TMP); $(TAR_XF) -)