Ticket #23592: Makefile

File Makefile, 1.7 KB (added by prahl@…, 14 years ago)

New Makefile

Line 
1PREFIX = /usr/local
2VERSION = 1.2
3
4CC = cc
5CFLAGS = -g -Wall -m32
6LD = cc
7LDFLAGS = -framework ApplicationServices -m32
8RM = /bin/rm -f
9SRC = Makefile pict2pdf.c
10DOC = README
11TEST = sample.pict sample.orig.pdf
12OBJS = pict2pdf.o
13PROG = pict2pdf
14MANPAGE = pict2pdf.1
15DISTNAME = $(PROG)-$(VERSION)
16HTMLDOC = pict2pdf.html
17TEMPDMG = $(PROG).temp
18
19all: $(PROG)
20
21$(PROG): $(OBJS)
22        $(LD) $(LDFLAGS) $(OBJS) -o $(PROG)
23
24html $(HTMLDOC): 
25        install -d $(PREFIX)/share/man/man1
26        install -m 0644 $(MANPAGE) $(PREFIX)/share/man/man1
27        man pict2pdf | man2html > /tmp/index.html
28        perl -pe "s@(http.*f/)@<a href=\"\1\"> \1</a>@" /tmp/index.html > $(HTMLDOC)
29        rm /tmp/index.html
30
31test: sample.pict $(PROG)
32        ./$(PROG) -f -r 10 -s 0.75 sample.pict
33       
34dmg: $(PROG) $(DOC) $(HTMLDOC)
35        hdiutil create $(TEMPDMG) -sectors 9000 -fs HFS+ -volname $(PROG)
36        hdiutil mount $(TEMPDMG).dmg
37        cp $(PROG) /Volumes/$(PROG)
38        cp $(DOC) /Volumes/$(PROG)
39        cp $(HTMLDOC) /Volumes/$(PROG)
40        hdiutil unmount /Volumes/$(PROG)
41        hdiutil convert $(TEMPDMG).dmg -format UDCO -o $(DISTNAME).dmg
42        rm $(TEMPDMG).dmg
43
44install: $(PROG) $(MANPAGES)
45        install -d $(PREFIX)/bin
46        install $(PROG) $(PREFIX)/bin
47        install -d $(PREFIX)/share/man/man1
48        install -m 0644 $(MANPAGE) $(PREFIX)/share/man/man1
49       
50install-html: $(HTMLDOC)
51        scp $(HTMLDOC) prahl@shell.sourceforge.net:/home/groups/p/pi/pict2pdf/htdocs/index.html
52
53dist: $(SRC) $(MANPAGES) $(DOC) $(TEST)
54        mkdir $(DISTNAME)
55        ln $(SRC)      $(DISTNAME)
56        ln $(DOC)      $(DISTNAME)
57        ln $(TEST)     $(DISTNAME)
58        ln $(MANPAGE) $(DISTNAME)
59        tar cvf - $(DISTNAME) | gzip > $(DISTNAME).tar.gz
60        rm -rf $(DISTNAME)
61       
62clean:
63        rm -rf $(PROG) $(OBJS) $(HTMLDOC) sample.pdf
64        rm -rf $(DISTNAME) $(DISTNAME).tar.gz $(DISTNAME).dmg