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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
$NetBSD: patch-ac,v 1.1 2010/09/15 13:15:29 joerg Exp $
--- Makefile.orig 2010-08-25 14:12:08.000000000 +0000
+++ Makefile
@@ -41,32 +41,21 @@ CFLAGS += $(THIRD_INCS) $(SYS_FREETYPE_I
# Build commands
#
-ifneq "$(verbose)" ""
-
GENFILE_CMD = $(firstword $^) $@ $(wordlist 2, 999, $^)
CC_CMD = $(CC) -o $@ -c $< $(CFLAGS)
-LD_CMD = $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
-AR_CMD = rm -f $@ && $(AR) cru $@ $^
-
-else
-
-GENFILE_CMD = @ echo GENFILE $@ && $(firstword $^) $@ $(wordlist 2, 999, $^)
-CC_CMD = @ echo CC $@ && $(CC) -o $@ -c $< $(CFLAGS)
-LD_CMD = @ echo LD $@ && $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
-AR_CMD = @ echo AR $@ && rm -f $@ && $(AR) cru $@ $^
-
-endif
+LD_CMD = ${LIBTOOL} --mode=link $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
+AR_CMD = ${LIBTOOL} --mode=link $(CC) -o $@ -version-info 0:0:0 -rpath ${PREFIX}/lib $^
#
# Code generation tools
#
FONTDUMP_EXE := $(OBJDIR)/fontdump
-$(FONTDUMP_EXE): $(OBJDIR)/fontdump.o
+$(FONTDUMP_EXE): $(OBJDIR)/fontdump.lo
$(LD_CMD)
CMAPDUMP_EXE := $(OBJDIR)/cmapdump
-$(CMAPDUMP_EXE): $(OBJDIR)/cmapdump.o
+$(CMAPDUMP_EXE): $(OBJDIR)/cmapdump.lo
$(LD_CMD)
#
@@ -112,7 +101,7 @@ FITZ_SRC := \
fitz/stm_buffer.c \
fitz/stm_open.c \
fitz/stm_read.c
-FITZ_OBJ := $(FITZ_SRC:fitz/%.c=$(OBJDIR)/%.o)
+FITZ_OBJ := $(FITZ_SRC:fitz/%.c=$(OBJDIR)/%.lo)
$(FITZ_OBJ): $(FITZ_HDR)
DRAW_SRC := $(DRAW_ARCH_SRC) \
@@ -128,8 +117,8 @@ DRAW_SRC := $(DRAW_ARCH_SRC) \
draw/pathscan.c \
draw/pathstroke.c \
draw/porterduff.c
-DRAW_OBJ := $(DRAW_SRC:draw/%.c=$(OBJDIR)/%.o)
-DRAW_OBJ := $(DRAW_OBJ:draw/%.s=$(OBJDIR)/%.o)
+DRAW_OBJ := $(DRAW_SRC:draw/%.c=$(OBJDIR)/%.lo)
+DRAW_OBJ := $(DRAW_OBJ:draw/%.s=$(OBJDIR)/%.lo)
$(DRAW_OBJ): $(FITZ_HDR)
MUPDF_HDR := $(FITZ_HDR) mupdf/mupdf.h
@@ -166,19 +155,19 @@ MUPDF_SRC := \
mupdf/pdf_unicode.c \
mupdf/pdf_xobject.c \
mupdf/pdf_xref.c
-MUPDF_OBJ := $(MUPDF_SRC:mupdf/%.c=$(OBJDIR)/%.o)
+MUPDF_OBJ := $(MUPDF_SRC:mupdf/%.c=$(OBJDIR)/%.lo)
$(MUPDF_OBJ): $(MUPDF_HDR)
-$(OBJDIR)/%.o: fitz/%.c
- $(CC_CMD)
-$(OBJDIR)/%.o: draw/%.c
- $(CC_CMD)
-$(OBJDIR)/%.o: draw/%.s
- $(CC_CMD)
-$(OBJDIR)/%.o: mupdf/%.c
- $(CC_CMD)
-$(OBJDIR)/%.o: $(GENDIR)/%.c
- $(CC_CMD)
+$(OBJDIR)/%.lo: fitz/%.c
+ libtool --mode=compile $(CC_CMD)
+$(OBJDIR)/%.lo: draw/%.c
+ libtool --mode=compile $(CC_CMD)
+$(OBJDIR)/%.lo: draw/%.s
+ libtool --mode=compile $(CC_CMD)
+$(OBJDIR)/%.lo: mupdf/%.c
+ libtool --mode=compile $(CC_CMD)
+$(OBJDIR)/%.lo: $(GENDIR)/%.c
+ libtool --mode=compile $(CC_CMD)
#
# Generated font file dumps
@@ -217,7 +206,7 @@ FONT_SRC := \
$(GENDIR)/font_base14.c \
$(GENDIR)/font_cjk.c
-FONT_OBJ := $(FONT_SRC:$(GENDIR)/%.c=$(OBJDIR)/%.o)
+FONT_OBJ := $(FONT_SRC:$(GENDIR)/%.c=$(OBJDIR)/%.lo)
#
@@ -287,13 +276,13 @@ CMAP_SRC := \
$(GENDIR)/cmap_japan.c \
$(GENDIR)/cmap_korea.c
-CMAP_OBJ := $(CMAP_SRC:$(GENDIR)/%.c=$(OBJDIR)/%.o)
+CMAP_OBJ := $(CMAP_SRC:$(GENDIR)/%.c=$(OBJDIR)/%.lo)
#
# Library
#
-MUPDF_LIB = $(OBJDIR)/libmupdf.a
+MUPDF_LIB = $(OBJDIR)/libmupdf.la
$(MUPDF_LIB): $(FITZ_OBJ) $(DRAW_OBJ) $(MUPDF_OBJ) $(CMAP_OBJ) $(FONT_OBJ)
$(AR_CMD)
@@ -303,40 +292,40 @@ $(MUPDF_LIB): $(FITZ_OBJ) $(DRAW_OBJ) $(
APPS = $(PDFSHOW_EXE) $(PDFCLEAN_EXE) $(PDFDRAW_EXE) $(PDFEXTRACT_EXE) $(PDFINFO_EXE) $(PDFVIEW_EXE)
-$(OBJDIR)/%.o: apps/%.c
- $(CC_CMD)
+$(OBJDIR)/%.lo: apps/%.c
+ libtool --mode=compile $(CC_CMD)
PDFSHOW_SRC=apps/pdfshow.c
-PDF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RC:apps/%.c=$(OBJDIR)/%.o)
-PDFINFO_EXE=$(OBJDIR)/pdfinfo
+PDFINFO_OBJ=$(PDFINFO_SRC:apps/%.c=$(OBJDIR)/%.lo)
+PDFINFO_EXE=$(OBJDIR)/mupdf-pdfinfo
$(PDFINFO_OBJ): $(MUPDF_HDR)
$(PDFINFO_EXE): $(PDFINFO_OBJ) $(MUPDF_LIB) $(THIRD_LIBS)
$(LD_CMD)
@@ -344,7 +333,7 @@ $(PDFINFO_EXE): $(PDFINFO_OBJ) $(MUPDF_L
PDFAPP_HDR = apps/pdfapp.h
X11VIEW_SRC=apps/x11_main.c apps/x11_image.c apps/pdfapp.c
-X11VIEW_OBJ=$(X11VIEW_SRC:apps/%.c=$(OBJDIR)/%.o)
+X11VIEW_OBJ=$(X11VIEW_SRC:apps/%.c=$(OBJDIR)/%.lo)
X11VIEW_EXE=$(OBJDIR)/mupdf
$(X11VIEW_OBJ): $(MUPDF_HDR) $(PDFAPP_HDR)
@@ -353,7 +342,7 @@ $(X11VIEW_EXE): $(X11VIEW_OBJ) $(MUPDF_L
WINVIEW_SRC=apps/win_main.c apps/pdfapp.c
WINVIEW_RES=apps/win_res.rc
-WINVIEW_OBJ=$(WINVIEW_SRC:apps/%.c=$(OBJDIR)/%.o) $(WINVIEW_RES:apps/%.rc=$(OBJDIR)/%.o)
+WINVIEW_OBJ=$(WINVIEW_SRC:apps/%.c=$(OBJDIR)/%.lo) $(WINVIEW_RES:apps/%.rc=$(OBJDIR)/%.lo)
WINVIEW_EXE=$(OBJDIR)/mupdf.exe
$(OBJDIR)/%.o: apps/%.rc
@@ -378,7 +367,7 @@ nuke:
rm -rf build
install: $(OBJDIR) $(GENDIR) $(MUPDF_LIB) $(APPS)
- install -d $(prefix)/bin $(prefix)/lib $(prefix)/include
- install $(APPS) $(prefix)/bin
- install $(MUPDF_LIB) $(prefix)/lib
- install $(MUPDF_HDR) $(prefix)/include
+ mkdir -p $(prefix)/bin $(prefix)/lib $(prefix)/include
+ libtool --mode=install ${BSD_INSTALL_PROGRAM} $(APPS) $(prefix)/bin
+ libtool --mode=install ${BSD_INSTALL_LIB} $(MUPDF_LIB) $(prefix)/lib
+ ${BSD_INSTALL_DATA} $(MUPDF_HDR) $(prefix)/include
|