]> git.sur5r.net Git - cc65/commitdiff
Makefile changes by Greg King
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 20 Nov 2005 17:10:48 +0000 (17:10 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 20 Nov 2005 17:10:48 +0000 (17:10 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3657 b7a2c559-68d2-44c3-8de9-860c34a00d81

doc/Makefile
make/gcc.mak
make/install-sh [new file with mode: 0755]

index 5544976ed514ba10768f89fe783b2d777f99703f..7b295c31fb9b0ac8796ee676dd682fcb927d9fa2 100644 (file)
@@ -1,54 +1,65 @@
+# -*- makefile -*-
 #
 # Makefile for the cc65 documentation
 #
 
+# You can put navigation-arrow pictures (next, back, contents) into HTML files
+# by setting this variable, either here or on make's command-line.
+# (You will need to copy the .png files from "share/doc/linuxdoc-tools*/html/".)
+#
+#BUTTONS=-I
 
-# Default for the compiler lib search path as compiler define
-
-SGML  =        apple2.sgml     \
-       ar65.sgml       \
-        atari.sgml      \
-        atmos.sgml      \
-        c128.sgml       \
-        c16.sgml        \
-        c64.sgml        \
-       ca65.sgml       \
+# These options decide how text files are made:
+# -f -- removes the backspace-overtyping that makes bold text
+#       in the more/less commands and on typewriter-printers
+# -m -- makes Unix manual pages
+#
+#TXT_OPTIONS=-f -m
+
+SGML = apple2.sgml     \
+       ar65.sgml       \
+       atari.sgml      \
+       atmos.sgml      \
+       c128.sgml       \
+       c16.sgml        \
+       c64.sgml        \
+       ca65.sgml       \
        ca65html.sgml   \
-        cbm610.sgml     \
-       cc65.sgml       \
-       cl65.sgml       \
-        co65.sgml       \
+       cbm610.sgml     \
+       cc65.sgml       \
+       cl65.sgml       \
+       co65.sgml       \
        coding.sgml     \
-        da65.sgml       \
+       da65.sgml       \
        debugging.sgml  \
-       dio.sgml        \
-        funcref.sgml    \
-       geos.sgml       \
+       dio.sgml        \
+       funcref.sgml    \
+       geos.sgml       \
        grc.sgml        \
-       index.sgml      \
+       index.sgml      \
        intro.sgml      \
-       ld65.sgml       \
-       library.sgml    \
-        lynx.sgml       \
-        nes.sgml        \
-        pet.sgml        \
-        plus4.sgml      \
-        vic20.sgml
-
-TXT   =        $(SGML:.sgml=.txt)
-HTML  = $(SGML:.sgml=.html)
-INFO  = $(SGML:.sgml=.info)
-DVI   = $(SGML:.sgml=.dvi)
-TEX   = $(SGML:.sgml=.tex)
+       ld65.sgml       \
+       library.sgml    \
+       lynx.sgml       \
+       nes.sgml        \
+       pet.sgml        \
+       plus4.sgml      \
+       vic20.sgml
+
+TXT  = $(SGML:.sgml=.txt)
+HTML = $(SGML:.sgml=.html)
+INFO = $(SGML:.sgml=.info)
+DVI  = $(SGML:.sgml=.dvi)
+TEX  = $(SGML:.sgml=.tex)
 
 # ------------------------------------------------------------------------------
-# Rules to make targets
+# Pattern-rules, to make targets
 
 %.txt: %.sgml
-       sgml2txt $<
+       sgml2txt $(TXT_OPTIONS) $<
 
 %.html:        %.sgml
-       sgml2html --split=1 $<
+       sgml2html --split=1 $(BUTTONS) $<
 
 %.info:        %.sgml
        sgml2info $<
@@ -57,38 +68,45 @@ TEX   = $(SGML:.sgml=.tex)
        sgml2latex $<
 
 %.tex: %.sgml
-       sgml2latex --output=tex $<
+       sgml2latex --output=tex $<
 
 # ------------------------------------------------------------------------------
 # Targets
 
-.PHONY: all
-all:   txt html info dvi
+.PHONY:        all
+all:   txt html info dvi
 
 .PHONY:        txt
-txt:   $(TXT)
+txt:   linuxdoc $(TXT)
 
 .PHONY:        html
-html:  $(HTML)
+html:  linuxdoc $(HTML)
 
 .PHONY:        info
-info:  $(INFO)
+info:  linuxdoc $(INFO)
 
 .PHONY:        dvi
-dvi:   $(DVI)
+dvi:   linuxdoc $(DVI)
 
 .PHONY:        tex
-tex:   $(TEX)
-
-# The index.html target is special, since it does not get splitted
-index.html:    index.sgml
-       sgml2html --split=0 $<
-
+tex:   linuxdoc $(TEX)
+
+.PHONY:        linuxdoc
+linuxdoc:
+       @sgmlcheck index >/dev/null 2>&1 || { \
+       echo; \
+       echo '"LinuxDoc Tools" does not exist on this system.'; \
+       echo 'So, most of the documentation might not have been built.'; \
+       echo; \
+       false;}
+
+.PHONY:        clean
 clean:
-       rm -f *~
+       $(RM) *~
 
+.PHONY:        zap
 zap:   clean
-       rm -f $(TXT) $(HTML) $(INFO) $(DVI) $(TEX) *.html *.info-* *.man
+       $(RM) $(TXT) $(TEX) $(DVI) *.htm* *.inf* *.man
 
 # ------------------------------------------------------------------------------
 # Special target rules
@@ -96,18 +114,14 @@ zap:       clean
 coding.html:   coding.sgml
        sgml2html --split=0 $<
 
+# funcref.sgml's third section is huge.
+# So, funcref.html is split into sub-section files.
+#
 funcref.html:  funcref.sgml
-       sgml2html --split=2 $<
+       sgml2html --split=2 $(BUTTONS) $<
 
-index.html:            index.sgml
+# The index.html target is special:
+# It is only a table of contents.  So, it should not be split.
+#
+index.html:    index.sgml
        sgml2html --split=0 $<
-
-# ------------------------------------------------------------------------------
-# Make the dependencies
-
-.PHONY: depend dep
-depend dep:    $(OBJS:.o=.c)
-       @echo "Creating dependency information"
-       $(CC) -MM $^ > .depend
-
-
index 73e52504ebf98355859022edb3d9ca0d15143c46..bee4bd93f1473553b55411c77cd9e02d3c1bedc2 100644 (file)
@@ -33,9 +33,9 @@ CC65LIB               = $(CC65DATA)/lib
 
 MKDIR          = mkdir -m 755
 
-# BSD-like install-program/-script
-INSTALL                = install
-#INSTALL               = install-sh
+# BSD-like install-script/-program
+INSTALL                = make/install-sh
+#INSTALL               = install
 
 INSTALL_DATA   = $(INSTALL) -c -m 644
 INSTALL_PROG   = $(INSTALL) -c -m 755
@@ -56,9 +56,13 @@ bins:
 libs:
        @$(MAKE) -C libsrc
 
-# A host system might not have LinuxDoc Tools, so this rule ignores errors.
+# This rule won't try to generate HTML files
+# if a host system doesn't have LinuxDoc Tools.
 docs:
-       -@which sgml2html > /dev/null && $(MAKE) -C doc html || echo 'SGML-Tools not installed, skipping docs'
+       @if sgmlcheck doc/index >/dev/null 2>&1; \
+         then $(MAKE) -C doc html; \
+         else echo '"LinuxDoc Tools" is not installed; skipping HTML documentation.'; \
+         fi
 
 # Some platforms cannot compile all of the sample and library-test programs.
 # So, these rules ignore errors.
@@ -74,7 +78,7 @@ clean zap:
        $(MAKE) -C libsrc $@
        $(MAKE) -C doc $@
        $(MAKE) -C samples $@
-       $(MAKE) -C testcode/lib $@ $(SYS:%=SYS=%)
+#      $(MAKE) -C testcode/lib $@ $(SYS:%=SYS=%)
 
 uninstall:     install-test
        cd $(bindir) && $(RM) ar65 ca65 cc65 cl65 co65 da65 ld65 od65 grc ca65html
@@ -90,12 +94,13 @@ install:    install-test install-dirs install-bins install-libs install-docs
 
 .PHONY:        install-test
 install-test:
-#      @if [ `id -u` != 0 ]; then                                      \
-#        echo >&2;                                                     \
-#        echo 'Do "make install" or "make uninstall" as root.' >&2;    \
-#        echo >&2;                                                     \
-#        false;                                                        \
-#        fi
+       @if [ `id -u` != 0 ]; then \
+         echo; \
+         echo 'If you are denied permission to install or uninstall this package,'; \
+         echo 'then you will need to do "make/gcc.mak install" or "make/gcc.mak uninstall"'; \
+         echo 'as either the root user or an administrator.'; \
+         echo; \
+         fi 2>/dev/null
 
 .PHONY:        install-dirs
 install-dirs:
@@ -134,12 +139,14 @@ install-libs:
          done
 
 install-docs:
-       for f in src/ld65/cfg/*.cfg; \
+       for f in src/ld65/cfg/*.cfg src/ca65/macpack/*.mac; \
          do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \
          done
-       for f in readme.1st compile.txt CREDITS BUGS internal.txt newvers.txt; \
+       for f in readme.1st compile.txt BUGS internal.txt newvers.txt; \
          do $(INSTALL_DATA) doc/$$f $(CC65DOC) || exit 1; \
          done
-       -for f in doc/*.html; \
-         do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \
-         done
+       if [ -e doc/index.htm* ]; \
+         then for f in doc/*.htm*; \
+           do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \
+           done; \
+         fi
diff --git a/make/install-sh b/make/install-sh
new file mode 100755 (executable)
index 0000000..a44791f
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# install-sh -- install a program, script, or data-file.
+#
+# This isn't a full install-script; it does only what is needed by the cc65
+# package.  It can install only one file at a time.
+
+# Don't use ":-" because 4.3BSD and earlier shells don't like it.
+# Put in absolute paths if you don't have these commands in your PATH;
+# or, set these upper-case variables in your environment.
+cpprog="${CPPROG-cp}"
+mvprog="${MVPROG-mv}"
+rmprog="${RMPROG-rm}"
+stripprog="${STRIPPROG-strip}"
+chmodprog="${CHMODPROG-chmod}"
+
+instcmd="$cpprog"
+stripcmd=""
+chmodcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+       -c) ;;
+
+       -m) chmodcmd="$chmodprog $2"
+           shift
+           ;;
+
+       -s) stripcmd="$stripprog"
+           ;;
+
+       # The first name is the source; the last name is the destination.
+       *)  if [ x"$src" = x ]
+               then src="$1"
+               else dst="$1"
+               fi
+       esac
+    shift
+    done
+
+[ x"$src" != x ] || { echo "$0: no input file was named." >&2; exit 1;}
+[ x"$dst" != x ] || { echo "$0: no destination was named." >&2; exit 1;}
+
+[ -e "$src" ] || { echo "$0: \"$src\" doesn't exist." >&2; exit 1;}
+
+# Make a temporary file-name in the proper directory.
+dsttmp="$dst/#inst.$$#"
+
+# Append the input filename to the destination directory.
+dst="$dst"/`basename "$src"`
+
+# Trap to remove the temporary file if it isn't renamed.
+trap 'status=$?; $rmcmd "$dsttmp" && exit $status' 0
+trap '(exit $?); exit' 1 2 3 13 15
+
+# Copy the source file to the temporary name.
+$instcmd "$src" "$dsttmp" &&
+
+if [ x"$stripcmd" != x ]
+    then $stripcmd "$dsttmp"
+    fi &&
+if [ x"$chmodcmd" != x ]
+    then $chmodcmd "$dsttmp"
+    fi &&
+
+# Remove an old file (only if the temporary file was created successfully).
+if [ -f "$dst" ]
+    then $rmcmd "$dst" 2>/dev/null ||
+    { echo "$0: can't remove \"$dst\"" >&2
+      (exit 1); exit
+      }
+    fi &&
+
+# Rename the temporary file to the real name.
+$mvcmd "$dsttmp" "$dst" &&
+
+# The final little trick to pass "correctly" the exit status to exit traps.
+{ (exit 0); exit;}