home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / SVGALIB / SVGALIB1.TAR / svgalib / Makefile < prev    next >
Encoding:
Makefile  |  1995-02-21  |  7.6 KB  |  222 lines

  1. # Makefile for svgalib. It's pretty unreadable, but just doing make install
  2. # should be enough. This will install the headerfiles and shared library first
  3. # (which is enough to compile things), after which the static version is
  4. # optionally compiled and installed (if it fails, the shared libraries should
  5. # still work fine).
  6.  
  7. .EXPORT_ALL_VARIABLES:
  8.  
  9. # Directory where the header files will be installed.
  10. INCLUDEINSTALLDIR = /usr/local/include
  11.  
  12. # Directory where the shared stubs and static library will be installed.
  13. LIBINSTALLDIR = /usr/local/lib
  14.  
  15. # Directory where the font and textmode utilities will be installed.
  16. UTILINSTALLDIR = /usr/local/bin
  17.  
  18. # You might want to add -m386 here if you have a recently installed 
  19. # (486 configured) compiler on a 386. The only real difference is the
  20. # generous alignment padding of function entry-points for the 486.
  21. OPTIMIZE = -fomit-frame-pointer -O2
  22. CFLAGS     = -Wall $(OPTIMIZE)
  23. LFLAGS   = -N -s
  24.  
  25. # Uncomment this if want you to compile and install the static libs.
  26. #INSTALLSTATICLIB = installstaticlib
  27.  
  28. # Comment this out if you don't want to install the shared libs.
  29. INSTALLSHAREDLIB = installsharedlib
  30.  
  31. # Comment this out if you don't want to compile and install the utilities.
  32. INSTALLUTILS = installutils
  33.  
  34.  
  35. # Determine what library (static or shared) we will be linking programs with
  36. ifdef INSTALLSHAREDLIB
  37.   LVGA = -lvga
  38. else
  39.   LVGA    = ./libvga.a
  40.   LVGADEP = libvga.a
  41. endif
  42.  
  43. AR    = ar
  44. CC    = gcc
  45. LIBS    = $(LVGA) #-ltermcap
  46. UTILS    = restorefont runx restorepalette restoretextmode textmode \
  47.       savetextmode dumpreg fix132x43
  48. SHAREDIMAGE = libvga.so.1.2.4
  49. OBSOLETESHAREDIMAGES = /lib/libvga.so.1.0 /lib/libvga.so.1.0.1 \
  50.     /lib/libvga.so.1.0.2 /lib/libvga.so.1.0.3 /lib/libvga.so.1.0.4 \
  51.     /lib/libvga.so.1.0.5 /lib/libvga.so.1.0.6 /lib/libvga.so.1.0.7 \
  52.     /lib/libvga.so.1.0.8 /lib/libvga.so.1.0.9 /lib/libvga.so.1.0.10 \
  53.     /lib/libvga.so.1.0.11 /lib/libvga.so.1.0.12 /lib/libvga.so.1.1 \
  54.     /lib/libvga.so.1.1.1 /lib/libvga.so.1.1.2 /lib/libvga.so.1.1.3 \
  55.     /lib/libvga.so.1.1.4 /lib/libvga.so.1.1.5 /lib/libvga.so.1.1.6 \
  56.     /lib/libvga.so.1.1.7 /lib/libvga.so.1.1.8 /lib/libvga.so.1.1.9 \
  57.     /lib/libvga.so.1.2.0 /lib/libvga.so.1.2.1 /lib/libvga.so.1.2.2 \
  58.     /lib/libvga.so.1.2.3
  59. SVGALIBSHAREDSTUBS = sharedlib/libvga.sa sharedlib/libvgagl.sa
  60. BACKUP   = svgalib123.tgz
  61. DIFFFILES = Makefile README *.c *.h *.regs utils/*.c utils/Makefile \
  62.     utils/README support/*.c et4000/* gl/makefile
  63. BACKFILES = $(DIFFFILES) et4000/*.exe gendiff
  64.  
  65. .c.o:
  66.     $(CC) $(CFLAGS) -c -o $*.o $<
  67.  
  68. .o:
  69.     $(CC) $(CFLAGS) $(LFLAGS) -o $* $*.o $(LIBS)
  70.     chmod a+rs,go-w $*
  71.  
  72.  
  73. all:    installed demoprogs
  74.  
  75. installed:
  76.     @if [ ! -f $(INCLUDEINSTALLDIR)/vga.h ]; then \
  77.         echo Do make install first.; \
  78.         error; \
  79.     fi
  80.     @if [ ! -f $(LIBINSTALLDIR)/libvga.a ]; then \
  81.         if [ ! -f $(LIBINSTALLDIR)/libvga.sa ]; then \
  82.             echo Do make install first.; \
  83.             error; \
  84.         fi; \
  85.     fi
  86.  
  87. installheaders:
  88.     @echo Installing header files in $(INCLUDEINSTALLDIR).
  89.     @if [ -f /usr/include/vga.h ]; then \
  90.         rm -f /usr/include/vga.h /usr/include/vgagl.h; \
  91.         echo Old header files in /usr/include removed.; \
  92.     fi
  93.     @cp src/vga.h $(INCLUDEINSTALLDIR)/vga.h
  94.     @chmod a+r $(INCLUDEINSTALLDIR)/vga.h
  95.     @cp gl/vgagl.h $(INCLUDEINSTALLDIR)/vgagl.h
  96.     @chmod a+r $(INCLUDEINSTALLDIR)/vgagl.h
  97.     @cp src/mouse/vgamouse.h $(INCLUDEINSTALLDIR)/vgamouse.h
  98.     @chmod a+r $(INCLUDEINSTALLDIR)/vgamouse.h
  99.     @cp src/keyboard/vgakeyboard.h $(INCLUDEINSTALLDIR)/vgakeyboard.h
  100.     @chmod a+r $(INCLUDEINSTALLDIR)/vgakeyboard.h
  101.  
  102. installsharedlib: sharedlib/$(SHAREDIMAGE) $(SVGALIBSHAREDSTUBS)
  103.     @echo Installing shared library stubs in $(LIBINSTALLDIR).
  104.     @if [ -f /usr/lib/libvga.sa ]; then \
  105.         rm -f /usr/lib/libvga.sa /usr/lib/libvgagl.sa; \
  106.         echo Old stubs in /usr/lib removed.; \
  107.     fi
  108.     @cp $(SVGALIBSHAREDSTUBS) $(LIBINSTALLDIR)
  109.     @chmod a+r $(addprefix $(LIBINSTALLDIR)/,$(notdir $(SVGALIBSHAREDSTUBS)))
  110.     @echo Installing shared library image as /lib/$(SHAREDIMAGE).
  111. #    @echo You might want to delete any old images.
  112.     @rm -f $(OBSOLETESHAREDIMAGES)
  113.     @cp sharedlib/$(SHAREDIMAGE) /lib/$(SHAREDIMAGE)
  114.     @chmod a+rx /lib/$(SHAREDIMAGE)
  115.     @ln -sf /lib/$(SHAREDIMAGE) /lib/libvga.so.1
  116.  
  117. installstaticlib: src/libvga.a gl/libvgagl.a
  118.     @echo Installing static libraries in $(LIBINSTALLDIR).
  119.     @rm -f /usr/lib/libvga.a
  120.     @cp src/libvga.a $(LIBINSTALLDIR)/libvga.a
  121.     @chmod a+r $(LIBINSTALLDIR)/libvga.a
  122.     @rm -f /usr/lib/libvgagl.a
  123.     @cp gl/libvgagl.a $(LIBINSTALLDIR)/libvgagl.a
  124.     @chmod a+r $(LIBINSTALLDIR)/libvgagl.a
  125.  
  126. installutils: textutils
  127.     @if [ ! -d $(UTILINSTALLDIR) ]; then \
  128.         echo No $(UTILINSTALLDIR) directory, creating it.; \
  129.         mkdir $(UTILINSTALLDIR); \
  130.     fi
  131.     @if [ -f /usr/bin/restorefont ]; then \
  132.         echo Removing old utilities in /usr/bin.; \
  133.         for x in $(UTILS); do rm -f /usr/bin/$$x; done; \
  134.     fi
  135.     @if [ -f /usr/bin/convfont ]; then \
  136.         echo Removing inappropriate utilities in /usr/bin.; \
  137.         rm -f /usr/bin/convfont /usr/bin/setmclk; \
  138.     fi
  139.     @echo Installing textmode utilities in $(UTILINSTALLDIR):
  140.     @echo "restorefont:      Save/restore textmode font."
  141.     @cp utils/restorefont $(UTILINSTALLDIR)
  142.     @echo "runx:             Script that runs XFree86 and then restores the textmode font."
  143.     @cp utils/runx $(UTILINSTALLDIR)
  144.     @echo "restorepalette:   Set standard VGA palette."
  145.     @cp utils/restorepalette $(UTILINSTALLDIR)
  146.     @echo "dumpreg:          Write ASCII dump of SVGA registers."
  147.     @cp utils/dumpreg $(UTILINSTALLDIR)
  148.     @echo "restoretextmode:  Save/restore textmode registers."
  149.     @cp utils/restoretextmode $(UTILINSTALLDIR)
  150.     @echo "textmode:         Script that tries to restore textmode."
  151.     @cp utils/textmode $(UTILINSTALLDIR)
  152.     @echo "savetextmode:     Script that saves textmode information used by 'textmode'."
  153.     @cp utils/savetextmode $(UTILINSTALLDIR)
  154.     @echo "fix132x43:        Improve 132x43 textmode."
  155.     @cp utils/fix132x43 $(UTILINSTALLDIR)
  156.  
  157. installconfig:
  158.     @if [ ! -f /usr/local/lib/libvga.config ]; then \
  159.         echo Installing configuration file in /usr/local/lib.; \
  160.         cp libvga.config /usr/local/lib/libvga.config; \
  161.     fi
  162.     @if [ ! -f /usr/local/lib/libvga.et4000 ]; then \
  163.         echo Installing dynamically loaded ET4000 registers in /usr/local/lib.; \
  164.         cp et4000.regs /usr/local/lib/libvga.et4000; \
  165.     fi
  166.  
  167. install: installheaders $(INSTALLSHAREDLIB) installconfig $(INSTALLUTILS) $(INSTALLSTATICLIB)
  168.     @echo Now run "'make'" to make the test and demo programs in demos/.
  169.  
  170. uninstall:
  171.     @echo Removing textmode utilities.
  172.     @for x in $(UTILS); do rm -f $(UTILINSTALLDIR)/$$; done
  173.     @echo Removing shared library stubs \(shared image not removed\).
  174. #    @rm -f /lib/$(SHAREDIMAGE)
  175. #    @rm -f /lib/libvga.so.1
  176.     @rm -f $(LIBINSTALLDIR)/libvga.sa
  177.     @rm -f $(LIBINSTALLDIR)/libvgagl.sa
  178.     @echo Removing static libraries.
  179.     @rm -f $(LIBINSTALLDIR)/libvga.a
  180.     @rm -f $(LIBINSTALLDIR)/libvgagl.a
  181.     @echo Removing header files.
  182.     @rm -f $(INCLUDEINSTALLDIR)/vga.h
  183.     @rm -f $(INCLUDEINSTALLDIR)/vgagl.h
  184.     @rm -f $(INCLUDEINSTALLDIR)/vgamouse.h
  185.     @rm -f $(INCLUDEINSTALLDIR)/vgakeyboard.h
  186.  
  187. gl/libvgagl.a: gl/*.c # kludge
  188.     # Make static vgagl library.
  189.     if [ -d gl ]; then (cd ./gl; make libvgagl.a; cd ..); fi
  190.  
  191. src/libvga.a: src/*.c src/*.regs src/*.h # kludge
  192.     # Make static libvga library
  193.     (cd ./src; make libvga.a; cd ..)
  194.  
  195. demoprogs:
  196.     if [ -d demos ]; then (cd ./demos; make; cd ..); fi
  197.  
  198. textutils:
  199.     (cd ./utils; make; cd ..)
  200.  
  201. diffs:
  202.     gendiff $(DIFFFILES)
  203.  
  204. backup: $(BACKUP)
  205.  
  206. $(BACKUP): $(BACKFILES) dep
  207.     tar cvf - $(BACKFILES) | gzip -9 >$(BACKUP)
  208.  
  209. uu: backup diffs
  210.     uuencode <$(BACKUP) $(BACKUP) >$(BACKUP).uu
  211.     gzip -9 -c c_diffs | uuencode c_diffs.z >c_diffs.z.uu
  212.  
  213. clean:
  214.     
  215.     rm -f *~ *.o $(BACKUP) *.uu c_diffs*
  216.     (cd src; make clean; cd ..)
  217.     (cd gl; make clean; cd ..)
  218.     (cd utils; make clean; cd ..)
  219.     (cd demos; make clean; cd ..)
  220.     (cd mach32; make clean; cd ..)
  221.     (cd jump; rm -f *.s jump.params jump.undefs; cd ..)
  222.