File: Makefile

package info (click to toggle)
ssocr 2.25.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 344 kB
  • sloc: ansic: 3,012; makefile: 89
file content (63 lines) | stat: -rw-r--r-- 2,695 bytes parent folder | download
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
# minimal CFLAGS definition (try if compilation fails with default CFLAGS)
#CFLAGS  := $(shell if command -v imlib2-config >/dev/null; then imlib2-config --cflags; else $(PKG_CONFIG) --cflags imlib2; fi)
# default CFLAGS definition
CFLAGS  := -D_FORTIFY_SOURCE=2 -Wall -W -Wextra -pedantic -fstack-protector-all $(shell if command -v imlib2-config >/dev/null; then imlib2-config --cflags; else $(PKG_CONFIG) --cflags imlib2; fi) -g
LDLIBS  := -lm $(shell if command -v imlib2-config >/dev/null; then imlib2-config --libs; else $(PKG_CONFIG) --libs imlib2; fi)
PREFIX  := /usr/local
BINDIR  := $(PREFIX)/bin
MANDIR  := $(PREFIX)/share/man/man1
DOCDIR  := $(PREFIX)/share/doc/ssocr
DOCS    := AUTHORS COPYING INSTALL README THANKS NEWS
VERSION := $(shell sed -n 's/^.*VERSION.*"\(.*\)".*/\1/p' defines.h)
CRYEARS := $(shell sed -n 's/^.*fprintf.*Copyright.*\(2004-2[0-9][0-9][0-9]\).*Erik.*Auerswald.*$$/\1/p' help.c)
RELDATE := $(shell sed -n 's/^Version [.0-9]* .\([-0-9]*\).*$$/\1/p' NEWS | head -n1)

all: ssocr ssocr.1

ssocr: ssocr.o imgproc.o help.o charset.o

ssocr.o: ssocr.c ssocr.h defines.h imgproc.h help.h charset.h Makefile
imgproc.o: imgproc.c defines.h imgproc.h help.h Makefile
help.o: help.c defines.h imgproc.h help.h Makefile
charset.o: charset.c charset.h defines.h help.h Makefile

ssocr.1: ssocr.1.in Makefile defines.h help.c NEWS
	sed -e 's/@VERSION@/$(VERSION)/' \
	    -e 's/@DATE@/$(RELDATE)/' \
	    -e 's/@CRYEARS@/$(CRYEARS)/' <$< >$@

ssocr-manpage.html: ssocr.1
	man -l -Thtml $< >$@

install: all
	install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR) $(DESTDIR)$(DOCDIR)
	install -s -m 0755 ssocr $(DESTDIR)$(BINDIR)/ssocr
	install -m 0644 ssocr.1 $(DESTDIR)$(MANDIR)/ssocr.1
	gzip -9 $(DESTDIR)$(MANDIR)/ssocr.1
	install -m 0644 $(DOCS) $(DESTDIR)$(DOCDIR)

ssocr-dir:
	install -d ssocr-$(VERSION)
	install -m 0644 Makefile $(DOCS) *.[ch] *.in ssocr-$(VERSION)
	install -d ssocr-$(VERSION)/notdebian
	install -m 0644 notdebian/* ssocr-$(VERSION)/notdebian
	chmod +x ssocr-$(VERSION)/notdebian/rules

notdebian/changelog:
	printf 'ssocr ($(VERSION)-1) unstable; urgency=low\n\n  * self built package of current ssocr version in .deb format\n\n -- $(USER)  $(shell date -R)\n' >$@

selfdeb: notdebian/changelog notdebian/control notdebian/rules ssocr-dir
	(cd ssocr-$(VERSION); ln -sv notdebian debian; fakeroot debian/rules binary; fakeroot debian/rules clean; rm -f debian)

tar: ssocr-dir
	tar cvfj ssocr-$(VERSION).tar.bz2 ssocr-$(VERSION)

clean:
	$(RM) ssocr ssocr.1 *.o *~ testbild.png ssocr-manpage.html
	$(RM) notdebian/changelog
	$(RM) -r ssocr-$(VERSION) ssocr-?.?.? ssocr-?.??.?

distclean: clean
	$(RM) *.deb *.bz2

.PHONY: clean tar ssocr-dir install