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

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

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