1 # Copyright (c) 2014, 2015 Bert Burgemeister <trebbu@googlemail.com>
3 # Permission is hereby granted, free of charge, to any person
4 # obtaining a copy of this software and associated documentation files
5 # (the "Software"), to deal in the Software without restriction,
6 # including without limitation the rights to use, copy, modify, merge,
7 # publish, distribute, sublicense, and/or sell copies of the Software,
8 # and to permit persons to whom the Software is furnished to do so,
9 # subject to the following conditions:
11 # The above copyright notice and this permission notice shall be
12 # included in all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 CCFLAGS
+= -Wall
-Wextra
-pedantic
-g
26 # Suppressing warning: named variadic macros are a GNU extension
27 # in /usr/local/include/X11/Xfuncproto.h:157:24:
28 CCFLAGS
+= -Wno-variadic-macros
30 CCFLAGS
+= -D_POSIX_C_SOURCE
=200809L
31 CCFLAGS
+= -D_XOPEN_SOURCE
=700
32 CCFLAGS
+= `pkg-config --cflags --libs gtk+-3.0 gmodule-2.0`
33 CCFLAGS
+= `pkg-config --cflags --libs gtk+-unix-print-3.0`
39 pipeglade
: pipeglade.c Makefile
40 $(CC
) $< -o
$@
$(CCFLAGS
)
42 install: pipeglade pipeglade
.1
43 mkdir
-p
$(PREFIX
)/bin
/
44 mkdir
-p
$(PREFIX
)/man
/man1
/
45 cp
-f pipeglade
$(PREFIX
)/bin
/
46 chmod
755 $(PREFIX
)/bin
/pipeglade
47 gzip
-c pipeglade
.1 > $(PREFIX
)/man
/man1
/pipeglade
.1.gz
48 chmod
644 $(PREFIX
)/man
/man1
/pipeglade
.1.gz
51 rm -f
$(PREFIX
)/bin
/pipeglade
52 rm -f
$(PREFIX
)/man
/man1
/pipeglade
.1.gz
58 .PHONY
: install uninstall clean
62 # Build targets end here. The rest of this Makefile is only useful
63 # for project maintenance.
65 # It works with FreeBSD's version of make (aka pmake). It won't work
67 ######################################################################
68 VERSION
!= (which git
>/dev
/null
&& git describe
--tags || echo
"NONE") | cut
-d
"-" -f
1
69 CODE_VERSION
!= awk
'/\#define VERSION/{print $$3}' pipeglade.c | tr
-d
'"'
70 NEWS_VERSION
!= awk
'/^[0-9]+.[0-9]+.[0-9]+ .*(.+)/{print $$1}' NEWS | head
-n1
71 NEWS_DATE
!= awk
'/^[0-9]+.[0-9]+.[0-9]+ .*(.+)/{print substr($$2, 2, 10)}' NEWS | head
-n1
73 MANPAGE_DATE
!= grep
"^\.Dd " pipeglade
.1
74 MANPAGE_TODAY
!= date
'+.Dd %B %e, %Y' | awk
'{print $$1, $$2, $$3, $$4}'
76 # Prepare the www directory
77 gh-pages
: gh-pages
/index.html gh-pages
/pipeglade
.1.html gh-pages
/clock.png
79 gh-pages
/index.html gh-pages
/pipeglade
.1.html
: pipeglade
.1 www-template
/index.html Makefile
81 cp www-template
/* gh-pages
/
82 cp clock.sh gh-pages
/clock.sh.txt
83 cp clock.ui gh-pages
/clock.ui.txt
84 mandoc
-T html
-O style
=style.css pipeglade
.1 > gh-pages
/pipeglade
.1.html
85 mandoc
-T pdf
-O paper
=a4 pipeglade
.1 > gh-pages
/pipeglade
.1.pdf
87 echo
-e
'/@/\ns/</\</\ns/>/\>/\n,s/^$$/<p>/\nwq' | ed
-s gh-pages
/LICENSE
88 echo
-e
'/<!-- replace_with_license_text -->/d\n-r gh-pages/LICENSE\nwq' | ed
-s gh-pages
/index.html
89 echo
-e
',s/_PUT_VERSION_HERE_/$(VERSION)/g\nwq' | ed
-s gh-pages
/index.html
90 echo
-e
'/<\/body>/-r gh-pages/statcounter.html\nwq' | ed
-s gh-pages
/index.html
91 echo
-e
'/<\/body>/-r gh-pages/statcounter.html\nwq' | ed
-s gh-pages
/pipeglade
.1.html
92 echo
-e
'/<\/body>/-r gh-pages/statcounter.html\nwq' | ed
-s gh-pages
/404.html
93 rm -f gh-pages
/statcounter.html gh-pages
/LICENSE
95 gh-pages
/clock.png
: clock.sh clock.ui pipeglade
99 import
-frame
-window pipeglade-clock gh-pages
/clock.png
101 # Create a new git tag only if there is a NEWS headline in the format
103 # where 1.2.3 matches the current pipeglade version and the date is of
104 # today, and if pipeglade.1 has today's date in its .Dd line.
105 # (NEWS headlines are lines that start at column 0.)
107 if
test "$(NEWS_DATE)" != "$(TODAY)"; then \
108 echo
"NEWS: $(NEWS_DATE) != $(TODAY)"; false
; \
110 if
test "$(NEWS_VERSION)" != "$(CODE_VERSION)"; then \
111 echo
"NEWS: $(NEWS_VERSION) != $(CODE_VERSION)"; false
; \
113 if
test "$(MANPAGE_DATE)" != "$(MANPAGE_TODAY)"; then \
114 echo
"MANPAGE: $(MANPAGE_DATE) != $(MANPAGE_TODAY)"; false
; \
116 git tag
$(CODE_VERSION
);
118 # Push the www directory to Github Pages
119 publish
: clean gh-pages
123 git commit
-a
-m
"gh-pages pseudo commit"; \
124 git push git@github.com
:trebb
/pipeglade.git
+master
:gh-pages
)