forked from ryanmcgrath/svgalib-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
366 lines (312 loc) · 12.3 KB
/
Makefile
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
#---------------------------------------------------------------------OU
# Makefile for SVGAlib.
#
# It's pretty unreadable, but just doing make install should be
# enough. This will install the header files and shared library first
# (which is enough to compile things), after which the static version is
# optionally compiled and installed (if it fails, the shared libraries
# should still work fine).
#
#----------------------------------------------------------------------
# *** NO SERVICIBLE PARTS HERE!
# All options are in Makefile.cfg.
#include Makefile.ppc
include Makefile.cfg
#----------------------------------------------------------------------
# Rules Section
#----------------------------------------------------------------------
# In case someone goes for the demos w/o installing svgalib make
# the static libs first.
ifdef INSTALLSHAREDLIB
PREDEMO =
else
PREDEMO = static
endif
# A flag if this is a distribution:
DISTRIBUTION = $(shell sh -c "echo sharedlib/DIST*")
UTILS = restorefont runx restorepalette restoretextmode textmode \
savetextmode dumpreg fix132x43
OBSOLETEHDIRS = /usr/include/ /usr/include/vga/ /usr/local/include/ /usr/local/include/vga/
OBSOLETEBDIRS = /usr/bin/ /usr/local/bin/
OBSOLETEHEADERS = /inc/vga.h /inc/vgakeyboard.h /inc/vgamouse.h /inc/vgagl.h /inc/vgajoystick.h
OBSOLETELIBLINKS = /lib/libvga.so /lib/libvga.so.1 /lib/libvgagl.so /lib/libvgagl.so.1
OBSOLETESHAREDIMAGES = /lib/libvga.so.1.* /lib/libvga.so
# for ELF
OBSOLETESHAREDIMAGES += /lib/libvgagl.so.1.* /lib/libvgagl.so
OBSOLETELDIRS = /lib/ /usr/lib/ /usr/local/lib/ /usr/share/lib/ \
$(shell sed 's?\#.*$$??' /etc/ld.so.conf 2>/dev/null | \
sed 's?\([^/]\)[ ]*$$?\1/ ?' | grep -v aout/ )
SHAREDLIBS = sharedlib/libvga.so.$(VERSION) sharedlib/libvgagl.so.$(VERSION)
SVGALIBSHAREDSTUBS =
JUMP =
BACKUP = ../svgalib-$(VERSION).tar.gz
default:
@echo "To install SVGAlib, do one of the following:"
@echo ""
@echo " make clean - clean every thing. Do this after every change"
@echo " of Makefile.cfg!"
@echo " make install - compile & install components specified in Makefile.cfg"
@echo " make demoprogs - make demo programs in demo/ and threeDKit/"
@echo ""
@echo " make uninstall - remove an existing installation from various"
@echo " common places. (old traces often confuse the"
@echo " compiler even when svgalib is not installed anew)"
@echo " (make install includes an uninstall first)"
@echo ""
@echo " Be sure to read the file 0-INSTALL!"
@echo ""
.PHONY: default all install installheaders installconfig
.PHONY: clean distclean indent uninstall
.PHONY: force_remake remake_shared shared static
.PHONY: indent-gnu
installheaders:
@echo Installing header files in $(includedir).
@mkdir -p $(includedir)
@cp $(SRCDIR)/src/vga.h $(includedir)/vga.h
@chmod a+r $(includedir)/vga.h
@cp $(SRCDIR)/gl/vgagl.h $(includedir)/vgagl.h
@chmod a+r $(includedir)/vgagl.h
@cp $(SRCDIR)/src/mouse/vgamouse.h $(includedir)/vgamouse.h
@chmod a+r $(includedir)/vgamouse.h
@cp $(SRCDIR)/src/joystick/vgajoystick.h $(includedir)/vgajoystick.h
@chmod a+r $(includedir)/vgajoystick.h
@cp $(SRCDIR)/src/keyboard/vgakeyboard.h $(includedir)/vgakeyboard.h
@chmod a+r $(includedir)/vgakeyboard.h
installsharedlib: $(SHAREDLIBS) $(SVGALIBSHAREDSTUBS)
@echo Installing shared library image as \
$(addprefix $(sharedlibdir)/,$(notdir $(SHAREDLIBS))).
@mkdir -p ${sharedlibdir};
@for foo in $(notdir $(SHAREDLIBS)); do \
$(INSTALL_SHLIB) sharedlib/$$foo $(sharedlibdir)/$$foo; \
(cd $(sharedlibdir); \
ln -sf $$foo `echo $$foo | sed 's/\.so\..*/.so/'` ; \
ln -sf $$foo `echo $$foo | sed 's/\.so\..*/.so.1/'` ); \
done
-ldconfig
installstaticlib: static
@echo Installing static libraries in $(libdir).
@mkdir -p $(libdir)
@$(INSTALL_DATA) staticlib/libvga.a $(libdir)/libvga.a
@chmod a+r $(libdir)/libvga.a
@$(INSTALL_DATA) staticlib/libvgagl.a $(libdir)/libvgagl.a
@chmod a+r $(libdir)/libvgagl.a
installutils: textutils $(LRMI)
@if [ ! -d $(bindir) ]; then \
echo No $(bindir) directory, creating it.; \
mkdir -p $(bindir); \
fi
@echo Installing textmode utilities in $(bindir):
@echo "restorefont: Save/restore textmode font."
@$(INSTALL_PROGRAM) utils/restorefont $(bindir)
@echo "restorepalette: Set standard VGA palette."
@$(INSTALL_PROGRAM) utils/restorepalette $(bindir)
@echo "dumpreg: Write ASCII dump of SVGA registers."
@$(INSTALL_PROGRAM) utils/dumpreg $(bindir)
@echo "restoretextmode: Save/restore textmode registers."
@$(INSTALL_PROGRAM) utils/restoretextmode $(bindir)
@echo "textmode: Script that tries to restore textmode."
@$(INSTALL_SCRIPT) utils/textmode $(bindir)
@echo "savetextmode: Script that saves textmode information used by 'textmode'."
@$(INSTALL_SCRIPT) utils/savetextmode $(bindir)
ifeq ($(LRMI),lrmi)
@echo "mode3: Restore textmode by setting VESA mode 3."
@$(INSTALL_PROGRAM) lrmi-0.6m/mode3 $(bindir)
endif
@echo "Installing keymap utilities in $(bindir):"
@echo "svgakeymap: Perl script that generates scancode conversion maps."
@$(INSTALL_SCRIPT) utils/svgakeymap $(bindir)
installconfig:
mkdir -p ${datadir};
@if [ \( -f /usr/local/lib/libvga.config -a ! -f $(datadir)/libvga.config \) ]; then \
echo "Moving old config file /usr/local/lib/libvga.config to $(datadir)." ; \
mv -f /usr/local/lib/libvga.config $(datadir)/libvga.config; \
fi
@if [ \( -f /usr/local/lib/libvga.et4000 -a ! -f $(datadir)/libvga.et4000 \) ]; then \
echo "Moving old config file /usr/local/lib/libvga.et4000 to $(datadir)." ; \
mv -f /usr/local/lib/libvga.et4000 $(datadir)/libvga.et4000; \
fi
@if [ \( -f /usr/local/lib/libvga.ega -a ! -f $(datadir)/libvga.ega \) ]; then \
echo "Moving old config file /usr/local/lib/libvga.ega to $(datadir)." ; \
mv -f /usr/local/lib/libvga.ega $(datadir)/libvga.ega; \
fi
@if [ \( -f /etc/mach32.eeprom -a ! -f $(datadir)/mach32.eeprom \) ]; then \
echo Consider moving your /etc/mach32.eeprom file to $(datadir) ; \
echo and changing $(datadir)/libvga.config appropriately. ; \
fi
@if [ ! -f $(datadir)/libvga.config ]; then \
echo Installing default configuration file in $(datadir).; \
cp $(CONFDIR)/libvga.config $(datadir)/libvga.config; \
fi
@if [ ! -f $(datadir)/libvga.et4000 ]; then \
echo Installing dynamically loaded ET4000 registers in $(datadir).; \
cp $(CONFDIR)/et4000.regs $(datadir)/libvga.et4000; \
fi
@if [ ! -f $(datadir)/default.keymap ]; then \
echo Installing default keymap file in $(datadir).; \
cp $(CONFDIR)/default.keymap $(datadir)/null.keymap; \
fi
@if [ ! -f $(datadir)/dvorak-us.keymap ]; then \
echo Installing Dvorak keymap file in $(datadir).; \
cp $(CONFDIR)/dvorak-us.keymap $(datadir)/dvorak-us.keymap; \
fi
installman:
(cd doc; $(MAKE) -f $(SRCDIR)/doc/Makefile SRCDIR="$(SRCDIR)" install )
installmodule:
(cd kernel/svgalib_helper ; $(MAKE) default modules_install )
installmodule.alt:
(cd kernel/svgalib_helper ; $(MAKE) -f Makefile.alt modules_install )
lib3dkit-install:
(cd threeDKit/; $(MAKE) install)
udev-rules-install:
@echo "Installing Udev rules..."
@$(INSTALL_DIR) $(rulesdir)
@$(INSTALL_DATA) src/udev/56-svga.rules $(rulesdir)
docs-install:
@echo "Installing documentation..."
@$(INSTALL_DIR) $(docdir)
@$(INSTALL_DATA) 0-README README.md doc/0-INSTALL doc/CHANGES doc/DESIGN \
doc/Driver-programming-HOWTO doc/README.joystick doc/README.keymap \
doc/README.multi-monitor doc/README.patching doc/README.vesa doc/TODO \
doc/add_driver doc/dual-head-howto $(docdir)
@$(INSTALL_DATA) lrmi-0.6m/README $(docdir)/README.lrmi
install: installheaders $(INSTALLSHAREDLIB) installconfig \
$(INSTALLSTATICLIB) $(INSTALLUTILS) $(INSTALLMAN) $(INSTALLMODULE) \
lib3dkit-install udev-rules-install docs-install
@echo
@echo
@echo Now run "'make demoprogs'" to make the test and demo programs in
@echo demos/ and threedkit/.
uninstall:
@echo "Removing textmode utilities..."
@for i in $(OBSOLETEBDIRS); do \
for prog in $(UTILS); do \
rm -f $$i$$prog ; \
done ; \
done
@echo "Removing shared library stubs (old & current)..."
@for i in $(OBSOLETELDIRS); do \
rm -f `echo /lib/libvga.so.$(VERSION) /lib/libvgagl.so.$(VERSION) \
$(OBSOLETELIBLINKS) /lib/libvga.sa /lib/libvgagl.sa \
| sed s?/lib/?$$i?g`; \
done
ifndef KEEPSHAREDLIBS
@echo "Removing shared library images (old & current)..."
@for i in $(OBSOLETELDIRS); do \
rm -f `echo $(OBSOLETESHAREDIMAGES) | sed s?/lib/?$$i?g`; \
done
endif
@echo "Removing static libraries..."
@for i in $(OBSOLETELDIRS); do \
rm -f `echo /lib/libvga.a /lib/libvgagl.a | sed s?/lib/?$$i?g`; \
done
@echo "Removing header files..."
@for i in $(OBSOLETEHDIRS); do \
rm -f `echo $(OBSOLETEHEADERS) | sed s?/inc/?$$i?g`; \
done
(cd doc; $(MAKE) -f $(SRCDIR)/doc/Makefile SRCDIR="$(SRCDIR)" uninstall)
SHAREDDIRS0 = sharedlib/mouse sharedlib/keyboard sharedlib/ramdac \
sharedlib/clockchip sharedlib/joystick \
sharedlib/drivers
SHAREDDIRS = $(SHAREDDIRS0) $(JUMP)
STATICDIRS = staticlib/mouse staticlib/keyboard staticlib/ramdac \
staticlib/clockchip staticlib/joystick \
staticlib/drivers
UTILDIRS = utils
DEMODIRS = demos threeDKit
$(SHAREDDIRS0) $(STATICDIRS) $(DEMODIRS):
mkdir -p $@
utils:
mkdir -p utils
if [ ! -f utils/runx ]; then \
cp $(SRCDIR)/utils/runx $(SRCDIR)/utils/savetextmode \
$(SRCDIR)/utils/textmode utils; \
fi
static: staticlib/libvga.a staticlib/libvgagl.a
.PHONY: staticlib/libvgagl.a staticlib/libvga.a
staticlib/libvgagl.a staticlib/libvga.a: $(STATICDIRS)
(cd $(dir $@); \
$(MAKE) -f $(SRCDIR)/src/Makefile $(notdir $@) \
SRCDIR="$(SRCDIR)" DLLFLAGS="" \
)
# ELF
.PHONY: sharedlib/libvga.so.$(VERSION) sharedlib/libvgagl.so.$(VERSION)
shared: $(SHAREDLIBS) $(SVGALIBSHAREDSTUBS)
sharedlib/libvga.so.$(VERSION): $(SHAREDDIRS)
@rm -f sharedlib/DISTRIBUTION
(cd $(dir $@); \
$(MAKE) -f $(SRCDIR)/src/Makefile $(notdir $@) \
SRCDIR="$(SRCDIR)" DLLFLAGS="$(DLLFLAGS)"; \
ln -fs libvga.so.$(VERSION) libvga.so; \
)
sharedlib/libvgagl.a: $(SHAREDDIRS)
(cd $(dir $@); \
$(MAKE) -f $(SRCDIR)/gl/Makefile $(notdir $@) \
SRCDIR="$(SRCDIR)" DLLFLAGS="$(DLLFLAGS)" \
)
sharedlib/libvgagl.so.$(VERSION): $(SHAREDDIRS)
(cd $(dir $@); \
$(MAKE) -f $(SRCDIR)/gl/Makefile $(notdir $@) \
SRCDIR="$(SRCDIR)" DLLFLAGS="$(DLLFLAGS)"; \
ln -fs libvgagl.so.$(VERSION) libvgagl.so; \
)
demoprogs: $(PREDEMO) $(DEMODIRS)
@$(INSTALL_DIR) $(docdir)/demos/svgalib
@$(INSTALL_DIR) $(docdir)/demos/threeDKit
@for dir in $(DEMODIRS); do \
if [ -d $(SRCDIR)/$$dir ]; then \
(cd $$dir; \
$(MAKE) -f $(SRCDIR)/$$dir/Makefile SRCDIR="$(SRCDIR)"); \
fi; \
done
textutils: $(UTILDIRS)
(cd utils; \
$(MAKE) -f $(SRCDIR)/utils/Makefile SRCDIR="$(SRCDIR)")
lrmi:
(cd lrmi-0.6m;\
$(MAKE))
backup: $(BACKUP)
$(BACKUP):
# I tried using a dependency, but make reordered them
# thus I have to do it this way:
$(MAKE) shared
$(MAKE) distclean
sed 's/^TARGET_FORMAT = a.out$$/# TARGET_FORMAT = a.out/' \
$(SRCDIR)/Makefile.cfg | \
sed 's/^#[ ]*TARGET_FORMAT = elf$$/TARGET_FORMAT = elf/' \
> mkcfg ; \
mv mkcfg $(SRCDIR)/Makefile.cfg; \
(cd ..; \
find svgalib-$(VERSION) ! -type d -print | sort | tar -cvf- -T- ) \
| gzip -9 >$(BACKUP)
distclean:
(cd $(SRCDIR)/doc; $(MAKE) clean)
(cd $(SRCDIR)/doc; $(MAKE) ../0-README)
(cd $(SRCDIR)/src; $(MAKE) clean)
(cd $(SRCDIR)/gl; $(MAKE) clean)
(cd $(SRCDIR)/utils; $(MAKE) clean)
(cd $(SRCDIR)/demos; $(MAKE) clean)
(cd $(SRCDIR)/threeDKit; $(MAKE) clean)
(cd $(SRCDIR)/lrmi-0.6m; $(MAKE) clean)
(cd $(SRCDIR)/kernel/svgalib_helper; $(MAKE) clean)
rm -f *.orig
find . \( -name '.depend*' -o -name '*~*' \) -exec rm {} \;
rm -rf sharedlib/[!l]* sharedlib/l[!i]* sharedlib/li[!b]* staticlib
rm -rf sharedlib/*.a core
mkdir -p sharedlib
touch sharedlib/DISTRIBUTION
clean: distclean
rm -rf sharedlib
indent:
find demos gl mach src support -name '*.[ch]' -exec indent -kr {} \;
indent -kr src/*.regs
indent-gnu:
find demos gl mach src support -name '*.[ch]' -exec indent -gnu {} \;
indent -gnu src/*.regs
dkms:
rm -rf /usr/src/svgalib_helper-$(VERSION)
mkdir -p /usr/src/svgalib_helper-$(VERSION)
cp -a kernel/svgalib_helper/* /usr/src/svgalib_helper-$(VERSION)
dkms add -m svgalib_helper -v $(VERSION)
dkms build -m svgalib_helper -v $(VERSION)
dkms install -m svgalib_helper -v $(VERSION)
FORCE: