Commit 2f3d394e authored by Mike Gabriel's avatar Mike Gabriel

nx-X11/config/{imake,makedepend}: Use system-wide available imake and makedepend tools.

parent 5b36f644
...@@ -28,6 +28,7 @@ Build-Depends: ...@@ -28,6 +28,7 @@ Build-Depends:
x11proto-core-dev, x11proto-core-dev,
expat, expat,
libpixman-1-dev (>= 0.13.2), libpixman-1-dev (>= 0.13.2),
xutils-dev,
Standards-Version: 3.9.6 Standards-Version: 3.9.6
Homepage: https://github.com/ArcticaProject/nx-libs/ Homepage: https://github.com/ArcticaProject/nx-libs/
Vcs-Git: https://github.com/ArcticaProject/nx-libs/ Vcs-Git: https://github.com/ArcticaProject/nx-libs/
......
...@@ -105,11 +105,6 @@ Everything:: ...@@ -105,11 +105,6 @@ Everything::
@echo "" @echo ""
@date @date
@echo "" @echo ""
cd $(IMAKESRC) && if [ -f Makefile ]; then \
$(MAKE) $(MFLAGS) BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; \
else \
$(MAKE) $(MFLAGS) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; \
fi
-$(RM) xmakefile.bak; $(MV) xmakefile xmakefile.bak -$(RM) xmakefile.bak; $(MV) xmakefile xmakefile.bak
$(MAKE) $(MFLAGS) xmakefile $(MAKE) $(MFLAGS) xmakefile
$(MAKE) $(MFLAGS) $(MAKE_OPTS) Makefiles $(MAKE) $(MFLAGS) $(MAKE_OPTS) Makefiles
...@@ -149,9 +144,6 @@ Everything:: ...@@ -149,9 +144,6 @@ Everything::
@echo Rebuilding $(RELEASE) of the X Window System. @echo Rebuilding $(RELEASE) of the X Window System.
@echo : @echo :
@echo : @echo :
cd $(IMAKESRC)
$(MAKE) $(MFLAGS) -f Makefile.ini imake.exe
cd ..\..
RMoveToBakFile(xmakefile) RMoveToBakFile(xmakefile)
$(MAKE) $(MFLAGS) xmakefile $(MAKE) $(MFLAGS) xmakefile
$(MAKE) $(MFLAGS) $(MAKE_OPTS) Makefiles $(MAKE) $(MFLAGS) $(MAKE_OPTS) Makefiles
...@@ -186,7 +178,3 @@ xmakefile-exists:: ...@@ -186,7 +178,3 @@ xmakefile-exists::
#ifndef MakeHtmlManIndex #ifndef MakeHtmlManIndex
#define MakeHtmlManIndex YES /* install.man generates HTML man page index */ #define MakeHtmlManIndex YES /* install.man generates HTML man page index */
#endif #endif
#undef BootstrapCleanSubdirs
#define BootstrapCleanSubdirs BOOTSTRAPSUBDIRS="$(BOOTSTRAPSUBDIRS)"
BOOTSTRAPSUBDIRS = imake makedepend
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# Luna users will need to either run make as "make MAKE=make" # Luna users will need to either run make as "make MAKE=make"
# or add "MAKE = make" to this file. # or add "MAKE = make" to this file.
RELEASE = "Release 6.9" RELEASE = "Release $(shell cat ../VERSION)"
SHELL = /bin/sh SHELL = /bin/sh
RM = rm -f RM = rm -f
MV = mv MV = mv
...@@ -17,16 +17,11 @@ WIN32WORLDOPTS = -i ...@@ -17,16 +17,11 @@ WIN32WORLDOPTS = -i
TOP = . TOP = .
CURRENT_DIR = . CURRENT_DIR = .
CONFIGSRC = $(TOP)/config CONFIGSRC = $(TOP)/config
IMAKESRC = $(CONFIGSRC)/imake
DEPENDSRC = $(CONFIGSRC)/makedepend
DEPENDTOP = ../..
IMAKETOP = ../..
IRULESRC = $(CONFIGSRC)/cf IRULESRC = $(CONFIGSRC)/cf
IMAKE = $(IMAKESRC)/imake IMAKE = imake
IMAKE_CMD = $(IMAKE) -I$(IRULESRC) $(IMAKE_DEFINES) IMAKE_CMD = $(IMAKE) -I$(IRULESRC) $(IMAKE_DEFINES)
MAKE_OPTS = -f xmakefile MAKE_OPTS = -f xmakefile
MAKE_CMD = $(MAKE) $(MAKE_OPTS) MAKE_CMD = $(MAKE) $(MAKE_OPTS)
FLAGS = $(MFLAGS) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)" CC="$(CC)"
all: all:
@${MAKE} ${MAKE_OPTS} xmakefile-exists || $(MAKE) all-initial @${MAKE} ${MAKE_OPTS} xmakefile-exists || $(MAKE) all-initial
...@@ -34,8 +29,7 @@ all: ...@@ -34,8 +29,7 @@ all:
all-initial: all-initial:
@echo Please use make World, or on NT use nmake World.Win32. @echo Please use make World, or on NT use nmake World.Win32.
@echo Check the configuration parameters in the $(IRULESRC) directory, @echo
@echo and pass BOOTSTRAPCFLAGS if necessary.
@echo Read the release notes carefully before proceeding. @echo Read the release notes carefully before proceeding.
@echo Do not name your log file make.log or it will be deleted. @echo Do not name your log file make.log or it will be deleted.
...@@ -43,11 +37,6 @@ World: ...@@ -43,11 +37,6 @@ World:
@echo "" @echo ""
@echo Building $(RELEASE). @echo Building $(RELEASE).
@echo "" @echo ""
@case "x$(BOOTSTRAPCFLAGS)" in x) \
echo I hope you checked the configuration parameters in $(IRULESRC) ; \
echo to see if you need to pass BOOTSTRAPCFLAGS. ; \
echo "" ; \
;; esac;
@date @date
@echo "" @echo ""
@if [ -f xmakefile ]; then \ @if [ -f xmakefile ]; then \
...@@ -55,31 +44,9 @@ World: ...@@ -55,31 +44,9 @@ World:
${MAKE} ${MAKE_OPTS} -k clean || \ ${MAKE} ${MAKE_OPTS} -k clean || \
$(RM) xmakefile; \ $(RM) xmakefile; \
fi fi
@if [ ! -f $(IRULESRC)/host.def ]; then \
if [ ! -f $(TOP)/lib/Xt/Imakefile ]; then \
echo "#define BuildServersOnly YES" > $(IRULESRC)/host.def; \
else \
if [ ! -f $(TOP)/fonts/Imakefile ]; then \
echo "#define BuildFonts NO" > $(IRULESRC)/host.def; \
else \
echo "" > $(IRULESRC)/host.def; \
fi; \
fi; \
fi
# @rm -f $(IRULESRC)/version.def; echo "" > $(IRULESRC)/version.def;
@rm -f $(IRULESRC)/date.def; echo "" > $(IRULESRC)/date.def; @rm -f $(IRULESRC)/date.def; echo "" > $(IRULESRC)/date.def;
# @if [ ! -f $(IRULESRC)/version.def ]; then \ ${MAKE} $(MFLAGS) xmakefile
# rm -f $(IRULESRC)/version.def; \
# echo "" > $(IRULESRC)/version.def; \
# fi
# @if [ ! -f $(IRULESRC)/date.def ]; then \
# rm -f $(IRULESRC)/date.def; \
# echo "" > $(IRULESRC)/date.def; \
# fi
cd $(IMAKESRC) && $(MAKE) $(FLAGS) clean
$(MAKE) $(MFLAGS) Makefile.boot
${MAKE} ${MAKE_OPTS} $(MFLAGS) version.def ${MAKE} ${MAKE_OPTS} $(MFLAGS) version.def
$(MAKE) $(MFLAGS) Makefile.boot
${MAKE} ${MAKE_OPTS} $(MFLAGS) VerifyOS ${MAKE} ${MAKE_OPTS} $(MFLAGS) VerifyOS
${MAKE} ${MAKE_OPTS} $(MFLAGS) Makefiles ${MAKE} ${MAKE_OPTS} $(MFLAGS) Makefiles
${MAKE} ${MAKE_OPTS} $(MFLAGS) BOOTSTRAPSUBDIRS= clean ${MAKE} ${MAKE_OPTS} $(MFLAGS) BOOTSTRAPSUBDIRS= clean
...@@ -98,37 +65,13 @@ World: ...@@ -98,37 +65,13 @@ World:
# The steps are listed as separate targets so clearmake can wink in # The steps are listed as separate targets so clearmake can wink in
# the Makefile.proto files. # the Makefile.proto files.
Makefile.boot: imake.bootstrap
$(RM) $(IMAKESRC)/Makefile.proto
imake.proto:
cd $(IMAKESRC) && $(MAKE) $(FLAGS)
$(RM) $(DEPENDSRC)/Makefile.proto
$(DEPENDSRC)/Makefile.proto: imake.proto
$(IMAKE_CMD) -s $(DEPENDSRC)/Makefile.proto -f $(DEPENDSRC)/Imakefile -DTOPDIR=$(DEPENDTOP) -DCURDIR=$(DEPENDSRC)
depend.bootstrap: $(DEPENDSRC)/Makefile.proto
cd $(DEPENDSRC) && $(RM) -r Makefile Makefile.dep makedepend *.o bootstrap
cd $(DEPENDSRC) && $(MAKE) -f Makefile.proto bootstrap
$(IMAKESRC)/Makefile.proto: depend.bootstrap
$(IMAKE_CMD) -s $(IMAKESRC)/Makefile.proto -f $(IMAKESRC)/Imakefile -DTOPDIR=$(IMAKETOP) -DCURDIR=$(IMAKESRC) -DBootStrap
imake.bootstrap: $(IMAKESRC)/Makefile.proto
cd $(IMAKESRC) && $(MAKE) -f Makefile.proto bootstrapdepend
cd $(IMAKESRC) && $(MAKE) $(FLAGS) bootstrap
cd $(IMAKESRC) && $(MAKE) -f Makefile.proto imakeonly
-@if [ -f xmakefile ]; then set -x; \
$(RM) xmakefile.bak; $(MV) xmakefile xmakefile.bak; \
else exit 0; fi
$(MAKE) $(MFLAGS) xmakefile
Makefile:: Makefile::
$(MAKE) $(MFLAGS) xmakefile $(MAKE) $(MFLAGS) xmakefile
xmakefile: Imakefile xmakefile: Imakefile
$(RM) xmakefile @if [ -f xmakefile ]; then set -x; \
$(RM) xmakefile.bak; $(MV) xmakefile xmakefile.bak; \
else exit 0; fi
@rm -f $(IRULESRC)/date.def; echo "" > $(IRULESRC)/date.def; @rm -f $(IRULESRC)/date.def; echo "" > $(IRULESRC)/date.def;
$(IMAKE_CMD) -s xmakefile -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) $(IMAKE_CMD) -s xmakefile -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
......
...@@ -8,12 +8,7 @@ XCOMM $XFree86: xc/config/Imakefile,v 1.3 2001/01/17 16:22:29 dawes Exp $ ...@@ -8,12 +8,7 @@ XCOMM $XFree86: xc/config/Imakefile,v 1.3 2001/01/17 16:22:29 dawes Exp $
NULL = NULL =
BOOTSTRAPSUBDIRS = \ SUBDIRS = cf
imake \
makedepend \
$(NULL)
SUBDIRS = cf $(BOOTSTRAPSUBDIRS)
#if defined(XorgVersionString) \ #if defined(XorgVersionString) \
&& defined(ProjectRoot) && \ && defined(ProjectRoot) && \
......
...@@ -1930,9 +1930,7 @@ DependDependencyStatement() @@\ ...@@ -1930,9 +1930,7 @@ DependDependencyStatement() @@\
NoCmpScript(ProgramTargetName($(DEPEND))) @@\ NoCmpScript(ProgramTargetName($(DEPEND))) @@\
@@\ @@\
ProgramTargetName($(DEPEND)): @@\ ProgramTargetName($(DEPEND)): @@\
@echo "checking $@ over in $(DEPENDSRC) first..."; \ @@\ echo "using system-wide depend, continuing in $(CURRENT_DIR)"
cd $(DEPENDSRC) && $(MAKE) makedependonly; \ @@\
echo "okay, continuing in $(CURRENT_DIR)"
#endif /* UseInstalled */ #endif /* UseInstalled */
#endif /* DependDependency */ #endif /* DependDependency */
...@@ -2025,11 +2023,7 @@ target:: ProgramTargetName($(IMAKE)) @@\ ...@@ -2025,11 +2023,7 @@ target:: ProgramTargetName($(IMAKE)) @@\
NoCmpScript(ProgramTargetName($(IMAKE)) $(IMAKE).Osuf) @@\ NoCmpScript(ProgramTargetName($(IMAKE)) $(IMAKE).Osuf) @@\
@@\ @@\
ProgramTargetName($(IMAKE)) $(IMAKE).Osuf: @@\ ProgramTargetName($(IMAKE)) $(IMAKE).Osuf: @@\
-@(cd $(IMAKESRC) && if [ -f Makefile ]; then \ @@\ echo "using system-wide imake, continuing in $(CURRENT_DIR)"
echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) imakeonly; else \ @@\
echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \ @@\
$(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \ @@\
echo "okay, continuing in $(CURRENT_DIR)")
#endif /* UseInstalled */ #endif /* UseInstalled */
#endif /* ImakeDependency */ #endif /* ImakeDependency */
...@@ -3226,12 +3220,8 @@ target:: @@\ ...@@ -3226,12 +3220,8 @@ target:: @@\
fi; \ @@\ fi; \ @@\
done done
#ifdef UseInstalled #define ImakeSubCmdHelper $(IMAKE_CMD) -I$(IMAKEPREFIX)$(IRULESRC) \
#define ImakeSubCmdHelper $(IMAKE_CMD)
#else
#define ImakeSubCmdHelper $(IMAKEPREFIX)$(IMAKE) -I$(IMAKEPREFIX)$(IRULESRC) \
$(IMAKE_DEFINES) $(IMAKE_WARNINGS) $(IMAKE_DEFINES) $(IMAKE_WARNINGS)
#endif
#endif /* MakeMakeSubdirs */ #endif /* MakeMakeSubdirs */
......
...@@ -1386,35 +1386,13 @@ TCLIBDIR = TclLibDir ...@@ -1386,35 +1386,13 @@ TCLIBDIR = TclLibDir
#define LoaderLibPrefix /**/ #define LoaderLibPrefix /**/
#endif #endif
#ifndef ImakeCmd #ifndef ImakeCmd
#ifdef UseInstalled /* assume BINDIR in path */
#define ImakeCmd imake #define ImakeCmd imake
#else
#define ImakeCmd $(IMAKESRC)/imake
#endif
#endif #endif
#ifndef ImakeWarningFlags #ifndef ImakeWarningFlags
#define ImakeWarningFlags /* Nothing */ #define ImakeWarningFlags /* Nothing */
#endif #endif
#ifndef DependCmd #ifndef DependCmd
#if UseGccMakeDepend
#ifdef UseInstalled /* assume BINDIR in path */
#define DependCmd gccmakedep
#else
#define DependCmd $(DEPENDSRC)/gccmakedep
#endif
#elif UseCCMakeDepend
#ifdef UseInstalled /* assume BINDIR in path */
#define DependCmd ccmakedep
#else
#define DependCmd $(DEPENDSRC)/ccmakedep
#endif
#else
#ifdef UseInstalled /* assume BINDIR in path */
#define DependCmd makedepend #define DependCmd makedepend
#else
#define DependCmd $(DEPENDSRC)/makedepend
#endif
#endif
#endif #endif
#ifndef DependDefines #ifndef DependDefines
# if UseCCMakeDepend || UseGccMakeDepend # if UseCCMakeDepend || UseGccMakeDepend
......
...@@ -30,14 +30,12 @@ xorgversion.def \ ...@@ -30,14 +30,12 @@ xorgversion.def \
nxversion.def nxversion.def
RULEFILES = \ RULEFILES = \
Imake.rules \
X11.rules \ X11.rules \
lnxLib.rules \ lnxLib.rules \
noop.rules \ noop.rules \
xf86.rules xf86.rules
TMPLFILES = \ TMPLFILES = \
Imake.tmpl \
Library.tmpl \ Library.tmpl \
Server.tmpl \ Server.tmpl \
ServerLib.tmpl \ ServerLib.tmpl \
...@@ -47,7 +45,6 @@ lnxLib.tmpl \ ...@@ -47,7 +45,6 @@ lnxLib.tmpl \
xorg.tmpl xorg.tmpl
CFFILES = \ CFFILES = \
Imake.cf \
linux.cf \ linux.cf \
xorg.cf xorg.cf
......
XCOMM $XdotOrg: xc/config/imake/Imakefile,v 1.3 2005/10/10 23:49:09 kem Exp $
XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:41:50 cpqbld Exp $
XCOMM
XCOMM
XCOMM
XCOMM
XCOMM $XFree86: xc/config/imake/Imakefile,v 3.18 2003/10/21 17:41:44 tsi Exp $
XCOMM Some compilers generate fatal errors if an -L directory does
XCOMM not exist. Since BUILDLIBDIR may not exist yet suppress its use.
LDPRELIB =
LDPRELIBS =
DEPLIBS =
INCLUDES = -I$(TOP)/include $(TOP_X_INCLUDES)/X11
CPP_PROGRAM = CppCmd
CPP_DEFINES = -DCPP_PROGRAM="\"$(CPP_PROGRAM)\""
GCC_COMMAND = $(CC) -fmerge-constants -xc /dev/null -S -o /dev/null 2> /dev/null 1> /dev/null
GCC_DEFINES = -DHAS_MERGE_CONSTANTS=`if $(GCC_COMMAND); then echo 1; else echo 0; fi`
EXTRA_DEFINES=-DMONOLITH
#ifdef CrossCompileDir
CROSSCOMPILEDIR = CrossCompileDir
CROSSCOMPILEDEFINES=-DCROSSCOMPILE -DCROSSCOMPILEDIR=\"$(CROSSCOMPILEDIR)\"
#else
CROSSCOMPILEDIR =
CROSSCOMPILEDEFINES=
BOOTSTRAPDEFINES =
#endif
DEFINES = $(SIGNAL_DEFINES) $(BOOTSTRAPCFLAGS) $(CPP_DEFINES) $(GCC_DEFINES) \
$(CROSSCOMPILEDEFINES)
EXTRAMANDEFS = -D__cpp__="\"$(CPP_PROGRAM)\""
#if defined(MacIIArchitecture) || defined(SequentArchitecture) || defined(i386ScoArchitecture)
XBSDLIB = /**/
#endif
#ifdef CrossCompileDir
# ifdef TargetPreProcessCmd
CPP = TargetPreProcessCmd
# else
CPP = CrossCompileDir/cc -E -
# endif
IMAKEMDEFS_CPPDEFINES = $(DEFINES) -DCROSSCOMPILE_CPP
CppFileTarget(imakemdep_cpp.h,imakemdep.h,$(IMAKEMDEFS_CPPDEFINES),\
NullParameter)
#endif
#undef ImakeDependency
#define ImakeDependency(dummy) @@\
imake.o: imakemdep_cpp.h @@\
Makefile:: ProgramTargetName(imake)
#if CrossCompiling
SimpleHostProgramTarget(imake)
#else
SimpleProgramTarget(imake)
#endif
imakeonly:: $(PROGRAM)
InstallDriverSDKNamedProg(imake,imake,$(DRIVERSDKDIR)/config/imake)
#if HasClearmake
bootstrapdepend: depend
#else
bootstrapdepend:
#endif
clean::
RemoveFile(ProgramTargetName(ccimake))
RemoveFile(Makefile.proto)
RemoveFile(imakemdep_cpp.h)
$(RM) -r bootstrap
#ifdef OS2Architecture
clean::
RemoveFiles(imake ccimake)
#endif
# $Xorg: Makefile.ini,v 1.3 2000/08/17 19:41:50 cpqbld Exp $
#
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING
#
# This is NOT an automatically generated Makefile! It is hand-crafted as a
# bootstrap, may need editing for your system. The BOOTSTRAPCFLAGS variable
# may be given at the top of the build tree for systems that do not define
# any machine-specific preprocessor symbols.
#
# $XFree86: xc/config/imake/Makefile.ini,v 3.9 2000/10/26 17:57:45 dawes Exp $
CROSSCOMPILEDIR =
CROSSCOMPILEFLAGS = -DCROSSCOMPILEDIR=\"$(CROSSCOMPILEDIR)\"
BOOTSTRAPCFLAGS =
CC = cc
PREPROCESS_CMD = cc -E
CDEBUGFLAGS = -O
INCLUDES = -I../../include -I../../imports/x11/include/X11
CFLAGS = $(BOOTSTRAPCFLAGS) $(CDEBUGFLAGS) $(INCLUDES) -DMONOLITH
IMAKEMDEP_CROSSCOMPILE = -DCROSSCOMPILE_CPP
SHELL = /bin/sh
RM = rm -f
MV = mv
RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
tags TAGS make.log
NPROC = 1
imake::
@echo "making imake with BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS) and CROSSCOMPILEFLAGS=$(CROSSCOMPILEFLAGS) in config/imake"
imake:: imake.o
$(CC) -o imake $(CFLAGS) imake.o
imake.o: ccimake imake.c imakemdep_cpp.h
$(CC) -c $(CFLAGS) `./ccimake` imake.c
ccimake: ccimake.c
$(CC) -o ccimake $(CROSSCOMPILEFLAGS) $(CFLAGS) ccimake.c
imakemdep_cpp.h: ccimake imakemdep.h
if [ -n "$(CROSSCOMPILEDIR)" ] ; then \
$(CROSSCOMPILEDIR)/$(PREPROCESS_CMD) `./ccimake` \
$(IMAKEMDEP_CROSSCOMPILE) imakemdep.h > imakemdep_cpp.h; \
else touch imakemdep_cpp.h; fi
# a derived object erroneously would get shared across platforms by clearmake
.NO_CONFIG_REC: ccimake
bootstrap:
-@if [ -d bootstrap ]; then exit 0; else set -x; mkdir bootstrap; fi
$(MV) *.o bootstrap
@if [ -f imake.exe ]; then set -x; $(MV) imake.exe bootstrap; \
elif [ -f imake ]; then set -x; $(MV) imake bootstrap; else exit 0; fi
relink:
$(RM) imake
$(MAKE) $(MFLAGS) imake
clean:
$(RM) ccimake imake.o imake
$(RM_CMD) \#*
$(RM) -r Makefile.proto Makefile Makefile.dep bootstrap
$(RM) imakemdep_cpp.h
depend:
imake.exe::
@echo making imake with BOOTSTRAPCFLAGS=-DWIN32
imake.exe:: imake.obj
cl -nologo imake.obj libc.lib kernel32.lib
imake.obj: imake.c
cl -nologo -W2 -D__STDC__ -c -DWIN32 $(CFLAGS) imake.c
clean.Win32:
if exist imake.exe del imake.exe
if exist imake.obj del imake.obj
clean.os2:
imakesvc 4 imake imake.exe imake.o /imake.exe
imake.os2: imake.c
$(CC) -DBSD43 $(CFLAGS) -o imake.exe imake.c
copy imake.exe \\
/* $Xorg: ccimake.c,v 1.4 2001/02/09 02:03:15 xorgcvs Exp $ */
/*
Copyright (c) 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group .
*/
/* $XFree86: xc/config/imake/ccimake.c,v 1.2 2001/04/01 13:59:56 tsi Exp $ */
/*
* Warning: This file must be kept as simple as possible so that it can
* compile without any special flags on all systems. Do not touch it unless
* you *really* know what you're doing. Make changes in imakemdep.h, not here.
*/
#define CCIMAKE /* only get imake_ccflags definitions */
#include "imakemdep.h" /* things to set when porting imake */
#ifndef imake_ccflags
# define imake_ccflags "-O"
#endif
#ifndef CROSSCOMPILEDIR
# define CROSSCOMPILEDIR ""
#endif
#define crosscompile_ccflags " -DCROSSCOMPILE "
#define crosscompiledir_str "-DCROSSCOMPILEDIR="
int
main()
{
if (CROSSCOMPILEDIR[0] != '\0') {
write(1, crosscompiledir_str, sizeof(crosscompiledir_str) - 1);
write(1,"\"",1);
write(1, CROSSCOMPILEDIR, sizeof(CROSSCOMPILEDIR) - 1);
write(1,"\"",1);
write(1, crosscompile_ccflags, sizeof(crosscompile_ccflags) - 1);
}
write(1, imake_ccflags, sizeof(imake_ccflags) - 1);
return 0;
}
/* Rexx OS/2
* This script serves as a helper cmd file for imake. Install this in
* the path just like imake itself.
*
* $XFree86: xc/config/imake/imakesvc.cmd,v 3.13 1999/04/29 09:13:23 dawes Exp $
*/
'@echo off'
ADDRESS CMD
CALL RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete'
CALL RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
CALL RxFuncAdd 'SysRmDir', 'RexxUtil', 'SysRmDir'
CALL RxFuncAdd 'SysMkDir', 'RexxUtil', 'SysMkDir'
PARSE ARG all
code = WORD(all,1)
SELECT
WHEN code=1 THEN DO
/* imakesvc 1 u/n dir ruledir top current */
instflg = WORD(all,2)
imakecmd = '\imake'
ruledir = WORD(all,4)
topdir = WORD(all,5)
currentdir = WORD(all,6)
IF instflg = 'u' THEN DO
root = VALUE('X11ROOT',,'OS2ENVIRONMENT')
IF root = '' THEN DO
SAY 'Fatal error: no X11ROOT environment variable found!'
EXIT 99
END
imakecmd = 'imake'
IF POS(':',ruledir) = 0 THEN
ruledir1 = root||ruledir
ELSE
ruledir1 = ruledir
topdir1 = topdir
useinst = '-DUseInstalled'
END
ELSE DO
/* in n mode, we must add a prefix ../ for MakeMakeSubdirs */
ruledir1 = '../'||ruledir
topdir1 = '../'||topdir
useinst = ''
END
ruledir = ruledir1
topdir = topdir1
curdir = DIRECTORY()
dir = fixbadprefix(WORD(all,3))
d = DIRECTORY(dir)
dirfwd=TRANSLATE(dir,'/','\')
RC = SysFileDelete('Makefile.bak')
IF exists('Makefile') THEN REN Makefile Makefile.bak
/* There is a difficulty in the Imakefiles. Some builds refer
* to directories that are in a different subtree. We need to adjust
* the CURDIR and TOPDIR and -I paths
*/
IF SUBSTR(dirfwd,1,2)='..' THEN DO
/* must recalculate passed topdir, currentdir, and ruledir */
ndist = nlevels(topdir)
ncurdir = './'striplevel(dirfwd,ndist-1)
ntopdir = maketop(nlevels(ncurdir))
nruledir = ntopdir||'/config/cf'
END
ELSE DO
/* this is simple it is relative to this dir */
pfx = downlevels(dirfwd)
nruledir = ruledir
IF instflg = 'n' THEN DO /*sm120296*/
nruledir = pfx||ruledir
END
ntopdir = pfx||topdir
ncurdir = currentdir /* use to be pfx || currentdir */
END
imakecmd useinst '-I'nruledir' -DTOPDIR='ntopdir' -DCURDIR='ncurdir'/'dirfwd
'x11make MAKE=x11make SHELL= Makefiles'
d = DIRECTORY(curdir)
END
WHEN code=2 THEN DO
/* imakesvc 2 buildincdir buildinctop currentdir file */
bid = WORD(all,3)
cid = WORD(all,4)
fil = WORD(all,5)
curdir = DIRECTORY()
d = DIRECTORY(WORD(all,2))
rc = SysFileDelete(fil)
dir = TRANSLATE(bid'/'cid'/'fil,'\','/')
COPY dir .' >nul 2>&1 '
d = DIRECTORY(curdir)
END
WHEN code=3 THEN DO
/* imakesvc 3 subdir updir file */
sdi = WORD(all,2)
fil = WORD(all,4)
curdir = DIRECTORY()
d = DIRECTORY(WORD(all,3))
rc = SysFileDelete(fil)
dir = TRANSLATE(sdi'/'fil,'\','/')
COPY dir' . >nul 2>&1'
d = DIRECTORY(curdir)
END
WHEN code=4 THEN DO
/* imakesvc 4 [-r] files... */
rec = WORD(all,2)
fp = 2
IF rec = '-r' THEN fp = 3
ELSE rec = '-n'
DO i=fp TO WORDS(all)
CALL discard rec,TRANSLATE(WORD(all,i),'\','/')
END
END
WHEN code=5 THEN DO
/* imakesvc 5 file */
file = TRANSLATE(WORD(all,2),'\','/')
RC = SysFileDelete(file'.bak')
if exists(file) THEN 'REN 'file file||'.bak'
END
WHEN code=6 THEN DO
/* imakesvc 6 file */
file = TRANSLATE(WORD(all,2),'\','/')
CALL SysFileDelete(file||'.bak')
if exists(file) THEN 'REN 'file file||'.bak'
END
WHEN code=7 THEN DO
/* imakesvc 7 from to */
from = TRANSLATE(WORD(all,2),'\','/')
to = TRANSLATE(WORD(all,3),'\','/')
CALL SysFileDelete(to)
COPY from to' >nul 2>&1'
END
WHEN code=8 THEN DO
/* imakesvc 8 arg */
SAY SUBWORD(TRANSLATE(all,' ','222c'x),2)
END
WHEN code=9 THEN DO
/* imakesvc 9 dst.c incl.h src.c */
dst = TRANSLATE(WORD(all,2),'\','/')
src = TRANSLATE(WORD(all,4),'\','/')
CALL SysFileDelete(dst)
CALL LINEOUT dst,'#include "'WORD(all,3)'"'
CALL LINEOUT dst,'#include "'src'"'
CALL LINEOUT dst
END
WHEN code=10 THEN DO
/* imakesvc 10 srcfile destdir destfile suffix */
src = stripsuffix(WORD(all,2))
destdir = TRANSLATE(WORD(all,3),'\','/')
dest = stripsuffix(WORD(all,4))
suffix = WORD(all,5)
tgt = destdir'\'dest'.'suffix
/* if you have no col.exe get one from 4.4BSD */
'groff -e -t -man -Tascii 'src'.man | col -b >'tgt
END
WHEN code=11 THEN DO
/* imakesvc 11 dirtomake */
dirtomake = TRANSLATE(WORD(all,2),'\','/')
rc = SysMkDir(dirtomake)
END
WHEN code=12 THEN DO
/* imakesvc 12 srcfile destdir destfile */
src = stripsuffix(WORD(all,2))
destdir = TRANSLATE(WORD(all,3),'\','/')
dest = stripsuffix(WORD(all,4))
tgt = destdir'\'dest'.gz'
/* if you have no col.exe get one from 4.4BSD */
'groff -e -t -man -Tascii 'src'.man | col -b | gzip -n >'tgt
END
WHEN code=13 THEN DO
/* imakesvc 13 indir fromfile tofile */
ind = TRANSLATE(WORD(all,2),'\','/')
frm = TRANSLATE(WORD(all,3),'\','/')
tof = ind'\'WORD(all,4)
IF \(exists(ind)) THEN call SysMkDir ind
rc = SysFileDelete(tof)
COPY frm' 'tof
END
WHEN code=14 THEN DO
/* imakesvc 14 destdir srcfile... */
destdir = TRANSLATE(WORD(all,2),'\','/')
DO i=3 TO WORDS(all)
src = stripsuffix(WORD(all,i))
tgt = destdir'\'src'.gz'
'groff -e -t -man -Tascii 'src'.man | col -b | gzip -n >'tgt
END
END
WHEN code=15 THEN DO
/* imakesvc 15 destdir suffix srcfile... */
destdir = TRANSLATE(WORD(all,2),'\','/')
suffix = WORD(all,3)
DO i=4 TO WORDS(all)
src = stripsuffix(WORD(all,i))
tgt = destdir'\'src'.'suffix
'groff -e -t -man -Tascii 'src'.man | col -b >'tgt
END
END
WHEN code=16 THEN DO
/* imakesvc 16 dirlist...*/
mkfontdir = TRANSLATE(WORD(all,2),'\','/')
earg=''
DO i=3 TO WORDS(all)
arg = WORD(all,i)
earg = earg' -e 'arg
END
mkfontdir' -r -p inst/ 'earg' .'
END
OTHERWISE NOP
END
RETURN
downlevels:
oldpos = 1
pfx = ''
DO FOREVER
newpos = POS('/',ARG(1),oldpos)
IF newpos = 0 THEN LEAVE
newpfx = '../'pfx
oldpos = newpos+1
pfx = newpfx
END
RETURN pfx
/* returns 1, if file exists */
exists:
'DIR "'arg(1)'" >nul 2>&1'
IF rc = 0 THEN return 1
RETURN 0
discard: PROCEDURE
rec=ARG(1)
files=ARG(2)
IF rec = '-r' THEN DO
old = DIRECTORY()
nd = DIRECTORY
CALL SysFileTree files, 'deld', 'DO'
IF deld.0 > 0 THEN DO
DO m=1 TO deld.0
CALL DIRECTORY deld.m
CALL discard '-R' .
CALL DIRECTORY ..
CALL SysRmDir deld.m
END
CALL SysRmDir files
END
CALL SysFileTree files, 'delf', 'FO'
DO k=1 TO delf.0
DEL '"'delf.k'"' '>nul 2>&1'
END
CALL SysRmDir files
END
ELSE DO
DEL '"'files'"' '>nul 2>&1'
END
RETURN
/* somehow make or cmd manages to convert a relative path ..\..\. to ..... */
fixbadprefix:
count = 1
str = ARG(1)
DO WHILE SUBSTR(str,count,2) = '..'
count = count+1
str = INSERT('\',str,count)
count = count+2
END
RETURN str
striplevel:
str=ARG(1)
n=arg(2)
DO count=0 TO n
p = POS('/',str)
IF p = 0 THEN LEAVE
str = DELSTR(str,1,p)
END
RETURN str
nlevels:
str = ARG(1)
count = 0
oldpos = 1
DO FOREVER
newpos = POS('/',str,oldpos)
IF newpos = 0 THEN LEAVE
oldpos = newpos + 1
count = count + 1
END
RETURN count
maketop:
str = ''
n = ARG(1)
DO k=1 TO n
str = str||'../'
END
RETURN str||'.'
stripsuffix:
str = ARG(1)
spos = POS('.',str)
IF spos = 0 THEN
RETURN str
ELSE
RETURN LEFT(str,spos-1)
XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:41:50 cpqbld Exp $
XCOMM
XCOMM
XCOMM
XCOMM
XCOMM $XFree86: xc/config/makedepend/Imakefile,v 3.12tsi Exp $
SRCS = include.c main.c parse.c pr.c cppsetup.c ifparser.c
OBJS = include.o main.o parse.o pr.o cppsetup.o ifparser.o
XCOMM Some compilers generate fatal errors if an -L directory does
XCOMM not exist. Since BUILDLIBDIR may not exist yet suppress its use.
LDPRELIB =
LDPRELIBS =
#if HasGcc && !defined(PreIncDir)
#ifdef CrossCompileDir
#else
#define PreIncDir /usr/local/lib/gcc-include
#endif
#endif
#ifdef PreIncDir
PREINCDIR = PreIncDir
PREINC_DEFINES = -DPREINCDIR=\"$(PREINCDIR)\"
#endif
#ifndef StdIncDir
#ifdef CrossCompileDir
#define StdIncDir Concat(CrossCompileDir,/../include)
#else
#define StdIncDir /usr/include
#endif
#endif
STDINCDIR = StdIncDir
STDINC_DEFINES = -DINCLUDEDIR=\"$(STDINCDIR)\"
#ifdef PostIncDir
POSTINCDIR = PostIncDir
POSTINC_DEFINES = -DPOSTINCDIR=\"$(POSTINCDIR)\"
#endif
#ifdef ExtraIncDir
EXTRAINCDIR = ExtraIncDir
EXTRAINC_DEFINES = -DEXTRAINCDIR=\"$(EXTRAINCDIR)\"
#endif
INC_DEFINES = $(PREINC_DEFINES) $(STDINC_DEFINES) $(POSTINC_DEFINES) \
$(EXTRAINC_DEFINES)
OSUF = Concat(.,Osuf)
OSUF_DEFINES = -DOBJSUFFIX=\"$(OSUF)\"
MAIN_DEFINES = $(INC_DEFINES) $(SIGNAL_DEFINES) $(OSUF_DEFINES)
INCLUDES = -I$(IMAKESRC) -I$(TOP)/include $(TOP_X_INCLUDES)/X11
DEPLIBS =
#if defined(MacIIArchitecture) || defined(SequentArchitecture) || defined(i386ScoArchitecture)
XBSDLIB = /**/
#endif
AllTarget(HostProgramTargetName(makedepend))
makedependonly:: HostProgramTargetName(makedepend)
/*
* bootstrapping: want to build the real makedepend
* only after we've run "make depend" here. That way
* the program has the right dependencies for clearmake.
* Save the bootstrap original files so they can be winked in
* to other views.
*/
#if HasClearmake
bootstrap:
test -h X11 || $(LN) TOPDIR/include X11
$(MAKE) -f Makefile.proto TOP_INCLUDES=-I. makedepend
depend::
$(MAKE) -f Makefile.proto depend
test -d bootstrap || mkdir bootstrap
$(MV) *.o makedepend bootstrap
$(MAKE) -f Makefile.proto makedepend
clean::
$(RM) -r bootstrap
$(RM) X11
#else
bootstrap:
#endif /* HasClearmake */
clean::
$(RM) Makefile.proto
#undef InstallManPage
#define InstallManPage(file,dest) /* as nothing */
#if CrossCompiling
ComplexHostProgramTarget(makedepend)
#else
ComplexProgramTarget(makedepend)
#endif
SpecialCObjectRule(main,$(ICONFIGFILES),$(MAIN_DEFINES))
InstallManPageLong(mkdepend,$(MANDIR),makedepend)
InstallDriverSDKNamedProg(makedepend,makedepend,$(DRIVERSDKDIR)/config/makedepend)
#
# $Xorg: cpp.ed,v 1.3 2000/08/17 19:41:50 cpqbld Exp $
#
# $Locker $
#
/struct symtab stab/d
/struct symtab \*defloc;/d
/struct symtab \*udfloc;/d
/struct symtab \*incloc;/d
/struct symtab \*ifloc;/d
/struct symtab \*elsloc;/d
/struct symtab \*eifloc;/d
/struct symtab \*ifdloc;/d
/struct symtab \*ifnloc;/d
/struct symtab \*ysysloc;/d
/struct symtab \*varloc;/d
/struct symtab \*lneloc;/d
/struct symtab \*ulnloc;/d
/struct symtab \*uflloc;/d
/^sayline(/s/$/ DELETED/p
.,/^}/d
/^unfill(/s/$/ DELETED/p
.-1,/^}/d
/^doincl(/s/$/ DELETED/p
.-1,/^}/d
/^equfrm(/s/$/ DELETED/p
.,/^}/d
/^dodef(/s/$/ DELETED/p
.-1,/^}/d
/^control(/s/$/ DELETED/p
.-1,/^}/d
/^savestring(/s/$/ DELETED/p
.-1,/^}/d
/^stsym(/s/$/ DELETED/p
.-1,/^}/d
/^ppsym(/s/$/ DELETED/p
.-1,/^}/d
/^yyerror(/s/$/ DELETED/p
.,/^}/d
/^ppwarn(/s/$/ DELETED/p
.,/^}/d
/^lookup(/s/$/ DELETED/p
.-1,/^}/d
/^subst(/s/$/ DELETED/p
.-1,/^}/d
/^trmdir(/s/$/ DELETED/p
.-1,/^}/d
/^copy(/s/$/ DELETED/p
.-1,/^}/d
/^pperror(/s/$/ DELETED/p
.,/^}/d
/^main(/s/$/ CHANGED to cpp_varsetup(argc,argv)/p
.c
cpp_varsetup(argc,argv)
.
/^strdex(/s/$/ DELETED/p
.-1,/^}/d
/^ for(i=1; i<argc; i++)/s/$/ To the end DELETED/p
.,$c
}
.
/^dump(/s/$/ DELETED/p
.,/^}/c
dump() { fatal("dump\n"); }
.
/^refill(/s/$/ DELETED/p
.,/^}/c
refill() { fatal("refill\n"); }
.
/^slookup(/s/$/ DELETED/p
.-1,/^}/c
static struct symtab *slookup() { fatal("slookup\n"); }
.
w
q
/* $Xorg: cppsetup.c,v 1.5 2001/02/09 02:03:16 xorgcvs Exp $ */
/*
Copyright (c) 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/config/makedepend/cppsetup.c,v 3.10 2001/12/14 19:53:20 dawes Exp $ */
#include "def.h"
#ifdef CPP
/*
* This file is strictly for the sake of cpy.y and yylex.c (if
* you indeed have the source for cpp).
*/
#define IB 1
#define SB 2
#define NB 4
#define CB 8
#define QB 16
#define WB 32
#define SALT '#'
#if defined(pdp11) || defined(vax) || defined(ns16000) || defined(mc68000) || defined(ibm032)
#define COFF 128
#else
#define COFF 0
#endif
/*
* These variables used by cpy.y and yylex.c
*/
extern char *outp, *inp, *newp, *pend;
extern char *ptrtab;
extern char fastab[];
extern char slotab[];
/*
* cppsetup
*/
struct filepointer *currentfile;
struct inclist *currentinc;
int
cppsetup(char *line, struct filepointer *filep, struct inclist *inc)
{
char *p, savec;
static boolean setupdone = FALSE;
boolean value;
if (!setupdone) {
cpp_varsetup();
setupdone = TRUE;
}
currentfile = filep;
currentinc = inc;
inp = newp = line;
for (p=newp; *p; p++)
;
/*
* put a newline back on the end, and set up pend, etc.
*/
*p++ = '\n';
savec = *p;
*p = '\0';
pend = p;
ptrtab = slotab+COFF;
*--inp = SALT;
outp=inp;
value = yyparse();
*p = savec;
return(value);
}
struct symtab **lookup(symbol)
char *symbol;
{
static struct symtab *undefined;
struct symtab **sp;
sp = isdefined(symbol, currentinc, NULL);
if (sp == NULL) {
sp = &undefined;
(*sp)->s_value = NULL;
}
return (sp);
}
pperror(tag, x0,x1,x2,x3,x4)
int tag,x0,x1,x2,x3,x4;
{
warning("\"%s\", line %d: ", currentinc->i_file, currentfile->f_line);
warning(x0,x1,x2,x3,x4);
}
yyerror(s)
register char *s;
{
fatalerr("Fatal error: %s\n", s);
}
#else /* not CPP */
#include "ifparser.h"
struct _parse_data {
struct filepointer *filep;
struct inclist *inc;
char *filename;
const char *line;
};
static const char *
my_if_errors (IfParser *ip, const char *cp, const char *expecting)
{
struct _parse_data *pd = (struct _parse_data *) ip->data;
int lineno = pd->filep->f_line;
char *filename = pd->filename;
char prefix[300];
int prefixlen;
int i;
sprintf (prefix, "\"%s\":%d", filename, lineno);
prefixlen = strlen(prefix);
fprintf (stderr, "%s: %s", prefix, pd->line);
i = cp - pd->line;
if (i > 0 && pd->line[i-1] != '\n') {
putc ('\n', stderr);
}
for (i += prefixlen + 3; i > 0; i--) {
putc (' ', stderr);
}
fprintf (stderr, "^--- expecting %s\n", expecting);
return NULL;
}
#define MAXNAMELEN 256
static struct symtab **
lookup_variable (IfParser *ip, const char *var, int len)
{
char tmpbuf[MAXNAMELEN + 1];
struct _parse_data *pd = (struct _parse_data *) ip->data;
if (len > MAXNAMELEN)
return 0;
strncpy (tmpbuf, var, len);
tmpbuf[len] = '\0';
return isdefined (tmpbuf, pd->inc, NULL);
}
static int
my_eval_defined (IfParser *ip, const char *var, int len)
{
if (lookup_variable (ip, var, len))
return 1;
else
return 0;
}
#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_')
static long
my_eval_variable (IfParser *ip, const char *var, int len)
{
long val;
struct symtab **s;
s = lookup_variable (ip, var, len);
if (!s)
return 0;
do {
var = (*s)->s_value;
if (!isvarfirstletter(*var) || !strcmp((*s)->s_name, var))
break;
s = lookup_variable (ip, var, strlen(var));
} while (s);
var = ParseIfExpression(ip, var, &val);
if (var && *var) debug(4, ("extraneous: '%s'\n", var));
return val;
}
int
cppsetup(char *filename,
char *line,
struct filepointer *filep,
struct inclist *inc)
{
IfParser ip;
struct _parse_data pd;
long val = 0;
pd.filep = filep;
pd.inc = inc;
pd.line = line;
pd.filename = filename;
ip.funcs.handle_error = my_if_errors;
ip.funcs.eval_defined = my_eval_defined;
ip.funcs.eval_variable = my_eval_variable;
ip.data = (char *) &pd;
(void) ParseIfExpression (&ip, line, &val);
if (val)
return IF;
else
return IFFALSE;
}
#endif /* CPP */
/* $XdotOrg: xc/config/makedepend/def.h,v 1.4 2005/07/29 18:42:37 kem Exp $ */
/* $Xorg: def.h,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */
/*
Copyright (c) 1993, 1994, 1998 The Open Group.
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/config/makedepend/def.h,v 3.13tsi Exp $ */
#ifdef HAVE_CONFIG_H /* Autotooled for Xorg 7.0? */
# include "makedepend-config.h"
# define USING_AUTOCONF
#endif
#include <X11/Xos.h>
#include <X11/Xfuncproto.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#if 0
#ifndef X_NOT_POSIX
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#endif
#endif
#endif
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#define MAXDEFINES 512
#define MAXFILES 1024
#define MAXINCFILES 128 /* "-include" files */
#define MAXDIRS 64
#define SYMTABINC 10 /* must be > 1 for define() to work right */
#define TRUE 1
#define FALSE 0
/* the following must match the directives table in main.c */
#define IF 0
#define IFDEF 1
#define IFNDEF 2
#define ELSE 3
#define ENDIF 4
#define DEFINE 5
#define UNDEF 6
#define INCLUDE 7
#define LINE 8
#define PRAGMA 9
#define ERROR 10
#define IDENT 11
#define SCCS 12
#define ELIF 13
#define EJECT 14
#define WARNING 15
#define INCLUDENEXT 16
#define IFFALSE 17 /* pseudo value --- never matched */
#define ELIFFALSE 18 /* pseudo value --- never matched */
#define INCLUDEDOT 19 /* pseudo value --- never matched */
#define IFGUESSFALSE 20 /* pseudo value --- never matched */
#define ELIFGUESSFALSE 21 /* pseudo value --- never matched */
#define INCLUDENEXTDOT 22 /* pseudo value --- never matched */
#ifdef DEBUG
extern int _debugmask;
/*
* debug levels are:
*
* 0 show ifn*(def)*,endif
* 1 trace defined/!defined
* 2 show #include
* 3 show #include SYMBOL
* 4-6 unused
*/
#define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
#else
#define debug(level,arg) /**/
#endif /* DEBUG */
typedef unsigned char boolean;
struct symtab {
char *s_name;
char *s_value;
};
/* possible i_flag */
#define DEFCHECKED (1<<0) /* whether defines have been checked */
#define NOTIFIED (1<<1) /* whether we have revealed includes */
#define MARKED (1<<2) /* whether it's in the makefile */
#define SEARCHED (1<<3) /* whether we have read this */
#define FINISHED (1<<4) /* whether we are done reading this */
#define INCLUDED_SYM (1<<5) /* whether #include SYMBOL was found
Can't use i_list if TRUE */
struct inclist {
char *i_incstring; /* string from #include line */
char *i_file; /* path name of the include file */
struct inclist **i_list; /* list of files it itself includes */
int i_listlen; /* length of i_list */
struct symtab **i_defs; /* symbol table for this file and its
children when merged */
int i_ndefs; /* current # defines */
boolean *i_merged; /* whether we have merged child
defines */
unsigned char i_flags;
};
struct filepointer {
char *f_name;
char *f_p;
char *f_base;
char *f_end;
long f_len;
long f_line;
long cmdinc_count;
char **cmdinc_list;
long cmdinc_line;
};
#include <stdlib.h>
#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
char *malloc(), *realloc();
#endif /* macII */
char *copy(char *str);
int match(char *str, char **list);
char *base_name(char *file);
char *getnextline(struct filepointer *fp);
struct symtab **slookup(char *symbol, struct inclist *file);
struct symtab **isdefined(char *symbol, struct inclist *file,
struct inclist **srcfile);
struct symtab **fdefined(char *symbol, struct inclist *file,
struct inclist **srcfile);
struct filepointer *getfile(char *file);
void included_by(struct inclist *ip,
struct inclist *newfile);
struct inclist *newinclude(char *newfile, char *incstring);
void inc_clean (void);
struct inclist *inc_path(char *file, char *include, int type);
void freefile(struct filepointer *fp);
void define2(char *name, char *val, struct inclist *file);
void define(char *def, struct inclist *file);
void undefine(char *symbol, struct inclist *file);
int find_includes(struct filepointer *filep,
struct inclist *file,
struct inclist *file_red,
int recursion, boolean failOK);
void recursive_pr_include(struct inclist *head,
char *file, char *base);
void add_include(struct filepointer *filep,
struct inclist *file,
struct inclist *file_red,
char *include, int type,
boolean failOK);
int cppsetup(char *filename,
char *line,
struct filepointer *filep,
struct inclist *inc);
extern void fatalerr(char *, ...);
extern void warning(char *, ...);
extern void warning1(char *, ...);
/*
* $Xorg: ifparser.h,v 1.3 2000/08/17 19:41:51 cpqbld Exp $
*
* Copyright 1992 Network Computing Devices, Inc.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Network Computing Devices may not be
* used in advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. Network Computing Devices makes
* no representations about the suitability of this software for any purpose.
* It is provided ``as is'' without express or implied warranty.
*
* NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* Author: Jim Fulton
* Network Computing Devices, Inc.
*
* Simple if statement processor
*
* This module can be used to evaluate string representations of C language
* if constructs. It accepts the following grammar:
*
* EXPRESSION := VALUE
* | VALUE BINOP EXPRESSION
* | VALUE '?' EXPRESSION ':' EXPRESSION
*
* VALUE := '(' EXPRESSION ')'
* | '!' VALUE
* | '-' VALUE
* | '~' VALUE
* | 'defined' '(' variable ')'
* | variable
* | number
*
* BINOP := '*' | '/' | '%'
* | '+' | '-'
* | '<<' | '>>'
* | '<' | '>' | '<=' | '>='
* | '==' | '!='
* | '&' | '^' | '|'
* | '&&' | '||'
*
* The normal C order of precedence is supported.
*
*
* External Entry Points:
*
* ParseIfExpression parse a string for #if
*/
/* $XFree86: xc/config/makedepend/ifparser.h,v 3.4 2001/01/17 16:38:58 dawes Exp $ */
#include <stdio.h>
typedef int Bool;
#define False 0
#define True 1
typedef struct _if_parser {
struct { /* functions */
const char *(*handle_error) (struct _if_parser *, const char *,
const char *);
long (*eval_variable) (struct _if_parser *, const char *, int);
int (*eval_defined) (struct _if_parser *, const char *, int);
} funcs;
char *data;
} IfParser;
const char *ParseIfExpression (
IfParser *,
const char *,
long *
);
/* $Xorg: include.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */
/*
Copyright (c) 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/config/makedepend/include.c,v 3.6 2001/04/29 23:25:02 tsi Exp $ */
#include "def.h"
extern struct inclist inclist[ MAXFILES ],
*inclistp, *inclistnext;
extern char *includedirs[ ],
**includedirsnext;
extern char *notdotdot[ ];
extern boolean show_where_not;
extern boolean warn_multiple;
static boolean
isdot(char *p)
{
if(p && *p++ == '.' && *p++ == '\0')
return(TRUE);
return(FALSE);
}
static boolean
isdotdot(char *p)
{
if(p && *p++ == '.' && *p++ == '.' && *p++ == '\0')
return(TRUE);
return(FALSE);
}
static boolean
issymbolic(char *dir, char *component)
{
#ifdef S_IFLNK
struct stat st;
char buf[ BUFSIZ ], **pp;
sprintf(buf, "%s%s%s", dir, *dir ? "/" : "", component);
for (pp=notdotdot; *pp; pp++)
if (strcmp(*pp, buf) == 0)
return (TRUE);
if (lstat(buf, &st) == 0
&& (st.st_mode & S_IFMT) == S_IFLNK) {
*pp++ = copy(buf);
if (pp >= &notdotdot[ MAXDIRS ])
fatalerr("out of .. dirs, increase MAXDIRS\n");
return(TRUE);
}
#endif
return(FALSE);
}
/*
* Occasionally, pathnames are created that look like .../x/../y
* Any of the 'x/..' sequences within the name can be eliminated.
* (but only if 'x' is not a symbolic link!!)
*/
static void
remove_dotdot(char *path)
{
register char *end, *from, *to, **cp;
char *components[ MAXFILES ],
newpath[ BUFSIZ ];
boolean component_copied;
/*
* slice path up into components.
*/
to = newpath;
if (*path == '/')
*to++ = '/';
*to = '\0';
cp = components;
for (from=end=path; *end; end++)
if (*end == '/') {
while (*end == '/')
*end++ = '\0';
if (*from)
*cp++ = from;
from = end;
}
*cp++ = from;
*cp = NULL;
/*
* Recursively remove all 'x/..' component pairs.
*/
cp = components;
while(*cp) {
if (!isdot(*cp) && !isdotdot(*cp) && isdotdot(*(cp+1))
&& !issymbolic(newpath, *cp))
{
char **fp = cp + 2;
char **tp = cp;
do
*tp++ = *fp; /* move all the pointers down */
while (*fp++);
if (cp != components)
cp--; /* go back and check for nested ".." */
} else {
cp++;
}
}
/*
* Concatenate the remaining path elements.
*/
cp = components;
component_copied = FALSE;
while(*cp) {
if (component_copied)
*to++ = '/';
component_copied = TRUE;
for (from = *cp; *from; )
*to++ = *from++;
*to = '\0';
cp++;
}
*to++ = '\0';
/*
* copy the reconstituted path back to our pointer.
*/
strcpy(path, newpath);
}
/*
* Add an include file to the list of those included by 'file'.
*/
struct inclist *
newinclude(char *newfile, char *incstring)
{
register struct inclist *ip;
/*
* First, put this file on the global list of include files.
*/
ip = inclistp++;
if (inclistp == inclist + MAXFILES - 1)
fatalerr("out of space: increase MAXFILES\n");
ip->i_file = copy(newfile);
if (incstring == NULL)
ip->i_incstring = ip->i_file;
else
ip->i_incstring = copy(incstring);
inclistnext = inclistp;
return(ip);
}
void
included_by(struct inclist *ip, struct inclist *newfile)
{
register int i;
if (ip == NULL)
return;
/*
* Put this include file (newfile) on the list of files included
* by 'file'. If 'file' is NULL, then it is not an include
* file itself (i.e. was probably mentioned on the command line).
* If it is already on the list, don't stick it on again.
*/
if (ip->i_list == NULL) {
ip->i_list = (struct inclist **)
malloc(sizeof(struct inclist *) * ++ip->i_listlen);
ip->i_merged = (boolean *)
malloc(sizeof(boolean) * ip->i_listlen);
} else {
for (i=0; i<ip->i_listlen; i++)
if (ip->i_list[ i ] == newfile) {
i = strlen(newfile->i_file);
if (!(ip->i_flags & INCLUDED_SYM) &&
!(i > 2 &&
newfile->i_file[i-1] == 'c' &&
newfile->i_file[i-2] == '.'))
{
/* only bitch if ip has */
/* no #include SYMBOL lines */
/* and is not a .c file */
if (warn_multiple)
{
warning("%s includes %s more than once!\n",
ip->i_file, newfile->i_file);
warning1("Already have\n");
for (i=0; i<ip->i_listlen; i++)
warning1("\t%s\n", ip->i_list[i]->i_file);
}
}
return;
}
ip->i_list = (struct inclist **) realloc(ip->i_list,
sizeof(struct inclist *) * ++ip->i_listlen);
ip->i_merged = (boolean *)
realloc(ip->i_merged, sizeof(boolean) * ip->i_listlen);
}
ip->i_list[ ip->i_listlen-1 ] = newfile;
ip->i_merged[ ip->i_listlen-1 ] = FALSE;
}
void
inc_clean (void)
{
register struct inclist *ip;
for (ip = inclist; ip < inclistp; ip++) {
ip->i_flags &= ~MARKED;
}
}
struct inclist *
inc_path(char *file, char *include, int type)
{
static char path[ BUFSIZ ];
register char **pp, *p;
register struct inclist *ip;
struct stat st;
/*
* Check all previously found include files for a path that
* has already been expanded.
*/
if ((type == INCLUDE) || (type == INCLUDEDOT))
inclistnext = inclist;
ip = inclistnext;
for (; ip->i_file; ip++) {
if ((strcmp(ip->i_incstring, include) == 0) &&
!(ip->i_flags & INCLUDED_SYM)) {
inclistnext = ip + 1;
return ip;
}
}
if (inclistnext == inclist) {
/*
* If the path was surrounded by "" or is an absolute path,
* then check the exact path provided.
*/
if ((type == INCLUDEDOT) ||
(type == INCLUDENEXTDOT) ||
(*include == '/')) {
if (stat(include, &st) == 0)
return newinclude(include, include);
if (show_where_not)
warning1("\tnot in %s\n", include);
}
/*
* If the path was surrounded by "" see if this include file is
* in the directory of the file being parsed.
*/
if ((type == INCLUDEDOT) || (type == INCLUDENEXTDOT)) {
for (p=file+strlen(file); p>file; p--)
if (*p == '/')
break;
if (p == file) {
strcpy(path, include);
} else {
strncpy(path, file, (p-file) + 1);
path[ (p-file) + 1 ] = '\0';
strcpy(path + (p-file) + 1, include);
}
remove_dotdot(path);
if (stat(path, &st) == 0)
return newinclude(path, include);
if (show_where_not)
warning1("\tnot in %s\n", path);
}
}
/*
* Check the include directories specified. Standard include dirs
* should be at the end.
*/
if ((type == INCLUDE) || (type == INCLUDEDOT))
includedirsnext = includedirs;
pp = includedirsnext;
for (; *pp; pp++) {
sprintf(path, "%s/%s", *pp, include);
remove_dotdot(path);
if (stat(path, &st) == 0) {
includedirsnext = pp + 1;
return newinclude(path, include);
}
if (show_where_not)
warning1("\tnot in %s\n", path);
}
return NULL;
}
.\" $Xorg: mkdepend.man,v 1.5 2001/02/09 02:03:16 xorgcvs Exp $
.\" Copyright (c) 1993, 1994, 1998 The Open Group
.\"
.\" Permission to use, copy, modify, distribute, and sell this software and its
.\" documentation for any purpose is hereby granted without fee, provided that
.\" the above copyright notice appear in all copies and that both that
.\" copyright notice and this permission notice appear in supporting
.\" documentation.
.\"
.\" The above copyright notice and this permission notice shall be included in
.\" all copies or substantial portions of the Software.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
.\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
.\" SOFTWARE.
.\"
.\" Except as contained in this notice, the name of The Open Group shall not
.\" be used in advertising or otherwise to promote the sale, use or other
.\" dealing in this Software without prior written authorization from The
.\" Open Group.
.\"
.\" $XFree86: xc/config/makedepend/mkdepend.man,v 1.6 2001/12/17 20:52:22 dawes Exp $
.\"
.TH MAKEDEPEND 1 __xorgversion__
.UC 4
.SH NAME
makedepend \- create dependencies in makefiles
.SH SYNOPSIS
.B makedepend
[
.BI \-D name\fB=\fPdef
] [
.BI \-D name
] [
.BI \-I includedir
] [
.BI \-Y includedir
] [
.B \-a
] [
.BI \-f makefile
] [
.BI \-include \ file
] [
.BI \-o objsuffix
] [
.BI \-p objprefix
] [
.BI \-s string
] [
.BI \-w width
] [
.B \-v
] [
.B \-m
] [
\-\^\-
.I otheroptions
\-\^\-
]
.I sourcefile
\&.\|.\|.
.br
.SH DESCRIPTION
The
.B makedepend
program reads each
.I sourcefile
in sequence and parses it like a C-preprocessor,
processing all
.I #include,
.I #define,
.I #undef,
.I #ifdef,
.I #ifndef,
.I #endif,
.I #if,
.I #elif
and
.I #else
directives so that it can correctly tell which
.I #include,
directives would be used in a compilation.
Any
.I #include,
directives can reference files having other
.I #include
directives, and parsing will occur in these files as well.
.PP
Every file that a
.I sourcefile
includes,
directly or indirectly,
is what
.B makedepend
calls a \fIdependency.\fP
These dependencies are then written to a
.I makefile
in such a way that
.B make(1)
will know which object files must be recompiled when a dependency has changed.
.PP
By default,
.B makedepend
places its output in the file named
.I makefile
if it exists, otherwise
.I Makefile.
An alternate makefile may be specified with the
.B \-f
option.
It first searches the makefile for
the line
.sp
\& # DO NOT DELETE THIS LINE \-\^\- make depend depends on it.
.sp
or one provided with the
.B \-s
option,
as a delimiter for the dependency output.
If it finds it, it will delete everything
following this to the end of the makefile
and put the output after this line.
If it doesn't find it, the program
will append the string to the end of the makefile
and place the output following that.
For each
.I sourcefile
appearing on the command line,
.B makedepend
puts lines in the makefile of the form
.sp
sourcefile.o:\0dfile .\|.\|.
.sp
Where \fIsourcefile.o\fP is the name from the command
line with its suffix replaced with ``.o'',
and \fIdfile\fP is a dependency discovered in a
.I #include
directive while parsing
.I sourcefile
or one of the files it included.
.SH EXAMPLE
Normally,
.B makedepend
will be used in a makefile target so that typing ``make depend'' will
bring the dependencies up to date for the makefile.
For example,
.nf
SRCS\0=\0file1.c\0file2.c\0.\|.\|.
CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
depend:
makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
.fi
.SH OPTIONS
The program
will ignore any option that it does not understand so that you may use
the same arguments that you would for
.B cc(1).
.TP 5
.B \-D\fIname\fP=\fIdef\fP \fRor\fP \-D\fIname\fP
Define.
This places a definition for
.I name
in
.B makedepend's
symbol table.
Without
.I =def\|
the symbol becomes defined as ``1''.
.TP 5
.B \-I\fIincludedir\fP
Include directory.
This option tells
.B makedepend
to prepend
.I includedir
to its list of directories to search when it encounters
a
.I #include
directive.
By default,
.B makedepend
only searches the standard include directories (usually /usr/include
and possibly a compiler-dependent directory).
.TP 5
.B \-Y\fIincludedir\fP
Replace all of the standard include directories with the single specified
include directory; you can omit the
.I includedir
to simply prevent searching the standard include directories.
.TP 5
.B \-a
Append the dependencies to the end of the file instead of replacing them.
.TP 5
.B \-f\fImakefile\fP
Filename.
This allows you to specify an alternate makefile in which
.B makedepend
can place its output.
Specifying ``\-'' as the file name (i.e., \fB\-f\-\fP) sends the
output to standard output instead of modifying an existing file.
.TP 5
.B \-include \fIfile\fP
Process file as input, and include all the resulting output
before processing the regular input file. This has the same
affect as if the specified file is an include statement that
appears before the very first line of the regular input file.
.TP 5
.B \-o\fIobjsuffix\fP
Object file suffix.
Some systems may have object files whose suffix is something other
than ``.o''.
This option allows you to specify another suffix, such as
``.b'' with
.I \-o.b
or ``:obj''
with
.I \-o:obj
and so forth.
.TP 5
.B \-p\fIobjprefix\fP
Object file prefix.
The prefix is prepended to the name of the object file. This is
usually used to designate a different directory for the object file.
The default is the empty string.
.TP 5
.B \-s\fIstring\fP
Starting string delimiter.
This option permits you to specify
a different string for
.B makedepend
to look for in the makefile.
.TP 5
.B \-w\fIwidth\fP
Line width.
Normally,
.B makedepend
will ensure that every output line that it writes will be no wider than
78 characters for the sake of readability.
This option enables you to change this width.
.TP 5
.B \-v
Verbose operation.
This option causes
.B makedepend
to emit the list of files included by each input file.
.TP 5
.B \-m
Warn about multiple inclusion.
This option causes
.B makedepend
to produce a warning if any input file includes another file more than
once. In previous versions of
.B makedepend
this was the default behavior; the default has been changed to better
match the behavior of the C compiler, which does not consider multiple
inclusion to be an error. This option is provided for backward
compatibility, and to aid in debugging problems related to multiple
inclusion.
.TP 5
.B "\-\^\- \fIoptions\fP \-\^\-"
If
.B makedepend
encounters a double hyphen (\-\^\-) in the argument list,
then any unrecognized argument following it
will be silently ignored; a second double hyphen terminates this
special treatment.
In this way,
.B makedepend
can be made to safely ignore esoteric compiler arguments that might
normally be found in a CFLAGS
.B make
macro (see the
.B EXAMPLE
section above).
All options that
.B makedepend
recognizes and appear between the pair of double hyphens
are processed normally.
.SH ALGORITHM
The approach used in this program enables it to run an order of magnitude
faster than any other ``dependency generator'' I have ever seen.
Central to this performance are two assumptions:
that all files compiled by a single
makefile will be compiled with roughly the same
.I \-I
and
.I \-D
options;
and that most files in a single directory will include largely the
same files.
.PP
Given these assumptions,
.B makedepend
expects to be called once for each makefile, with
all source files that are maintained by the
makefile appearing on the command line.
It parses each source and include
file exactly once, maintaining an internal symbol table
for each.
Thus, the first file on the command line will take an amount of time
proportional to the amount of time that a normal C preprocessor takes.
But on subsequent files, if it encounters an include file
that it has already parsed, it does not parse it again.
.PP
For example,
imagine you are compiling two files,
.I file1.c
and
.I file2.c,
they each include the header file
.I header.h,
and the file
.I header.h
in turn includes the files
.I def1.h
and
.I def2.h.
When you run the command
.sp
makedepend\0file1.c\0file2.c
.sp
.B makedepend
will parse
.I file1.c
and consequently,
.I header.h
and then
.I def1.h
and
.I def2.h.
It then decides that the dependencies for this file are
.sp
file1.o:\0header.h\0def1.h\0def2.h
.sp
But when the program parses
.I file2.c
and discovers that it, too, includes
.I header.h,
it does not parse the file,
but simply adds
.I header.h,
.I def1.h
and
.I def2.h
to the list of dependencies for
.I file2.o.
.SH "SEE ALSO"
cc(1), make(1)
.SH BUGS
.B makedepend
parses, but does not currently evaluate, the SVR4 #predicate(token-list)
preprocessor expression; such expressions are simply assumed to be true.
This may cause the wrong
.I #include
directives to be evaluated.
.PP
Imagine you are parsing two files,
say
.I file1.c
and
.I file2.c,
each includes the file
.I def.h.
The list of files that
.I def.h
includes might truly be different when
.I def.h
is included by
.I file1.c
than when it is included by
.I file2.c.
But once
.B makedepend
arrives at a list of dependencies for a file,
it is cast in concrete.
.SH AUTHOR
Todd Brunhoff, Tektronix, Inc. and MIT Project Athena
/* $Xorg: pr.c,v 1.4 2001/02/09 02:03:16 xorgcvs Exp $ */
/*
Copyright (c) 1993, 1994, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/config/makedepend/pr.c,v 1.4 2001/04/29 23:25:02 tsi Exp $ */
#include "def.h"
extern struct inclist inclist[ MAXFILES ],
*inclistp;
extern char *objprefix;
extern char *objsuffix;
extern int width;
extern boolean printed;
extern boolean verbose;
extern boolean show_where_not;
void
add_include(struct filepointer *filep, struct inclist *file,
struct inclist *file_red, char *include, int type,
boolean failOK)
{
register struct inclist *newfile;
register struct filepointer *content;
/*
* First decide what the pathname of this include file really is.
*/
newfile = inc_path(file->i_file, include, type);
if (newfile == NULL) {
if (failOK)
return;
if (file != file_red)
warning("%s (reading %s, line %d): ",
file_red->i_file, file->i_file, filep->f_line);
else
warning("%s, line %d: ", file->i_file, filep->f_line);
warning1("cannot find include file \"%s\"\n", include);
show_where_not = TRUE;
newfile = inc_path(file->i_file, include, type);
show_where_not = FALSE;
}
if (newfile) {
included_by(file, newfile);
if (!(newfile->i_flags & SEARCHED)) {
newfile->i_flags |= SEARCHED;
content = getfile(newfile->i_file);
find_includes(content, newfile, file_red, 0, failOK);
freefile(content);
}
}
}
static void
pr(struct inclist *ip, char *file, char *base)
{
static char *lastfile;
static int current_len;
register int len, i;
char buf[ BUFSIZ ];
printed = TRUE;
len = strlen(ip->i_file)+1;
if (current_len + len > width || file != lastfile) {
lastfile = file;
sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix,
ip->i_file);
len = current_len = strlen(buf);
}
else {
buf[0] = ' ';
strcpy(buf+1, ip->i_file);
current_len += len;
}
fwrite(buf, len, 1, stdout);
/*
* If verbose is set, then print out what this file includes.
*/
if (! verbose || ip->i_list == NULL || ip->i_flags & NOTIFIED)
return;
ip->i_flags |= NOTIFIED;
lastfile = NULL;
printf("\n# %s includes:", ip->i_file);
for (i=0; i<ip->i_listlen; i++)
printf("\n#\t%s", ip->i_list[ i ]->i_incstring);
}
void
recursive_pr_include(struct inclist *head, char *file, char *base)
{
int i;
if (head->i_flags & MARKED)
return;
head->i_flags |= MARKED;
if (head->i_file != file)
pr(head, file, base);
for (i=0; i<head->i_listlen; i++)
recursive_pr_include(head->i_list[ i ], file, base);
}
...@@ -367,16 +367,6 @@ dnl Find makedepend somewhere. ...@@ -367,16 +367,6 @@ dnl Find makedepend somewhere.
AC_SUBST(MAKEDEPEND) AC_SUBST(MAKEDEPEND)
MAKEDEPEND="$(which makedepend)" MAKEDEPEND="$(which makedepend)"
# Try to desperately find makedepend.
# Set MAKEDEPEND to the shipped makedepend binary. This will not
# exist in nx-libs-lite, though, in which case MAKEDEPEND
# will stay empty.
if test -z "${MAKEDEPEND}"; then
if test -x "../nx-X11/config/makedepend/makedepend"; then
MAKEDEPEND="../nx-X11/config/makedepend/makedepend"
fi
fi
dnl Determine what to build based on the platform. dnl Determine what to build based on the platform.
dnl Override the LIBS settings on Cygwin32 so that dnl Override the LIBS settings on Cygwin32 so that
dnl we always link with the exact set of libraries. dnl we always link with the exact set of libraries.
......
...@@ -226,16 +226,6 @@ dnl Find makedepend somewhere. ...@@ -226,16 +226,6 @@ dnl Find makedepend somewhere.
AC_SUBST(MAKEDEPEND) AC_SUBST(MAKEDEPEND)
MAKEDEPEND="$(which makedepend)" MAKEDEPEND="$(which makedepend)"
# Try to desperately find makedepend.
# Set MAKEDEPEND to the shipped makedepend binary. This will not
# exist in nx-libs-lite, though, in which case MAKEDEPEND
# will stay empty.
if test -z "${MAKEDEPEND}"; then
if test -x "../nx-X11/config/makedepend/makedepend"; then
MAKEDEPEND="../nx-X11/config/makedepend/makedepend"
fi
fi
dnl Determine what to build based on the platform. dnl Determine what to build based on the platform.
dnl Override the LIBS settings on Cygwin32 so that dnl Override the LIBS settings on Cygwin32 so that
dnl we always link with the exact set of libraries. dnl we always link with the exact set of libraries.
......
...@@ -274,14 +274,4 @@ dnl Find makedepend somewhere. ...@@ -274,14 +274,4 @@ dnl Find makedepend somewhere.
AC_SUBST(MAKEDEPEND) AC_SUBST(MAKEDEPEND)
MAKEDEPEND="$(which makedepend)" MAKEDEPEND="$(which makedepend)"
# Try to desperately find makedepend.
# Set MAKEDEPEND to the shipped makedepend binary. This will not
# exist in nx-libs-lite, though, in which case MAKEDEPEND
# will stay empty.
if test -z "${MAKEDEPEND}"; then
if test -x "../nx-X11/config/makedepend/makedepend"; then
MAKEDEPEND="../nx-X11/config/makedepend/makedepend"
fi
fi
AC_OUTPUT(Makefile nxcompshad.pc) AC_OUTPUT(Makefile nxcompshad.pc)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment