forked from jung-kurt/luahpdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (87 loc) · 3.02 KB
/
Makefile
File metadata and controls
105 lines (87 loc) · 3.02 KB
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
# --- Change the settings below to suit your environment. See explanations in
# --- the build documentation for more details. ---
PREFIX=/usr/local
MODDIR=$(PREFIX)/lib/lua/5.3
DOCDIR=$(PREFIX)/share/doc/luahpdf
LUALIB=-llua5.3
LUAINC=-I/usr/include/lua5.3
HPDFLIB=-lhpdf
HPDFINC=
LUA=lua
LUAC=luac
PLATFORM=linux
# PLATFORM=macosx
# --- End of user settings, no need to change anything below this line. ---
TARGET=hpdf.so
PACKAGE=luahpdf-1.5
TAR=$(PACKAGE).tar.gz
ZIP=$(PACKAGE).zip
linux_COMPILE=cc -DHPDF_SHARED $(LUAINC) $(HPDFINC) -Wall -O2 -fomit-frame-pointer -shared -fPIC -c -o $@ $<
linux_LINK=cc -shared -fPIC -o $@ $^ $(HPDFLIB) -lz -lpng -lm
linux_REPORT=ldd ./$(TARGET)
macosx_COMPILE=cc -DHPDF_SHARED $(LUAINC) $(HPDFINC) -DLUA_USE_MACOSX -Wall -O2 -fomit-frame-pointer -fPIC -c -o $@ $<
macosx_LINK=cc -bundle -undefined dynamic_lookup -DLUA_USE_MACOSX $(HPDFLIB) -lz -lpng -o hpdf.so hpdf.o
macosx_REPORT=otool -L ./$(TARGET)
PDF = \
demo/arc_demo.pdf \
demo/encryption_demo.pdf \
demo/ext_gstate_demo.pdf \
demo/font_demo.pdf \
demo/grid_demo.pdf \
demo/hello_demo.pdf \
demo/line_demo.pdf \
demo/link_demo.pdf \
demo/logo_demo.pdf \
demo/outline_demo.pdf \
demo/permission_demo.pdf \
demo/slide_show_demo.pdf \
demo/text_demo.pdf
HTML = \
doc/html/binding-changes.html \
doc/html/binding-notes.html \
doc/html/build.html \
doc/html/change-log.html \
doc/html/demos.html \
doc/html/index.html \
doc/html/license.html
$(TARGET) : hpdf.o
$($(PLATFORM)_LINK)
$($(PLATFORM)_REPORT)
hpdf.o : hpdf.c
$($(PLATFORM)_COMPILE)
dump :
cc -E -dM -ansi -DHPDF_SHARED -pedantic -Wall -O2 $(CFLAGS) $(LUAINC) $(HPDFINC) -shared hpdf.c > $@
test : $(TARGET)
$(LUA) -e "package.path=[[]] package.cpath=[[./?.so;./?.dll]] local hpdf = require [[hpdf]] print(hpdf.VERSION_TEXT)"
all : test
install : $(TARGET) doc
install -m 0755 -d "$(DESTDIR)$(MODDIR)"
install -m 0755 $(TARGET) "$(DESTDIR)$(MODDIR)"
install -m 0755 -d "$(DESTDIR)$(DOCDIR)"
install -m 0755 -d "$(DESTDIR)$(DOCDIR)/text"
install -m 0755 -d "$(DESTDIR)$(DOCDIR)/html"
install -m 0644 README.md doc/*.lua "$(DESTDIR)$(DOCDIR)"
install -m 0644 doc/text/*.txt "$(DESTDIR)$(DOCDIR)/text"
install -m 0644 doc/html/*.html doc/html/*.css doc/html/*.png "$(DESTDIR)$(DOCDIR)/html"
doc : $(HTML)
demo : $(PDF)
package : clean doc
rm -fr $(PACKAGE)
mkdir -p $(PACKAGE)/doc/text $(PACKAGE)/doc/html $(PACKAGE)/demo $(PACKAGE)/windows
cp doc/*.lua $(PACKAGE)/doc
cp doc/text/*.txt $(PACKAGE)/doc/text
cp doc/html/*.css doc/html/*.png doc/html/*.html $(PACKAGE)/doc/html
cp demo/* $(PACKAGE)/demo
cp windows/* $(PACKAGE)/windows
cp README.md Makefile hpdf.c $(PACKAGE)
tar czvf $(TAR) $(PACKAGE)
zip -r $(ZIP) $(PACKAGE)
rm -fr $(PACKAGE)
clean :
rm -f $(PDF) $(HTML) $(TARGET) $(TAR) $(ZIP) *.o dump
.PHONY : main doc demo clean lib package test install
$(HTML): doc/html/%.html: doc/text/%.txt
$(LUA) doc/txt2html.lua < $< > $@
$(PDF): %.pdf: %.lua $(TARGET)
@$(LUAC) -l -p $< | grep SETGLOBAL; true
$(LUA) -e 'package.path="demo/?.lua;./?.lua" package.cpath="./?.so"' $<