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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
$NetBSD: patch-ac,v 1.4 2012/06/03 22:03:24 wiz Exp $
--- Makefile.orig 2012-04-24 16:41:33.000000000 +0000
+++ Makefile
@@ -24,17 +24,9 @@ THIRD_LIBS += $(JPEG_LIB)
THIRD_LIBS += $(OPENJPEG_LIB)
THIRD_LIBS += $(ZLIB_LIB)
-ifeq "$(verbose)" ""
-QUIET_AR = @ echo ' ' ' ' AR $@ ;
-QUIET_CC = @ echo ' ' ' ' CC $@ ;
-QUIET_GEN = @ echo ' ' ' ' GEN $@ ;
-QUIET_LINK = @ echo ' ' ' ' LINK $@ ;
-QUIET_MKDIR = @ echo ' ' ' ' MKDIR $@ ;
-endif
-
-CC_CMD = $(QUIET_CC) $(CC) $(CFLAGS) -o $@ -c $<
-AR_CMD = $(QUIET_AR) $(AR) cru $@ $^
-LINK_CMD = $(QUIET_LINK) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+CC_CMD = ${LIBTOOL} --mode=compile $(CC) $(CFLAGS) -o $@ -c $<
+AR_CMD = ${LIBTOOL} --mode=link $(CC) -o $@ -version-info 0:0:0 -rpath ${PREFIX}/lib $^
+LINK_CMD = ${LIBTOOL} --mode=link $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
MKDIR_CMD = $(QUIET_MKDIR) mkdir -p $@
# --- Rules ---
@@ -47,33 +39,32 @@ MUCBZ_HDR := $(FITZ_HDR) cbz/mucbz.h
$(OUT) $(GEN) :
$(MKDIR_CMD)
-$(OUT)/%.a :
+$(OUT)/%.la :
$(AR_CMD)
- $(RANLIB_CMD)
-$(OUT)/% : $(OUT)/%.o
+$(OUT)/% : $(OUT)/%.lo
$(LINK_CMD)
-$(OUT)/%.o : fitz/%.c $(FITZ_HDR) | $(OUT)
+$(OUT)/%.lo : fitz/%.c $(FITZ_HDR) | $(OUT)
$(CC_CMD)
-$(OUT)/%.o : draw/%.c $(FITZ_HDR) | $(OUT)
+$(OUT)/%.lo : draw/%.c $(FITZ_HDR) | $(OUT)
$(CC_CMD)
-$(OUT)/%.o : pdf/%.c $(MUPDF_HDR) | $(OUT)
+$(OUT)/%.lo : pdf/%.c $(MUPDF_HDR) | $(OUT)
$(CC_CMD)
-$(OUT)/%.o : xps/%.c $(MUXPS_HDR) | $(OUT)
+$(OUT)/%.lo : xps/%.c $(MUXPS_HDR) | $(OUT)
$(CC_CMD)
-$(OUT)/%.o : cbz/%.c $(MUCBZ_HDR) | $(OUT)
+$(OUT)/%.lo : cbz/%.c $(MUCBZ_HDR) | $(OUT)
$(CC_CMD)
-$(OUT)/%.o : apps/%.c fitz/fitz.h pdf/mupdf.h xps/muxps.h cbz/mucbz.h | $(OUT)
+$(OUT)/%.lo : apps/%.c fitz/fitz.h pdf/mupdf.h xps/muxps.h cbz/mucbz.h | $(OUT)
$(CC_CMD)
-$(OUT)/%.o : scripts/%.c | $(OUT)
+$(OUT)/%.lo : scripts/%.c | $(OUT)
$(CC_CMD)
-.PRECIOUS : $(OUT)/%.o # Keep intermediates from chained rules
+.PRECIOUS : $(OUT)/%.lo # Keep intermediates from chained rules
# --- Fitz, MuPDF, MuXPS and MuCBZ library ---
-FITZ_LIB := $(OUT)/libfitz.a
+FITZ_LIB := $(OUT)/libfitz.la
FITZ_SRC := $(notdir $(wildcard fitz/*.c draw/*.c))
FITZ_SRC := $(filter-out draw_simple_scale.c, $(FITZ_SRC))
@@ -81,10 +72,10 @@ MUPDF_SRC := $(notdir $(wildcard pdf/*.c
MUXPS_SRC := $(notdir $(wildcard xps/*.c))
MUCBZ_SRC := $(notdir $(wildcard cbz/*.c))
-$(FITZ_LIB) : $(addprefix $(OUT)/, $(FITZ_SRC:%.c=%.o))
-$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUPDF_SRC:%.c=%.o))
-$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUXPS_SRC:%.c=%.o))
-$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUCBZ_SRC:%.c=%.o))
+$(FITZ_LIB) : $(addprefix $(OUT)/, $(FITZ_SRC:%.c=%.lo))
+$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUPDF_SRC:%.c=%.lo))
+$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUXPS_SRC:%.c=%.lo))
+$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUCBZ_SRC:%.c=%.lo))
libs: $(FITZ_LIB) $(THIRD_LIBS)
@@ -127,9 +118,9 @@ endif
generate: $(CMAP_HDR) $(FONT_HDR)
-$(OUT)/pdf_cmap_table.o : $(CMAP_HDR)
-$(OUT)/pdf_fontfile.o : $(FONT_HDR)
-$(OUT)/cmapdump.o : pdf/pdf_cmap.c pdf/pdf_cmap_parse.c
+$(OUT)/pdf_cmap_table.lo : $(CMAP_HDR)
+$(OUT)/pdf_fontfile.lo : $(FONT_HDR)
+$(OUT)/cmapdump.lo : pdf/pdf_cmap.c pdf/pdf_cmap_parse.c
# --- Tools and Apps ---
@@ -139,13 +130,13 @@ $(MU_APPS) : $(FITZ_LIB) $(THIRD_LIBS)
BUSY_SRC := $(notdir $(wildcard apps/mubusy_*.c))
BUSY_APP := $(addprefix $(OUT)/, mubusy)
-$(BUSY_APP) : $(addprefix $(OUT)/, $(BUSY_SRC:%.c=%.o))
+$(BUSY_APP) : $(addprefix $(OUT)/, $(BUSY_SRC:%.c=%.lo))
$(BUSY_APP) : $(FITZ_LIB) $(THIRD_LIBS)
ifeq "$(NOX11)" ""
MUPDF := $(OUT)/mupdf
$(MUPDF) : $(FITZ_LIB) $(THIRD_LIBS)
-$(MUPDF) : $(addprefix $(OUT)/, x11_main.o x11_image.o pdfapp.o)
+$(MUPDF) : $(addprefix $(OUT)/, x11_main.lo x11_image.lo pdfapp.lo)
$(LINK_CMD) $(X11_LIBS)
endif
@@ -165,14 +156,16 @@ prefix ?= /usr/local
bindir ?= $(prefix)/bin
libdir ?= $(prefix)/lib
incdir ?= $(prefix)/include
-mandir ?= $(prefix)/share/man
+mandir ?= $(prefix)/man
install: $(FITZ_LIB) $(MU_APPS) $(MUPDF)
- install -d $(bindir) $(libdir) $(incdir) $(mandir)/man1
- install $(FITZ_LIB) $(libdir)
- install fitz/memento.h fitz/fitz.h pdf/mupdf.h xps/muxps.h cbz/mucbz.h $(incdir)
- install $(MU_APPS) $(MUPDF) $(bindir)
- install $(wildcard apps/man/*.1) $(mandir)/man1
+ ${BSD_INSTALL_DATA_DIR} $(bindir) $(libdir) $(incdir) $(mandir)/man1
+ libtool --mode=install ${BSD_INSTALL_LIB} $(FITZ_LIB) $(libdir)
+ ${BSD_INSTALL_DATA} fitz/memento.h fitz/fitz.h pdf/mupdf.h xps/muxps.h cbz/mucbz.h $(incdir)
+ for f in $(MU_APPS) $(MUPDF); do \
+ libtool --mode=install ${BSD_INSTALL_PROGRAM} $$f $(bindir); \
+ done
+ ${BSD_INSTALL_DATA} $(wildcard apps/man/*.1) $(mandir)/man1
# --- Clean and Default ---
|