1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-18 00:07:21 +00:00

Makefile changes by Greg King

git-svn-id: svn://svn.cc65.org/cc65/trunk@3657 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2005-11-20 17:10:48 +00:00
parent e17f08957c
commit 52d0b2b5a7
3 changed files with 178 additions and 75 deletions

View File

@ -1,9 +1,20 @@
# -*- makefile -*-
# #
# Makefile for the cc65 documentation # 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 # 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 \ SGML = apple2.sgml \
ar65.sgml \ ar65.sgml \
@ -42,13 +53,13 @@ DVI = $(SGML:.sgml=.dvi)
TEX = $(SGML:.sgml=.tex) TEX = $(SGML:.sgml=.tex)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Rules to make targets # Pattern-rules, to make targets
%.txt: %.sgml %.txt: %.sgml
sgml2txt $< sgml2txt $(TXT_OPTIONS) $<
%.html: %.sgml %.html: %.sgml
sgml2html --split=1 $< sgml2html --split=1 $(BUTTONS) $<
%.info: %.sgml %.info: %.sgml
sgml2info $< sgml2info $<
@ -66,29 +77,36 @@ TEX = $(SGML:.sgml=.tex)
all: txt html info dvi all: txt html info dvi
.PHONY: txt .PHONY: txt
txt: $(TXT) txt: linuxdoc $(TXT)
.PHONY: html .PHONY: html
html: $(HTML) html: linuxdoc $(HTML)
.PHONY: info .PHONY: info
info: $(INFO) info: linuxdoc $(INFO)
.PHONY: dvi .PHONY: dvi
dvi: $(DVI) dvi: linuxdoc $(DVI)
.PHONY: tex .PHONY: tex
tex: $(TEX) tex: linuxdoc $(TEX)
# The index.html target is special, since it does not get splitted .PHONY: linuxdoc
index.html: index.sgml linuxdoc:
sgml2html --split=0 $< @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: clean:
rm -f *~ $(RM) *~
.PHONY: zap
zap: clean zap: clean
rm -f $(TXT) $(HTML) $(INFO) $(DVI) $(TEX) *.html *.info-* *.man $(RM) $(TXT) $(TEX) $(DVI) *.htm* *.inf* *.man
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Special target rules # Special target rules
@ -96,18 +114,14 @@ zap: clean
coding.html: coding.sgml coding.html: coding.sgml
sgml2html --split=0 $< sgml2html --split=0 $<
# funcref.sgml's third section is huge.
# So, funcref.html is split into sub-section files.
#
funcref.html: funcref.sgml funcref.html: funcref.sgml
sgml2html --split=2 $< sgml2html --split=2 $(BUTTONS) $<
# The index.html target is special:
# It is only a table of contents. So, it should not be split.
#
index.html: index.sgml index.html: index.sgml
sgml2html --split=0 $< sgml2html --split=0 $<
# ------------------------------------------------------------------------------
# Make the dependencies
.PHONY: depend dep
depend dep: $(OBJS:.o=.c)
@echo "Creating dependency information"
$(CC) -MM $^ > .depend

View File

@ -33,9 +33,9 @@ CC65LIB = $(CC65DATA)/lib
MKDIR = mkdir -m 755 MKDIR = mkdir -m 755
# BSD-like install-program/-script # BSD-like install-script/-program
INSTALL = install INSTALL = make/install-sh
#INSTALL = install-sh #INSTALL = install
INSTALL_DATA = $(INSTALL) -c -m 644 INSTALL_DATA = $(INSTALL) -c -m 644
INSTALL_PROG = $(INSTALL) -c -m 755 INSTALL_PROG = $(INSTALL) -c -m 755
@ -56,9 +56,13 @@ bins:
libs: libs:
@$(MAKE) -C libsrc @$(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: 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. # Some platforms cannot compile all of the sample and library-test programs.
# So, these rules ignore errors. # So, these rules ignore errors.
@ -74,7 +78,7 @@ clean zap:
$(MAKE) -C libsrc $@ $(MAKE) -C libsrc $@
$(MAKE) -C doc $@ $(MAKE) -C doc $@
$(MAKE) -C samples $@ $(MAKE) -C samples $@
$(MAKE) -C testcode/lib $@ $(SYS:%=SYS=%) # $(MAKE) -C testcode/lib $@ $(SYS:%=SYS=%)
uninstall: install-test uninstall: install-test
cd $(bindir) && $(RM) ar65 ca65 cc65 cl65 co65 da65 ld65 od65 grc ca65html 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 .PHONY: install-test
install-test: install-test:
# @if [ `id -u` != 0 ]; then \ @if [ `id -u` != 0 ]; then \
# echo >&2; \ echo; \
# echo 'Do "make install" or "make uninstall" as root.' >&2; \ echo 'If you are denied permission to install or uninstall this package,'; \
# echo >&2; \ echo 'then you will need to do "make/gcc.mak install" or "make/gcc.mak uninstall"'; \
# false; \ echo 'as either the root user or an administrator.'; \
# fi echo; \
fi 2>/dev/null
.PHONY: install-dirs .PHONY: install-dirs
install-dirs: install-dirs:
@ -134,12 +139,14 @@ install-libs:
done done
install-docs: 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; \ do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \
done 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; \ do $(INSTALL_DATA) doc/$$f $(CC65DOC) || exit 1; \
done done
-for f in doc/*.html; \ if [ -e doc/index.htm* ]; \
then for f in doc/*.htm*; \
do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \ do $(INSTALL_DATA) $$f $(CC65DOC) || exit 1; \
done done; \
fi

82
make/install-sh Executable file
View File

@ -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;}