mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-22 00:17:32 +09:00
Replace NSS with Pale Moon's
This commit is contained in:
parent
ff1e5e48bf
commit
8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions
|
|
@ -1,47 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/UNIX.mk
|
||||
|
||||
XP_DEFINE := $(XP_DEFINE:-DXP_UNIX=-DXP_BEOS)
|
||||
|
||||
USE_PTHREADS =
|
||||
|
||||
ifeq ($(USE_PTHREADS),1)
|
||||
IMPL_STRATEGY = _PTH
|
||||
endif
|
||||
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
RANLIB = ranlib
|
||||
|
||||
DEFAULT_COMPILER = gcc
|
||||
|
||||
ifeq ($(OS_TEST),ppc)
|
||||
OS_REL_CFLAGS = -Dppc
|
||||
CPU_ARCH = ppc
|
||||
else
|
||||
OS_REL_CFLAGS = -Di386
|
||||
CPU_ARCH = x86
|
||||
endif
|
||||
|
||||
MKSHLIB = $(CC) -nostart -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
|
||||
ifdef BUILD_OPT
|
||||
OPTIMIZER = -O2
|
||||
endif
|
||||
|
||||
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -Wno-switch -pipe
|
||||
OS_LIBS = -lbe
|
||||
|
||||
DEFINES += -DBEOS
|
||||
|
||||
ifdef USE_PTHREADS
|
||||
DEFINES += -D_REENTRANT
|
||||
endif
|
||||
|
||||
ARCH = beos
|
||||
|
||||
DSO_CFLAGS = -fPIC
|
||||
DSO_LDOPTS =
|
||||
|
|
@ -88,14 +88,11 @@ endif
|
|||
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK $(DARWIN_SDK_CFLAGS)
|
||||
|
||||
ifdef BUILD_OPT
|
||||
|
||||
# TenFourFox overrides optimization settings; let it.
|
||||
#ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
|
||||
# OPTIMIZER = -Oz
|
||||
#else
|
||||
# OPTIMIZER = -O2
|
||||
#endif
|
||||
|
||||
ifeq (11,$(ALLOW_OPT_CODE_SIZE)$(OPT_CODE_SIZE))
|
||||
OPTIMIZER = -Oz
|
||||
else
|
||||
OPTIMIZER = -O2
|
||||
endif
|
||||
ifdef MOZ_DEBUG_SYMBOLS
|
||||
ifdef MOZ_DEBUG_FLAGS
|
||||
OPTIMIZER += $(MOZ_DEBUG_FLAGS)
|
||||
|
|
@ -107,13 +104,6 @@ endif
|
|||
|
||||
ARCH = darwin
|
||||
|
||||
#fix missing libmozglue.dylib on TenFourFox Intel build
|
||||
ifeq ($(CPU_ARCH), x86)
|
||||
EXTRA_SHARED_LIBS += \
|
||||
-L$(DIST)/bin \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
DSO_CFLAGS = -fPIC
|
||||
# May override this with different compatibility and current version numbers.
|
||||
DARWIN_DYLIB_VERSIONS = -compatibility_version 1 -current_version 1
|
||||
|
|
|
|||
|
|
@ -1,94 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/UNIX.mk
|
||||
|
||||
#
|
||||
# The default implementation strategy for Irix is classic nspr.
|
||||
#
|
||||
ifeq ($(USE_PTHREADS),1)
|
||||
ifeq ($(USE_N32),1)
|
||||
IMPL_STRATEGY = _n32_PTH
|
||||
else
|
||||
IMPL_STRATEGY = _PTH
|
||||
endif
|
||||
endif
|
||||
|
||||
DEFAULT_COMPILER = cc
|
||||
|
||||
ifdef NS_USE_GCC
|
||||
CC = gcc
|
||||
AS = $(CC) -x assembler-with-cpp
|
||||
ODD_CFLAGS = -Wall -Wno-format -Wno-switch
|
||||
ifdef BUILD_OPT
|
||||
OPTIMIZER = -O6
|
||||
endif
|
||||
else
|
||||
CC = cc
|
||||
CCC = CC
|
||||
ODD_CFLAGS = -fullwarn -xansi -woff 1209
|
||||
ifdef BUILD_OPT
|
||||
ifeq ($(USE_N32),1)
|
||||
OPTIMIZER = -O -OPT:Olimit=4000
|
||||
else
|
||||
OPTIMIZER = -O -Olimit 4000
|
||||
endif
|
||||
endif
|
||||
|
||||
# For 6.x machines, include this flag
|
||||
ifeq (6., $(findstring 6., $(OS_RELEASE)))
|
||||
ifeq ($(USE_N32),1)
|
||||
ODD_CFLAGS += -n32 -mips3 -exceptions
|
||||
else
|
||||
ODD_CFLAGS += -32 -multigot
|
||||
endif
|
||||
else
|
||||
ODD_CFLAGS += -xgot
|
||||
endif
|
||||
ifeq ($(USE_N32),1)
|
||||
OS_CFLAGS += -dollar
|
||||
endif
|
||||
endif
|
||||
|
||||
ODD_CFLAGS += -DSVR4 -DIRIX
|
||||
|
||||
CPU_ARCH = mips
|
||||
|
||||
RANLIB = /bin/true
|
||||
# For purify
|
||||
# NOTE: should always define _SGI_MP_SOURCE
|
||||
NOMD_OS_CFLAGS += $(ODD_CFLAGS) -D_SGI_MP_SOURCE
|
||||
|
||||
OS_CFLAGS += $(NOMD_OS_CFLAGS)
|
||||
ifdef USE_MDUPDATE
|
||||
OS_CFLAGS += -MDupdate $(DEPENDENCIES)
|
||||
endif
|
||||
|
||||
ifeq ($(USE_N32),1)
|
||||
SHLIB_LD_OPTS += -n32 -mips3
|
||||
endif
|
||||
|
||||
MKSHLIB += $(LD) $(SHLIB_LD_OPTS) -shared -soname $(@:$(OBJDIR)/%.so=%.so)
|
||||
ifdef MAPFILE
|
||||
# Add LD options to restrict exported symbols to those in the map file
|
||||
endif
|
||||
# Change PROCESS to put the mapfile in the correct format for this platform
|
||||
PROCESS_MAP_FILE = cp $< $@
|
||||
|
||||
DSO_LDOPTS = -elf -shared -all
|
||||
|
||||
ifdef DSO_BACKEND
|
||||
DSO_LDOPTS += -soname $(DSO_NAME)
|
||||
endif
|
||||
|
||||
#
|
||||
# Revision notes:
|
||||
#
|
||||
# In the IRIX compilers prior to version 7.2, -n32 implied -mips3.
|
||||
# Beginning in the 7.2 compilers, -n32 implies -mips4 when the compiler
|
||||
# is running on a system with a mips4 CPU (e.g. R8K, R10K).
|
||||
# We want our code to explicitly be mips3 code, so we now explicitly
|
||||
# set -mips3 whenever we set -n32.
|
||||
#
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
include $(CORE_DEPTH)/coreconf/IRIX5.mk
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
include $(CORE_DEPTH)/coreconf/IRIX5.mk
|
||||
|
||||
OS_CFLAGS += -DIRIX5_3
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/IRIX.mk
|
||||
|
||||
ifndef NS_USE_GCC
|
||||
ODD_CFLAGS += -xgot
|
||||
endif
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
# catch unresolved symbols
|
||||
|
||||
SHLIB_LD_OPTS += -no_unresolved
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/IRIX6.mk
|
||||
|
||||
OS_CFLAGS += -DIRIX6_2
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# catch unresolved symbols
|
||||
|
||||
SHLIB_LD_OPTS += -no_unresolved
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/IRIX6.mk
|
||||
|
||||
OS_CFLAGS += -DIRIX6_3
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# catch unresolved symbols
|
||||
|
||||
SHLIB_LD_OPTS += -no_unresolved
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/IRIX6.mk
|
||||
|
||||
OS_CFLAGS += -DIRIX6_5
|
||||
ifndef NS_USE_GCC
|
||||
OS_CFLAGS += -mips3
|
||||
endif
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/IRIX.mk
|
||||
|
||||
ifndef NS_USE_GCC
|
||||
ifneq ($(USE_N32),1)
|
||||
OS_CFLAGS += -32
|
||||
endif
|
||||
ODD_CFLAGS += -multigot
|
||||
endif
|
||||
|
||||
ifeq ($(USE_PTHREADS),1)
|
||||
OS_LIBS += -lpthread
|
||||
endif
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
CC ?= gcc
|
||||
CCC ?= g++
|
||||
RANLIB ?= ranlib
|
||||
LD ?= ld
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/UNIX.mk
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ ifeq ($(USE_PTHREADS),1)
|
|||
endif
|
||||
|
||||
DEFAULT_COMPILER = gcc
|
||||
DEFINES += -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE
|
||||
DEFINES += -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -DSDB_MEASURE_USE_TEMP_DIR
|
||||
|
||||
ifeq ($(OS_TARGET),Android)
|
||||
ifndef ANDROID_NDK
|
||||
|
|
@ -54,6 +55,11 @@ ifeq (,$(filter-out ppc64 ppc64le,$(OS_TEST)))
|
|||
ifeq ($(USE_64),1)
|
||||
ARCHFLAG = -m64
|
||||
endif
|
||||
ifeq (,$(filter-out ppc ppc64,$(OS_TEST)))
|
||||
ifneq ($(NSS_DISABLE_CRYPTO_VSX),0)
|
||||
NSS_DISABLE_CRYPTO_VSX=1
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(OS_TEST),alpha)
|
||||
OS_REL_CFLAGS = -D_ALPHA_
|
||||
|
|
@ -152,8 +158,8 @@ DSO_LDOPTS = -shared $(ARCHFLAG) -Wl,--gc-sections
|
|||
# Also, -z defs conflicts with Address Sanitizer, which emits relocations
|
||||
# against the libsanitizer runtime built into the main executable.
|
||||
ZDEFS_FLAG = -Wl,-z,defs
|
||||
DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG))
|
||||
LDFLAGS += $(ARCHFLAG) -z noexecstack
|
||||
DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell $(LD) -v)),,$(ZDEFS_FLAG))
|
||||
LDFLAGS += $(ARCHFLAG) -z noexecstack
|
||||
|
||||
# On Maemo, we need to use the -rpath-link flag for even the standard system
|
||||
# library directories.
|
||||
|
|
|
|||
|
|
@ -11,5 +11,3 @@ DIRS = nsinstall
|
|||
|
||||
include $(DEPTH)/coreconf/config.mk
|
||||
include $(DEPTH)/coreconf/rules.mk
|
||||
|
||||
export:: libs
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
|
||||
include $(CORE_DEPTH)/coreconf/UNIX.mk
|
||||
|
||||
DEFAULT_COMPILER = gcc
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
CC ?= gcc
|
||||
CXX ?= g++
|
||||
DEFAULT_COMPILER = ${CC}
|
||||
CCC = ${CXX}
|
||||
RANLIB = ranlib
|
||||
|
||||
CPU_ARCH := $(shell uname -p)
|
||||
|
|
@ -15,16 +16,14 @@ ifeq ($(CPU_ARCH),i386)
|
|||
OS_REL_CFLAGS = -Di386
|
||||
CPU_ARCH = x86
|
||||
endif
|
||||
|
||||
ifndef OBJECT_FMT
|
||||
OBJECT_FMT := $(shell if echo __ELF__ | $${CC:-cc} -E - | grep -q __ELF__ ; then echo a.out ; else echo ELF ; fi)
|
||||
ifeq (,$(filter-out earm%,$(CPU_ARCH)))
|
||||
CPU_ARCH = arm
|
||||
endif
|
||||
ifeq ($(CPU_ARCH),aarch64eb)
|
||||
CPU_ARCH = aarch64
|
||||
endif
|
||||
|
||||
ifeq ($(OBJECT_FMT),ELF)
|
||||
DLL_SUFFIX = so
|
||||
else
|
||||
DLL_SUFFIX = so.1.0
|
||||
endif
|
||||
|
||||
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -Wno-switch -pipe -DNETBSD -Dunix -DHAVE_STRERROR -DHAVE_BSD_FLOCK
|
||||
|
||||
|
|
@ -33,9 +32,16 @@ OS_LIBS = -lcompat
|
|||
ARCH = netbsd
|
||||
|
||||
DSO_CFLAGS = -fPIC -DPIC
|
||||
DSO_LDOPTS = -shared
|
||||
ifeq ($(OBJECT_FMT),ELF)
|
||||
DSO_LDOPTS += -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
||||
DSO_LDOPTS = -shared -Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
||||
|
||||
#
|
||||
# The default implementation strategy for NetBSD is pthreads.
|
||||
#
|
||||
ifndef CLASSIC_NSPR
|
||||
USE_PTHREADS = 1
|
||||
DEFINES += -D_THREAD_SAFE -D_REENTRANT
|
||||
OS_LIBS += -pthread
|
||||
DSO_LDOPTS += -pthread
|
||||
endif
|
||||
|
||||
ifdef LIBRUNPATH
|
||||
|
|
@ -44,12 +50,8 @@ endif
|
|||
|
||||
MKSHLIB = $(CC) $(DSO_LDOPTS)
|
||||
ifdef MAPFILE
|
||||
# Add LD options to restrict exported symbols to those in the map file
|
||||
MKSHLIB += -Wl,--version-script,$(MAPFILE)
|
||||
endif
|
||||
# Change PROCESS to put the mapfile in the correct format for this platform
|
||||
PROCESS_MAP_FILE = cp $< $@
|
||||
PROCESS_MAP_FILE = grep -v ';-' $< | \
|
||||
sed -e 's,;+,,' -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,;,' > $@
|
||||
|
||||
|
||||
G++INCLUDES = -I/usr/include/g++
|
||||
|
||||
INCLUDES += -I/usr/X11R6/include
|
||||
|
|
|
|||
|
|
@ -96,10 +96,6 @@ endif
|
|||
NSINSTALL = nsinstall # HCT4OS2
|
||||
INSTALL = $(NSINSTALL)
|
||||
|
||||
MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
|
||||
MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend
|
||||
MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk
|
||||
|
||||
####################################################################
|
||||
#
|
||||
# One can define the makefile variable NSDISTMODE to control
|
||||
|
|
@ -140,6 +136,10 @@ ifndef DLL_PREFIX
|
|||
DLL_PREFIX = $(NULL)
|
||||
endif
|
||||
|
||||
ifndef IMPORT_LIB_SUFFIX
|
||||
IMPORT_LIB_SUFFIX = .$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
#
|
||||
# override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY
|
||||
#
|
||||
|
|
@ -147,8 +147,3 @@ ifndef TARGETS
|
|||
TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM)
|
||||
endif
|
||||
|
||||
|
||||
ifdef LIBRARY_NAME
|
||||
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)$(JDK_DEBUG_SUFFIX).lib
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#
|
||||
# The Bourne shell (sh) on OSF1 doesn't handle "set -e" correctly,
|
||||
# which we use to stop LOOP_OVER_DIRS submakes as soon as any
|
||||
# submake fails. So we use the Korn shell instead.
|
||||
#
|
||||
SHELL = /usr/bin/ksh
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/UNIX.mk
|
||||
|
||||
DEFAULT_COMPILER = cc
|
||||
|
||||
CC = cc
|
||||
OS_CFLAGS += $(NON_LD_FLAGS) -std1
|
||||
CCC = cxx
|
||||
RANLIB = /bin/true
|
||||
CPU_ARCH = alpha
|
||||
|
||||
ifdef BUILD_OPT
|
||||
OPTIMIZER += -Olimit 4000
|
||||
endif
|
||||
|
||||
NON_LD_FLAGS += -ieee_with_inexact
|
||||
OS_CFLAGS += -DOSF1 -D_REENTRANT
|
||||
|
||||
ifeq ($(USE_PTHREADS),1)
|
||||
OS_CFLAGS += -pthread
|
||||
endif
|
||||
|
||||
# The command to build a shared library on OSF1.
|
||||
MKSHLIB += ld -shared -expect_unresolved "*" -soname $(notdir $@)
|
||||
ifdef MAPFILE
|
||||
MKSHLIB += -hidden -input $(MAPFILE)
|
||||
endif
|
||||
PROCESS_MAP_FILE = grep -v ';+' $< | grep -v ';-' | \
|
||||
sed -e 's; DATA ;;' -e 's,;;,,' -e 's,;.*,,' -e 's,^,-exported_symbol ,' > $@
|
||||
|
||||
DSO_LDOPTS += -shared
|
||||
|
||||
# required for freebl
|
||||
USE_64=1
|
||||
# this platform name does not use a bit tag due to only having a 64-bit ABI
|
||||
64BIT_TAG=
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
include $(CORE_DEPTH)/coreconf/OSF1.mk
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
include $(CORE_DEPTH)/coreconf/OSF1.mk
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# On OSF1 V3.2, classic nspr is the default (and only) implementation
|
||||
# strategy.
|
||||
|
||||
#
|
||||
# Config stuff for DEC OSF/1 V3.2
|
||||
#
|
||||
include $(CORE_DEPTH)/coreconf/OSF1.mk
|
||||
|
||||
ifeq ($(OS_RELEASE),V3.2)
|
||||
OS_CFLAGS += -DOSF1V3
|
||||
endif
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# On OSF1 V4.0, pthreads is the default implementation strategy.
|
||||
# Classic nspr is also available.
|
||||
|
||||
ifneq ($(OS_RELEASE),V3.2)
|
||||
USE_PTHREADS = 1
|
||||
ifeq ($(CLASSIC_NSPR), 1)
|
||||
USE_PTHREADS =
|
||||
IMPL_STRATEGY := _CLASSIC
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Config stuff for DEC OSF/1 V4.0
|
||||
#
|
||||
include $(CORE_DEPTH)/coreconf/OSF1.mk
|
||||
|
||||
ifeq ($(OS_RELEASE),V4.0)
|
||||
OS_CFLAGS += -DOSF1V4
|
||||
endif
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
include $(CORE_DEPTH)/coreconf/OSF1V4.0.mk
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
include $(CORE_DEPTH)/coreconf/OSF1V4.0.mk
|
||||
DEFINES += -DOSF1V4D
|
||||
|
||||
OS_LIBS += -lpthread -lrt
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# On OSF1 V5.0, pthreads is the default implementation strategy.
|
||||
# Classic nspr is also available.
|
||||
|
||||
ifneq ($(OS_RELEASE),V3.2)
|
||||
USE_PTHREADS = 1
|
||||
ifeq ($(CLASSIC_NSPR), 1)
|
||||
USE_PTHREADS =
|
||||
IMPL_STRATEGY := _CLASSIC
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Config stuff for DEC OSF/1 V5.0
|
||||
#
|
||||
include $(CORE_DEPTH)/coreconf/OSF1.mk
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# On OSF1 V5.0, pthreads is the default implementation strategy.
|
||||
# Classic nspr is also available.
|
||||
|
||||
ifneq ($(OS_RELEASE),V3.2)
|
||||
USE_PTHREADS = 1
|
||||
ifeq ($(CLASSIC_NSPR), 1)
|
||||
USE_PTHREADS =
|
||||
IMPL_STRATEGY := _CLASSIC
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Config stuff for DEC OSF/1 V5.1
|
||||
#
|
||||
include $(CORE_DEPTH)/coreconf/OSF1.mk
|
||||
|
|
@ -55,6 +55,3 @@ PROCESS_MAP_FILE = cp $< $@
|
|||
BUILD_UNIX_PLUGINS = 1
|
||||
#DSO_LDOPTS += -b elf -G -z defs
|
||||
DSO_LDOPTS += -G
|
||||
|
||||
# Used for Java compiler
|
||||
EXPORT_FLAGS += -W l,-Bexport
|
||||
|
|
|
|||
|
|
@ -336,16 +336,6 @@ OVERVIEW of "rules.mk":
|
|||
|
||||
clobber_all:: synonym for "realclean::" rule
|
||||
|
||||
private_export:: recursively copy specified
|
||||
cross-platform header files to the
|
||||
$(SOURCE_XPPRIVATE_DIR) directory
|
||||
|
||||
|
||||
IMPORT
|
||||
------
|
||||
import:: uses perl script to retrieve specified
|
||||
VERSION of the binary release from
|
||||
$(RELEASE_TREE)
|
||||
|
||||
RELEASE
|
||||
-------
|
||||
|
|
@ -368,18 +358,6 @@ OVERVIEW of "rules.mk":
|
|||
$(SOURCE_RELEASE_PREFIX)/
|
||||
$(SOURCE_RELEASE_BIN_DIR) directory
|
||||
|
||||
release_jars:: use perl script to package appropriate
|
||||
files in the $(XPCLASS_JAR),
|
||||
$(XPHEADER_JAR), $(MDHEADER_JAR), and
|
||||
$(MDBINARY_JAR) jar files
|
||||
|
||||
release_cpdistdir:: use perl script to copy the
|
||||
$(XPCLASS_JAR), $(XPHEADER_JAR),
|
||||
$(MDHEADER_JAR), and $(MDBINARY_JAR)
|
||||
jar files to the specified VERSION
|
||||
of the $(RELEASE_TREE) directory
|
||||
|
||||
|
||||
|
||||
TOOLS and AUTOMATION
|
||||
--------------------
|
||||
|
|
@ -390,7 +368,7 @@ OVERVIEW of "rules.mk":
|
|||
"Tinderbox" to automatically generate
|
||||
binary releases on various platforms
|
||||
|
||||
tests:: automation tool used to run the
|
||||
check:: automation tool used to run the
|
||||
"regress" and "reporter" tools
|
||||
on various regression test suites
|
||||
|
||||
|
|
@ -517,34 +495,11 @@ OVERVIEW of "rules.mk":
|
|||
CATEGORY/rule:: Purpose
|
||||
=================== =============================
|
||||
|
||||
$(PUBLIC_EXPORT_DIR):: create directory used to
|
||||
house public "C" header files
|
||||
|
||||
$(PRIVATE_EXPORT_DIR):: create directory used to
|
||||
house private "C" header
|
||||
files
|
||||
|
||||
$(SOURCE_XP_DIR)/
|
||||
release/include:: create directory used to
|
||||
house "C" header files
|
||||
contained in a release
|
||||
|
||||
$(MKDEPENDENCIES):: for UNIX systems, create
|
||||
a directory used to house
|
||||
dependencies and utilize
|
||||
the $(MKDEPEND) rule to
|
||||
create them
|
||||
|
||||
$(MKDEPEND):: cd to the dependency
|
||||
directory and create them
|
||||
|
||||
depend:: if $(OBJS) exist, perform the
|
||||
$(MKDEPEND) rule followed by
|
||||
the $(MKDEPENDENCIES) rule
|
||||
|
||||
dependclean:: remove all files contained
|
||||
in the dependency repository
|
||||
|
||||
.DEFAULT: standard gmake rule
|
||||
|
||||
.SUFFIXES: standard gmake rule
|
||||
|
|
|
|||
|
|
@ -55,6 +55,3 @@ PROCESS_MAP_FILE = cp $< $@
|
|||
BUILD_UNIX_PLUGINS = 1
|
||||
#DSO_LDOPTS += -b elf -G -z defs
|
||||
DSO_LDOPTS += -b elf -G
|
||||
|
||||
# Used for Java compiler
|
||||
EXPORT_FLAGS += -W l,-Bexport
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ CPU_ARCH = sparc
|
|||
|
||||
# Purify doesn't like -MDupdate
|
||||
NOMD_OS_CFLAGS += -Wall -Wno-format -Wno-switch -DSUNOS4
|
||||
OS_CFLAGS += $(DSO_CFLAGS) $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES)
|
||||
OS_CFLAGS += $(DSO_CFLAGS) $(NOMD_OS_CFLAGS)
|
||||
MKSHLIB = $(LD)
|
||||
MKSHLIB += $(DSO_LDOPTS)
|
||||
NOSUCHFILE = /solaris-rm-f-sucks
|
||||
|
|
|
|||
|
|
@ -35,13 +35,11 @@ DEFAULT_COMPILER = cc
|
|||
ifdef NS_USE_GCC
|
||||
CC = gcc
|
||||
OS_CFLAGS += -Wall -Wno-format -Werror-implicit-function-declaration -Wno-switch
|
||||
OS_CFLAGS += -D__EXTENSIONS__
|
||||
CCC = g++
|
||||
CCC += -Wall -Wno-format
|
||||
ASFLAGS += -x assembler-with-cpp
|
||||
OS_CFLAGS += $(NOMD_OS_CFLAGS) $(ARCHFLAG)
|
||||
ifdef USE_MDUPDATE
|
||||
OS_CFLAGS += -MDupdate $(DEPENDENCIES)
|
||||
endif
|
||||
ifdef BUILD_OPT
|
||||
OPTIMIZER = -O2
|
||||
# Enable this for accurate dtrace profiling
|
||||
|
|
|
|||
|
|
@ -25,10 +25,6 @@ NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
|
|||
NSINSTALL = $(NSINSTALL_DIR)/$(OBJDIR_NAME)/nsinstall
|
||||
endif
|
||||
|
||||
MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
|
||||
MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend
|
||||
MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk
|
||||
|
||||
####################################################################
|
||||
#
|
||||
# One can define the makefile variable NSDISTMODE to control
|
||||
|
|
@ -58,7 +54,7 @@ else
|
|||
endif
|
||||
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
|
||||
if test ! -d $(@D); then $(NSINSTALL) -D $(@D); fi
|
||||
endef
|
||||
|
||||
include $(CORE_DEPTH)/coreconf/Werror.mk
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ else
|
|||
_MSC_VER_GE_11 := $(shell expr $(_MSC_VER) \>= 1700)
|
||||
# VC12 (2013).
|
||||
_MSC_VER_GE_12 := $(shell expr $(_MSC_VER) \>= 1800)
|
||||
# VC14 (2015).
|
||||
_MSC_VER_GE_14 := $(shell expr $(_MSC_VER) \>= 1900)
|
||||
ifeq ($(_CC_VMAJOR),14)
|
||||
# -DYNAMICBASE is only supported on VC8SP1 or newer,
|
||||
# so be very specific here!
|
||||
|
|
@ -85,15 +87,7 @@ NSINSTALL_DIR = $(CORE_DEPTH)/coreconf/nsinstall
|
|||
endif
|
||||
NSINSTALL = nsinstall
|
||||
|
||||
MKDEPEND_DIR = $(CORE_DEPTH)/coreconf/mkdepend
|
||||
MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
|
||||
# Note: MKDEPENDENCIES __MUST__ be a relative pathname, not absolute.
|
||||
# If it is absolute, gmake will crash unless the named file exists.
|
||||
MKDEPENDENCIES = $(OBJDIR_NAME)/depend.mk
|
||||
|
||||
INSTALL = $(NSINSTALL)
|
||||
MAKE_OBJDIR = mkdir
|
||||
MAKE_OBJDIR += $(OBJDIR)
|
||||
GARBAGE += $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb
|
||||
XP_DEFINE += -DXP_PC
|
||||
ifdef NS_USE_GCC
|
||||
|
|
@ -103,6 +97,10 @@ LIB_SUFFIX = lib
|
|||
endif
|
||||
DLL_SUFFIX = dll
|
||||
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then mkdir -p $(@D); fi
|
||||
endef
|
||||
|
||||
ifdef NS_USE_GCC
|
||||
OS_CFLAGS += -mwindows
|
||||
_GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
|
||||
|
|
@ -185,6 +183,8 @@ endif
|
|||
endif
|
||||
# Purify requires /FIXED:NO when linking EXEs.
|
||||
LDFLAGS += /FIXED:NO
|
||||
# So the linker will find main in the gtestutil library
|
||||
LDFLAGS += -SUBSYSTEM:CONSOLE
|
||||
endif
|
||||
ifneq ($(_MSC_VER),$(_MSC_VER_6))
|
||||
# NSS has too many of these to fix, downgrade the warning
|
||||
|
|
@ -360,15 +360,6 @@ ifneq ($(CPU_ARCH),x386)
|
|||
CPU_TAG = _$(CPU_ARCH)
|
||||
endif
|
||||
|
||||
#
|
||||
# override ruleset.mk, removing the "lib" prefix for library names, and
|
||||
# adding the "32" after the LIBRARY_VERSION.
|
||||
#
|
||||
ifdef LIBRARY_NAME
|
||||
SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).dll
|
||||
IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)32$(JDK_DEBUG_SUFFIX).lib
|
||||
endif
|
||||
|
||||
#
|
||||
# override the TARGETS defined in ruleset.mk, adding IMPORT_LIBRARY
|
||||
#
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
# OS_TEST (from uname -m)
|
||||
# OS_RELEASE (from uname -v and/or -r)
|
||||
# OS_TARGET User defined, or set to OS_ARCH
|
||||
# CPU_ARCH (from unmame -m or -p, ONLY on WINNT)
|
||||
# CPU_ARCH (from uname -m or -p, ONLY on WINNT)
|
||||
# OS_CONFIG OS_TARGET + OS_RELEASE
|
||||
# OBJDIR_TAG (uses GCOV_TAG, 64BIT_TAG)
|
||||
# OBJDIR_NAME
|
||||
|
|
@ -33,13 +33,6 @@ else
|
|||
OS_RELEASE := $(shell uname -r)
|
||||
endif
|
||||
|
||||
#
|
||||
# Force the IRIX64 machines to use IRIX.
|
||||
#
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX64)
|
||||
OS_ARCH = IRIX
|
||||
endif
|
||||
|
||||
#
|
||||
# Force the older BSD/OS versions to use the new arch name.
|
||||
|
|
@ -73,20 +66,6 @@ ifeq ($(OS_ARCH),AIX)
|
|||
OS_RELEASE := $(shell uname -v).$(shell uname -r)
|
||||
endif
|
||||
|
||||
#
|
||||
# Distinguish between OSF1 V4.0B and V4.0D
|
||||
#
|
||||
|
||||
ifeq ($(OS_ARCH)$(OS_RELEASE),OSF1V4.0)
|
||||
OS_VERSION := $(shell uname -v)
|
||||
ifeq ($(OS_VERSION),564)
|
||||
OS_RELEASE := V4.0B
|
||||
endif
|
||||
ifeq ($(OS_VERSION),878)
|
||||
OS_RELEASE := V4.0D
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# SINIX changes name to ReliantUNIX with 5.43
|
||||
#
|
||||
|
|
@ -103,10 +82,9 @@ endif
|
|||
|
||||
#
|
||||
# Handle FreeBSD 2.2-STABLE, Linux 2.0.30-osfmach3, and
|
||||
# IRIX 6.5-ALPHA-1289139620.
|
||||
#
|
||||
|
||||
ifeq (,$(filter-out Linux FreeBSD IRIX,$(OS_ARCH)))
|
||||
ifeq (,$(filter-out Linux FreeBSD ,$(OS_ARCH)))
|
||||
OS_RELEASE := $(shell echo $(OS_RELEASE) | sed 's/-.*//')
|
||||
endif
|
||||
|
||||
|
|
@ -116,6 +94,7 @@ ifeq ($(OS_ARCH),Linux)
|
|||
OS_RELEASE := $(word 1,$(OS_RELEASE)).$(word 2,$(OS_RELEASE))
|
||||
endif
|
||||
KERNEL = Linux
|
||||
include $(CORE_DEPTH)/coreconf/Linux.mk
|
||||
endif
|
||||
|
||||
# Since all uses of OS_ARCH that follow affect only userland, we can
|
||||
|
|
|
|||
|
|
@ -6,16 +6,21 @@ import sys
|
|||
|
||||
def main():
|
||||
if sys.platform == 'win32' or len(sys.argv) < 2:
|
||||
print(0)
|
||||
print((0))
|
||||
else:
|
||||
cc = os.environ.get('CC', 'cc')
|
||||
try:
|
||||
cc_is_arg = sys.argv[1] in subprocess.check_output(
|
||||
[cc, '--version'], universal_newlines=True)
|
||||
if sys.argv[1] == "cc":
|
||||
cc_output = subprocess.check_output(
|
||||
[cc, '--version'], universal_newlines=True)
|
||||
cc_is_arg = "cc" in cc_output and not ("gcc" in cc_output)
|
||||
else:
|
||||
cc_is_arg = sys.argv[1] in subprocess.check_output(
|
||||
[cc, '--version'], universal_newlines=True)
|
||||
except OSError:
|
||||
# We probably just don't have CC/cc.
|
||||
cc_is_arg = False
|
||||
print(int(cc_is_arg))
|
||||
print((int(cc_is_arg)))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
# chromium uses pymod_do_main, but gyp doesn't set a sensible
|
||||
# Python sys.path (gyp_chromium does).
|
||||
'python%': '<(python)',
|
||||
'host_arch%': '<!(<(python) <(DEPTH)/coreconf/detect_host_arch.py)',
|
||||
'host_arch%': '<!("<(python)" <(DEPTH)/coreconf/detect_host_arch.py)',
|
||||
},
|
||||
'python%': '<(python)',
|
||||
'host_arch%': '<(host_arch)',
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
},{
|
||||
'use_system_sqlite%': 0,
|
||||
}],
|
||||
['OS=="mac" or OS=="ios" or OS=="win"', {
|
||||
['OS=="mac" or OS=="ios" or OS=="solaris" or OS=="win"', {
|
||||
'cc_use_gnu_ld%': 0,
|
||||
}, {
|
||||
'cc_use_gnu_ld%': 1,
|
||||
|
|
@ -66,15 +66,20 @@
|
|||
],
|
||||
}],
|
||||
['"<(GENERATOR)"=="ninja"', {
|
||||
'cc_is_clang%': '<!(<(python) <(DEPTH)/coreconf/check_cc.py clang)',
|
||||
'cc_is_clang%': '<!("<(python)" <(DEPTH)/coreconf/check_cc.py clang)',
|
||||
}, {
|
||||
'cc_is_clang%': '0',
|
||||
}],
|
||||
['"<(GENERATOR)"=="ninja"', {
|
||||
'cc_is_gcc%': '<!(<(python) <(DEPTH)/coreconf/check_cc.py gcc)',
|
||||
'cc_is_gcc%': '<!("<(python)" <(DEPTH)/coreconf/check_cc.py gcc)',
|
||||
}, {
|
||||
'cc_is_gcc%': '0',
|
||||
}],
|
||||
['"<(GENERATOR)"=="ninja"', {
|
||||
'cc_is_cc%': '<!("<(python)" <(DEPTH)/coreconf/check_cc.py cc)',
|
||||
}, {
|
||||
'cc_is_cc%': '0',
|
||||
}],
|
||||
],
|
||||
},
|
||||
# Copy conditionally-set variables out one scope.
|
||||
|
|
@ -97,11 +102,19 @@
|
|||
'cc_use_gnu_ld%': '<(cc_use_gnu_ld)',
|
||||
# Some defaults
|
||||
'disable_arm_hw_aes%': 0,
|
||||
'disable_arm_hw_sha1%': 0,
|
||||
'disable_arm_hw_sha2%': 0,
|
||||
'disable_intel_hw_sha%': 0,
|
||||
'disable_tests%': 0,
|
||||
'disable_chachapoly%': 0,
|
||||
'disable_dbm%': 0,
|
||||
'disable_deprecated_seed%': 0,
|
||||
'disable_deprecated_rc2%': 0,
|
||||
'disable_dbm%': 1,
|
||||
'disable_libpkix%': 1,
|
||||
'disable_werror%': 0,
|
||||
'disable_altivec%': 0,
|
||||
'disable_crypto_vsx%': 0,
|
||||
'disable_arm32_neon%': 0,
|
||||
'mozilla_client%': 0,
|
||||
'comm_client%': 0,
|
||||
'moz_fold_libs%': 0,
|
||||
|
|
@ -124,6 +137,12 @@
|
|||
'only_dev_random%': 1,
|
||||
'disable_fips%': 1,
|
||||
'mozpkix_only%': 0,
|
||||
'mozilla_central%': 0,
|
||||
'coverage%': 0,
|
||||
'softfp_cflags%': '',
|
||||
'enable_draft_hpke%': 0,
|
||||
'force_integrated_as%': 0,
|
||||
'disable_ckbi%': 0,
|
||||
},
|
||||
'target_defaults': {
|
||||
# Settings specific to targets should go here.
|
||||
|
|
@ -198,7 +217,7 @@
|
|||
},
|
||||
},
|
||||
}],
|
||||
[ 'target_arch=="arm64" or target_arch=="aarch64" or target_arch=="sparc64" or target_arch=="ppc64" or target_arch=="ppc64le" or target_arch=="s390x" or target_arch=="mips64"', {
|
||||
[ 'target_arch=="arm64" or target_arch=="aarch64" or target_arch=="sparc64" or target_arch=="ppc64" or target_arch=="ppc64le" or target_arch=="s390x" or target_arch=="mips64" or target_arch=="e2k" or target_arch=="riscv64" or target_arch=="loongarch64"', {
|
||||
'defines': [
|
||||
'NSS_USE_64',
|
||||
],
|
||||
|
|
@ -358,6 +377,7 @@
|
|||
'_DEFAULT_SOURCE', # for <endian.h> functions, strdup, realpath, and getentropy
|
||||
'_BSD_SOURCE', # for the above in glibc <= 2.19
|
||||
'_POSIX_SOURCE', # for <signal.h>
|
||||
'SDB_MEASURE_USE_TEMP_DIR', # use tmpdir for the access calls
|
||||
],
|
||||
}],
|
||||
[ 'OS=="dragonfly" or OS=="freebsd"', {
|
||||
|
|
@ -387,6 +407,11 @@
|
|||
'_REENTRANT',
|
||||
],
|
||||
}],
|
||||
[ 'OS!="mac" and OS!="ios" and OS!="solaris" and OS!="win"', {
|
||||
'ldflags': [
|
||||
'-z', 'noexecstack',
|
||||
],
|
||||
}],
|
||||
[ 'OS!="mac" and OS!="ios" and OS!="win"', {
|
||||
'cflags': [
|
||||
'-fPIC',
|
||||
|
|
@ -400,9 +425,6 @@
|
|||
'cflags_cc': [
|
||||
'-std=c++11',
|
||||
],
|
||||
'ldflags': [
|
||||
'-z', 'noexecstack',
|
||||
],
|
||||
'conditions': [
|
||||
[ 'target_arch=="ia32"', {
|
||||
'cflags': ['-m32'],
|
||||
|
|
@ -432,11 +454,11 @@
|
|||
}],
|
||||
[ 'disable_werror==0 and OS!="android" and OS!="win"', {
|
||||
'cflags': [
|
||||
'<!@(<(python) <(DEPTH)/coreconf/werror.py)',
|
||||
'<!@("<(python)" <(DEPTH)/coreconf/werror.py)',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'OTHER_CFLAGS': [
|
||||
'<!@(<(python) <(DEPTH)/coreconf/werror.py)',
|
||||
'<!@("<(python)" <(DEPTH)/coreconf/werror.py)',
|
||||
],
|
||||
},
|
||||
}],
|
||||
|
|
@ -564,6 +586,16 @@
|
|||
'NSS_DISABLE_LIBPKIX',
|
||||
],
|
||||
}],
|
||||
[ 'disable_deprecated_seed==1', {
|
||||
'defines': [
|
||||
'NSS_DISABLE_DEPRECATED_SEED',
|
||||
],
|
||||
}],
|
||||
[ 'disable_deprecated_rc2==1', {
|
||||
'defines': [
|
||||
'NSS_DISABLE_DEPRECATED_RC2',
|
||||
],
|
||||
}],
|
||||
],
|
||||
},
|
||||
# Common settings for debug should go here.
|
||||
|
|
@ -590,9 +622,11 @@
|
|||
'Optimization': '<(debug_optimization_level)',
|
||||
'BasicRuntimeChecks': '3',
|
||||
'RuntimeLibrary': '2', # /MD
|
||||
'DebugInformationFormat': '3',
|
||||
},
|
||||
'VCLinkerTool': {
|
||||
'LinkIncremental': '1',
|
||||
'GenerateDebugInformation' : 'true',
|
||||
},
|
||||
'VCResourceCompilerTool': {
|
||||
'PreprocessorDefinitions': ['DEBUG'],
|
||||
|
|
@ -635,7 +669,7 @@
|
|||
},
|
||||
},
|
||||
'conditions': [
|
||||
[ 'cc_use_gnu_ld==1', {
|
||||
[ 'cc_use_gnu_ld==1 or OS=="solaris"', {
|
||||
'variables': {
|
||||
'process_map_file': ['/bin/sh', '-c', '/usr/bin/env grep -v ";-" >(mapfile) | sed -e "s,;+,," -e "s; DATA ;;" -e "s,;;,," -e "s,;.*,;," > >@(_outputs)'],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ endif
|
|||
# one for each OS release. #
|
||||
#######################################################################
|
||||
|
||||
TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin BeOS OpenBSD \
|
||||
TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin OpenBSD \
|
||||
AIX RISCOS WINNT WIN95 Linux Android
|
||||
|
||||
ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET)))
|
||||
|
|
@ -121,14 +121,6 @@ ifndef MK_SUFFIX
|
|||
include $(CORE_DEPTH)/coreconf/suffix.mk
|
||||
endif
|
||||
|
||||
#######################################################################
|
||||
# [13.0] Master "Core Components" for defining JDK #
|
||||
# (dependent upon <architecture>, <source>, and <suffix> tags)#
|
||||
#######################################################################
|
||||
ifdef NS_USE_JDK
|
||||
include $(CORE_DEPTH)/coreconf/jdk.mk
|
||||
endif
|
||||
|
||||
#######################################################################
|
||||
# [14.0] Master "Core Components" rule set #
|
||||
#######################################################################
|
||||
|
|
@ -137,10 +129,39 @@ include $(CORE_DEPTH)/coreconf/ruleset.mk
|
|||
endif
|
||||
|
||||
#######################################################################
|
||||
# [15.0] Dependencies.
|
||||
# Master "Core Components" macros for Hardware features #
|
||||
#######################################################################
|
||||
|
||||
-include $(MKDEPENDENCIES)
|
||||
ifndef NSS_DISABLE_SSE3
|
||||
NSS_DISABLE_SSE3 = 0
|
||||
ifndef CC_IS_CLANG
|
||||
ifeq (,$(filter 0 1 2 3 4,$(word 1,$(GCC_VERSION))))
|
||||
NSS_DISABLE_SSE3 = 1
|
||||
endif
|
||||
endif
|
||||
ifeq (1,$(NSS_DISABLE_SSE3))
|
||||
export NSS_DISABLE_SSE3
|
||||
endif
|
||||
endif #ndef NSS_DISABLE_SSE3
|
||||
|
||||
ifndef NSS_DISABLE_AVX2
|
||||
ifneq ($(CPU_ARCH),x86_64)
|
||||
# Disable AVX2 entirely on non-Intel platforms
|
||||
NSS_DISABLE_AVX2 = 1
|
||||
$(warning CPU_ARCH is not x86_64, disabling -mavx2)
|
||||
else
|
||||
# Clang reports its version as an older gcc, but it's OK
|
||||
ifndef CC_IS_CLANG
|
||||
ifneq (,$(filter 0 1 2 3 4,$(word 1,$(GCC_VERSION))))
|
||||
NSS_DISABLE_AVX2 = 1
|
||||
endif
|
||||
endif
|
||||
ifeq (1,$(NSS_DISABLE_AVX2))
|
||||
$(warning Unable to find gcc 4.8 or greater, disabling -mavx2)
|
||||
export NSS_DISABLE_AVX2
|
||||
endif
|
||||
endif
|
||||
endif #ndef NSS_DISABLE_AVX2
|
||||
|
||||
#######################################################################
|
||||
# [16.0] Global environ ment defines
|
||||
|
|
@ -162,10 +183,26 @@ ifdef NSS_DISABLE_DBM
|
|||
DEFINES += -DNSS_DISABLE_DBM
|
||||
endif
|
||||
|
||||
ifdef NSS_DISABLE_AVX2
|
||||
DEFINES += -DNSS_DISABLE_AVX2
|
||||
endif
|
||||
|
||||
ifdef NSS_DISABLE_SSE3
|
||||
DEFINES += -DNSS_DISABLE_SSE3
|
||||
endif
|
||||
|
||||
ifdef NSS_DISABLE_CHACHAPOLY
|
||||
DEFINES += -DNSS_DISABLE_CHACHAPOLY
|
||||
endif
|
||||
|
||||
ifdef NSS_DISABLE_DEPRECATED_SEED
|
||||
DEFINES += -DNSS_DISABLE_DEPRECATED_SEED
|
||||
endif
|
||||
|
||||
ifdef NSS_DISABLE_DEPRECATED_RC2
|
||||
DEFINES += -DNSS_DISABLE_DEPRECATED_RC2
|
||||
endif
|
||||
|
||||
ifdef NSS_PKIX_NO_LDAP
|
||||
DEFINES += -DNSS_PKIX_NO_LDAP
|
||||
endif
|
||||
|
|
@ -196,6 +233,21 @@ DEFINES += -DPKIX_OBJECT_LEAK_TEST
|
|||
endif
|
||||
endif
|
||||
|
||||
# Avoid building with Neon acceleration on Arm32
|
||||
ifdef NSS_DISABLE_ARM32_NEON
|
||||
DEFINES += -DNSS_DISABLE_ARM32_NEON
|
||||
endif
|
||||
|
||||
# Avoid building with PowerPC's Altivec acceleration
|
||||
ifeq ($(NSS_DISABLE_ALTIVEC),1)
|
||||
DEFINES += -DNSS_DISABLE_ALTIVEC
|
||||
endif
|
||||
|
||||
# Avoid building with PowerPC's Crypto and VSX instructions
|
||||
ifeq ($(NSS_DISABLE_CRYPTO_VSX),1)
|
||||
DEFINES += -DNSS_DISABLE_CRYPTO_VSX
|
||||
endif
|
||||
|
||||
# This allows all library and tools code to use the util function
|
||||
# implementations directly from libnssutil3, rather than the wrappers
|
||||
# in libnss3 which are present for binary compatibility only
|
||||
|
|
|
|||
|
|
@ -1,167 +0,0 @@
|
|||
#! /usr/local/bin/perl
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
require('coreconf.pl');
|
||||
|
||||
#######-- read in variables on command line into %var
|
||||
|
||||
&parse_argv;
|
||||
|
||||
### do the copy
|
||||
|
||||
print STDERR "RELEASE TREE / MODULE = $var{RELEASE_TREE} $var{MODULE}\n";
|
||||
|
||||
|
||||
|
||||
# 1
|
||||
if ($var{RELEASE} eq "") { exit; } # Can't do release here, so exit.
|
||||
|
||||
# 2
|
||||
#if (! ($var{RELEASE} =~ /\//)) { # if no specific version is specified in RELEASE variable
|
||||
# $component = $var{RELEASE};
|
||||
#}
|
||||
#else { # if a subcomponent/version is given in the RELEASE variable
|
||||
# $var{RELEASE} =~ m|^([^/]*)/|;
|
||||
# $component = $1; # everything before the first slash;
|
||||
# }
|
||||
|
||||
# 3
|
||||
$path = $var{RELEASE};
|
||||
|
||||
|
||||
# 4
|
||||
# find out what directory we would create for 'today'
|
||||
|
||||
$year = (localtime)[5] + 1900;
|
||||
$month = (localtime)[4] + 1;
|
||||
$day = (localtime)[3];
|
||||
$today = sprintf( "%d%02d%02d", $year, $month, $day );
|
||||
|
||||
# 5
|
||||
# if version is null, then set the version to today.
|
||||
if ($var{"RELEASE_VERSION"} eq "") {
|
||||
$var{"RELEASE_VERSION"} = $today;
|
||||
}
|
||||
|
||||
#6
|
||||
$version = $var{"RELEASE_VERSION"}; # set RELEASE_VERSION to passed in variable
|
||||
|
||||
#7
|
||||
# if version is today, then we will want to make a 'current' link.
|
||||
|
||||
if ($version eq $today) {
|
||||
$create_current = 1;
|
||||
}
|
||||
|
||||
#8
|
||||
# version can be a) passed in value from command line, b) value in manifest.mn
|
||||
# or c) computed value such as '19970909'
|
||||
|
||||
|
||||
$dir = "$var{'RELEASE_TREE'}/$path";
|
||||
|
||||
#9
|
||||
if (! (-e "$dir/$version" && -d "$dir/$version")) {
|
||||
print "making dir $dir \n";
|
||||
&rec_mkdir("$dir/$version");
|
||||
}
|
||||
|
||||
|
||||
|
||||
print "version = $version\n";
|
||||
print "path = $path\n";
|
||||
print "var{release_tree} = $var{'RELEASE_TREE'}\n";
|
||||
print "dir = $dir = RELEASE_TREE/path\n";
|
||||
|
||||
|
||||
#10
|
||||
if ($create_current == 1) {
|
||||
|
||||
# unlinking and linking always occurs, even if the link is correct
|
||||
print "unlinking $dir/current\n";
|
||||
unlink("$dir/current");
|
||||
|
||||
print "putting version number $today into 'current' file..";
|
||||
|
||||
open(FILE,">$dir/current") || die " couldn't open current\n";
|
||||
print FILE "$today\n";
|
||||
close(FILE);
|
||||
print " ..done\n"
|
||||
|
||||
}
|
||||
|
||||
&rec_mkdir("$dir/$version/$var{'RELEASE_MD_DIR'}");
|
||||
&rec_mkdir("$dir/$version/$var{'RELEASE_XP_DIR'}");
|
||||
|
||||
|
||||
|
||||
|
||||
foreach $jarfile (split(/ /,$var{FILES}) ) {
|
||||
print STDERR "---------------------------------------------\n";
|
||||
|
||||
$jarinfo = $var{$jarfile};
|
||||
|
||||
($jardir,$jaropts) = split(/\|/,$jarinfo);
|
||||
|
||||
if ($jaropts =~ /f/) {
|
||||
print STDERR "Copying files $jardir....\n";
|
||||
}
|
||||
else {
|
||||
print STDERR "Copying jar file $jarfile....\n";
|
||||
}
|
||||
|
||||
print "jaropts = $jaropts\n";
|
||||
|
||||
if ($jaropts =~ /m/) {
|
||||
$destdir = $var{"RELEASE_MD_DIR"};
|
||||
print "found m, using MD dir $destdir\n";
|
||||
}
|
||||
elsif ($jaropts =~ /x/) {
|
||||
$destdir = $var{"RELEASE_XP_DIR"};
|
||||
print "found x, using XP dir $destdir\n";
|
||||
}
|
||||
else {
|
||||
die "Error: must specify m or x in jar options in $jarinfo line\n";
|
||||
}
|
||||
|
||||
|
||||
$distdir = "$dir/$version/$destdir";
|
||||
|
||||
|
||||
|
||||
if ($jaropts =~ /f/) {
|
||||
|
||||
print "splitting: \"$jardir\"\n";
|
||||
for $srcfile (split(/ /,$jardir)) {
|
||||
|
||||
#if srcfile has a slash
|
||||
if ($srcfile =~ m|/|) {
|
||||
#pull out everything before the last slash into $1
|
||||
$srcfile =~ m|(.*)/|;
|
||||
$distsubdir = "/$1";
|
||||
print "making dir $distdir$distsubdir\n";
|
||||
&rec_mkdir("$distdir$distsubdir");
|
||||
}
|
||||
print "copy: from $srcfile\n";
|
||||
print " to $distdir$distsubdir\n";
|
||||
$srcprefix = "";
|
||||
if ($jaropts =~/m/) {
|
||||
$srcprefix = "$var{'PLATFORM'}/";
|
||||
}
|
||||
system("cp $srcprefix$srcfile $distdir$distsubdir");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$srcfile = "$var{SOURCE_RELEASE_PREFIX}/$jardir/$jarfile";
|
||||
|
||||
print "copy: from $srcfile\n";
|
||||
print " to $distdir\n";
|
||||
|
||||
system("cp $srcfile $distdir");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -15,8 +15,12 @@ def main():
|
|||
host_arch = 'x64'
|
||||
elif fnmatch.fnmatch(host_arch, 'i?86') or host_arch == 'i86pc':
|
||||
host_arch = 'ia32'
|
||||
elif host_arch == 'arm64':
|
||||
pass
|
||||
elif host_arch.startswith('arm'):
|
||||
host_arch = 'arm'
|
||||
elif host_arch.startswith('mips64'):
|
||||
host_arch = 'mips64'
|
||||
elif host_arch.startswith('mips'):
|
||||
host_arch = 'mips'
|
||||
print(host_arch)
|
||||
|
|
|
|||
7
security/nss/coreconf/fuzz.sh
Normal file → Executable file
7
security/nss/coreconf/fuzz.sh
Normal file → Executable file
|
|
@ -23,18 +23,13 @@ if [ "$fuzz_oss" = 1 ]; then
|
|||
gyp_params+=(-Dno_zdefs=1 -Dfuzz_oss=1)
|
||||
else
|
||||
enable_sanitizer asan
|
||||
enable_sanitizer fuzzer
|
||||
# Ubsan only builds on x64 for the moment.
|
||||
if [ "$target_arch" = "x64" ]; then
|
||||
enable_ubsan
|
||||
fi
|
||||
enable_sancov
|
||||
fi
|
||||
|
||||
if [ "$fuzz_tls" = 1 ]; then
|
||||
gyp_params+=(-Dfuzz_tls=1)
|
||||
fi
|
||||
|
||||
if [ ! -f "/usr/lib/libFuzzingEngine.a" ]; then
|
||||
echo "Cloning libFuzzer files ..."
|
||||
run_verbose "$cwd"/fuzz/config/clone_libfuzzer.sh
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,189 +0,0 @@
|
|||
#! /usr/local/bin/perl
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
print STDERR "import.pl\n";
|
||||
|
||||
require('coreconf.pl');
|
||||
|
||||
|
||||
$returncode =0;
|
||||
|
||||
|
||||
#######-- read in variables on command line into %var
|
||||
|
||||
$var{UNZIP} = "unzip -o";
|
||||
|
||||
&parse_argv;
|
||||
|
||||
if (! ($var{IMPORTS} =~ /\w/)) {
|
||||
print STDERR "nothing to import\n";
|
||||
}
|
||||
|
||||
######-- Do the import!
|
||||
|
||||
foreach $import (split(/ /,$var{IMPORTS}) ) {
|
||||
|
||||
print STDERR "\n\nIMPORTING .... $import\n-----------------------------\n";
|
||||
|
||||
|
||||
# if a specific version specified in IMPORT variable
|
||||
# (if $import has a slash in it)
|
||||
|
||||
if ($import =~ /\//) {
|
||||
# $component=everything before the first slash of $import
|
||||
|
||||
$import =~ m|^([^/]*)/|;
|
||||
$component = $1;
|
||||
|
||||
$import =~ m|^(.*)/([^/]*)$|;
|
||||
|
||||
# $path=everything before the last slash of $import
|
||||
$path = $1;
|
||||
|
||||
# $version=everything after the last slash of $import
|
||||
$version = $2;
|
||||
|
||||
if ($var{VERSION} ne "current") {
|
||||
$version = $var{VERSION};
|
||||
}
|
||||
}
|
||||
else {
|
||||
$component = $import;
|
||||
$path = $import;
|
||||
$version = $var{VERSION};
|
||||
}
|
||||
|
||||
$releasejardir = "$var{RELEASE_TREE}/$path";
|
||||
if ($version eq "current") {
|
||||
print STDERR "Current version specified. Reading 'current' file ... \n";
|
||||
|
||||
open(CURRENT,"$releasejardir/current") || die "NO CURRENT FILE\n";
|
||||
$version = <CURRENT>;
|
||||
$version =~ s/(\r?\n)*$//; # remove any trailing [CR/]LF's
|
||||
close(CURRENT);
|
||||
print STDERR "Using version $version\n";
|
||||
if ( $version eq "") {
|
||||
die "Current version file empty. Stopping\n";
|
||||
}
|
||||
}
|
||||
|
||||
$releasejardir = "$releasejardir/$version";
|
||||
if ( ! -d $releasejardir) {
|
||||
die "$releasejardir doesn't exist (Invalid Version?)\n";
|
||||
}
|
||||
foreach $jarfile (split(/ /,$var{FILES})) {
|
||||
|
||||
($relpath,$distpath,$options) = split(/\|/, $var{$jarfile});
|
||||
|
||||
if ($var{'OVERRIDE_IMPORT_CHECK'} eq 'YES') {
|
||||
$options =~ s/v//g;
|
||||
}
|
||||
|
||||
if ( $relpath ne "") { $releasejarpathname = "$releasejardir/$relpath";}
|
||||
else { $releasejarpathname = $releasejardir; }
|
||||
|
||||
# If a component doesn't have IDG versions, import the DBG ones
|
||||
if( ! -e "$releasejarpathname/$jarfile" ) {
|
||||
if( $relpath =~ /IDG\.OBJ$/ ) {
|
||||
$relpath =~ s/IDG.OBJ/DBG.OBJ/;
|
||||
$releasejarpathname = "$releasejardir/$relpath";
|
||||
} elsif( $relpath =~ /IDG\.OBJD$/ ) {
|
||||
$relpath =~ s/IDG.OBJD/DBG.OBJD/;
|
||||
$releasejarpathname = "$releasejardir/$relpath";
|
||||
}
|
||||
}
|
||||
|
||||
if (-e "$releasejarpathname/$jarfile") {
|
||||
print STDERR "\nWorking on jarfile: $jarfile\n";
|
||||
|
||||
if ($distpath =~ m|/$|) {
|
||||
$distpathname = "$distpath$component";
|
||||
}
|
||||
else {
|
||||
$distpathname = "$distpath";
|
||||
}
|
||||
|
||||
|
||||
#the block below is used to determine whether or not the xp headers have
|
||||
#already been imported for this component
|
||||
|
||||
$doimport = 1;
|
||||
if ($options =~ /v/) { # if we should check the imported version
|
||||
print STDERR "Checking if version file exists $distpathname/version\n";
|
||||
if (-e "$distpathname/version") {
|
||||
open( VFILE, "<$distpathname/version") ||
|
||||
die "Cannot open $distpathname/version for reading. Permissions?\n";
|
||||
$importversion = <VFILE>;
|
||||
close (VFILE);
|
||||
$importversion =~ s/\r?\n$//; # Strip off any trailing CR/LF
|
||||
if ($version eq $importversion) {
|
||||
print STDERR "$distpathname version '$importversion' already imported. Skipping...\n";
|
||||
$doimport =0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($doimport == 1) {
|
||||
if (! -d "$distpathname") {
|
||||
&rec_mkdir("$distpathname");
|
||||
}
|
||||
# delete the stuff in there already.
|
||||
# (this should really be recursive delete.)
|
||||
|
||||
if ($options =~ /v/) {
|
||||
$remheader = "\nREMOVING files in '$distpathname/' :";
|
||||
opendir(DIR,"$distpathname") ||
|
||||
die ("Cannot read directory $distpathname\n");
|
||||
@filelist = readdir(DIR);
|
||||
closedir(DIR);
|
||||
foreach $file ( @filelist ) {
|
||||
if (! ($file =~ m!/.?.$!) ) {
|
||||
if (! (-d $file)) {
|
||||
$file =~ m!([^/]*)$!;
|
||||
print STDERR "$remheader $1";
|
||||
$remheader = " ";
|
||||
unlink "$distpathname/$file";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print STDERR "\n\n";
|
||||
|
||||
print STDERR "\nExtracting jarfile '$jarfile' to local directory $distpathname/\n";
|
||||
|
||||
print STDERR "$var{UNZIP} $releasejarpathname/$jarfile -d $distpathname\n";
|
||||
system("$var{UNZIP} $releasejarpathname/$jarfile -d $distpathname");
|
||||
|
||||
$r = $?;
|
||||
|
||||
if ($options =~ /v/) {
|
||||
if ($r == 0) {
|
||||
unlink ("$distpathname/version");
|
||||
if (open(VFILE,">$distpathname/version")) {
|
||||
print VFILE "$version\n";
|
||||
close(VFILE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
print STDERR "Could not create '$distpathname/version'. Permissions?\n";
|
||||
$returncode ++;
|
||||
}
|
||||
}
|
||||
} # if (doimport)
|
||||
} # if (-e releasejarpathname/jarfile)
|
||||
} # foreach jarfile)
|
||||
} # foreach IMPORT
|
||||
|
||||
|
||||
|
||||
exit($returncode);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,504 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
ifdef NS_USE_JDK
|
||||
#######################################################################
|
||||
# [1] Define preliminary JDK "Core Components" toolset options #
|
||||
#######################################################################
|
||||
|
||||
# set default JDK java threading model
|
||||
ifeq ($(JDK_THREADING_MODEL),)
|
||||
JDK_THREADING_MODEL = native_threads
|
||||
# no such thing as -native flag
|
||||
JDK_THREADING_MODEL_OPT =
|
||||
endif
|
||||
|
||||
#######################################################################
|
||||
# [2] Define platform-independent JDK "Core Components" options #
|
||||
#######################################################################
|
||||
|
||||
# set default location of the java classes repository
|
||||
ifeq ($(JAVA_DESTPATH),)
|
||||
ifdef BUILD_OPT
|
||||
JAVA_DESTPATH = $(SOURCE_CLASSES_DIR)
|
||||
else
|
||||
JAVA_DESTPATH = $(SOURCE_CLASSES_DBG_DIR)
|
||||
endif
|
||||
endif
|
||||
|
||||
# set default location of the package under the java classes repository
|
||||
# note that this overrides the default package value in ruleset.mk
|
||||
ifeq ($(PACKAGE),)
|
||||
PACKAGE = .
|
||||
endif
|
||||
|
||||
# set default location of the java source code repository
|
||||
ifeq ($(JAVA_SOURCEPATH),)
|
||||
JAVA_SOURCEPATH = .
|
||||
endif
|
||||
|
||||
# add JNI directory to default include search path
|
||||
ifneq ($(JNI_GEN),)
|
||||
ifdef NSBUILDROOT
|
||||
INCLUDES += -I$(JNI_GEN_DIR) -I$(SOURCE_XP_DIR)
|
||||
else
|
||||
INCLUDES += -I$(JNI_GEN_DIR)
|
||||
endif
|
||||
endif
|
||||
|
||||
#######################################################################
|
||||
# [3] Define platform-dependent JDK "Core Components" options #
|
||||
#######################################################################
|
||||
|
||||
# set [Microsoft Windows] platforms
|
||||
ifeq ($(OS_ARCH), WINNT)
|
||||
JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar
|
||||
|
||||
ifeq ($(JRE_HOME),)
|
||||
JRE_HOME = $(JAVA_HOME)
|
||||
JRE_CLASSES = $(JAVA_CLASSES)
|
||||
else
|
||||
ifeq ($(JRE_CLASSES),)
|
||||
JRE_CLASSES = $(JRE_HOME)/lib/rt.jar
|
||||
endif
|
||||
endif
|
||||
|
||||
PATH_SEPARATOR = ;
|
||||
|
||||
# (2) specify "header" information
|
||||
JAVA_ARCH = win32
|
||||
|
||||
INCLUDES += -I$(JAVA_HOME)/include
|
||||
INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH)
|
||||
|
||||
# currently, disable JIT option on this platform
|
||||
JDK_JIT_OPT = -nojit
|
||||
endif
|
||||
|
||||
# set [Sun Solaris] platforms
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar
|
||||
|
||||
ifeq ($(JRE_HOME),)
|
||||
JRE_HOME = $(JAVA_HOME)
|
||||
JRE_CLASSES = $(JAVA_CLASSES)
|
||||
else
|
||||
ifeq ($(JRE_CLASSES),)
|
||||
JRE_CLASSES = $(JRE_HOME)/lib/rt.jar
|
||||
endif
|
||||
endif
|
||||
|
||||
PATH_SEPARATOR = :
|
||||
|
||||
# (2) specify "header" information
|
||||
JAVA_ARCH = solaris
|
||||
|
||||
INCLUDES += -I$(JAVA_HOME)/include
|
||||
INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH)
|
||||
|
||||
# currently, disable JIT option on this platform
|
||||
JDK_JIT_OPT =
|
||||
endif
|
||||
|
||||
# set [Hewlett Packard HP-UX] platforms
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar
|
||||
|
||||
ifeq ($(JRE_HOME),)
|
||||
JRE_HOME = $(JAVA_HOME)
|
||||
JRE_CLASSES = $(JAVA_CLASSES)
|
||||
else
|
||||
ifeq ($(JRE_CLASSES),)
|
||||
JRE_CLASSES = $(JRE_HOME)/lib/rt.jar
|
||||
endif
|
||||
endif
|
||||
|
||||
PATH_SEPARATOR = :
|
||||
|
||||
# (2) specify "header" information
|
||||
JAVA_ARCH = hp-ux
|
||||
|
||||
INCLUDES += -I$(JAVA_HOME)/include
|
||||
INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH)
|
||||
|
||||
# no JIT option available on this platform
|
||||
JDK_JIT_OPT =
|
||||
endif
|
||||
|
||||
# set [Redhat Linux] platforms
|
||||
ifeq ($(OS_ARCH), Linux)
|
||||
JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar
|
||||
|
||||
ifeq ($(JRE_HOME),)
|
||||
JRE_HOME = $(JAVA_HOME)
|
||||
JRE_CLASSES = $(JAVA_CLASSES)
|
||||
else
|
||||
ifeq ($(JRE_CLASSES),)
|
||||
JRE_CLASSES = $(JRE_HOME)/lib/rt.jar
|
||||
endif
|
||||
endif
|
||||
|
||||
PATH_SEPARATOR = :
|
||||
|
||||
# (2) specify "header" information
|
||||
JAVA_ARCH = linux
|
||||
|
||||
INCLUDES += -I$(JAVA_HOME)/include
|
||||
INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH)
|
||||
|
||||
# no JIT option available on this platform
|
||||
JDK_JIT_OPT =
|
||||
endif
|
||||
|
||||
# set [Mac OS X] platforms
|
||||
ifeq ($(OS_ARCH), Darwin)
|
||||
JAVA_CLASSES = $(JAVA_HOME)/../Classes/classes.jar
|
||||
|
||||
ifeq ($(JRE_HOME),)
|
||||
JRE_HOME = $(JAVA_HOME)
|
||||
JRE_CLASSES = $(JAVA_CLASSES)
|
||||
else
|
||||
ifeq ($(JRE_CLASSES),)
|
||||
JRE_CLASSES = $(JRE_HOME)/../Classes/classes.jar
|
||||
endif
|
||||
endif
|
||||
|
||||
PATH_SEPARATOR = :
|
||||
|
||||
# (2) specify "header" information
|
||||
JAVA_ARCH = darwin
|
||||
|
||||
INCLUDES += -I$(JAVA_HOME)/include
|
||||
INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH)
|
||||
|
||||
# no JIT option available on this platform
|
||||
JDK_JIT_OPT =
|
||||
endif
|
||||
|
||||
# set [IBM AIX] platforms
|
||||
ifeq ($(OS_ARCH), AIX)
|
||||
JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar
|
||||
|
||||
ifeq ($(JRE_HOME),)
|
||||
JRE_HOME = $(JAVA_HOME)
|
||||
JRE_CLASSES = $(JAVA_CLASSES)
|
||||
else
|
||||
ifeq ($(JRE_CLASSES),)
|
||||
JRE_CLASSES = $(JRE_HOME)/lib/rt.jar
|
||||
endif
|
||||
endif
|
||||
|
||||
PATH_SEPARATOR = :
|
||||
|
||||
# (2) specify "header" information
|
||||
JAVA_ARCH = aix
|
||||
|
||||
INCLUDES += -I$(JAVA_HOME)/include
|
||||
INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH)
|
||||
|
||||
# no JIT option available on this platform
|
||||
JDK_JIT_OPT =
|
||||
endif
|
||||
|
||||
# set [Digital UNIX] platforms
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
JAVA_CLASSES = $(JAVA_HOME)/jre/lib/rt.jar
|
||||
|
||||
ifeq ($(JRE_HOME),)
|
||||
JRE_HOME = $(JAVA_HOME)
|
||||
JRE_CLASSES = $(JAVA_CLASSES)
|
||||
else
|
||||
ifeq ($(JRE_CLASSES),)
|
||||
JRE_CLASSES = $(JRE_HOME)/lib/rt.jar
|
||||
endif
|
||||
endif
|
||||
|
||||
PATH_SEPARATOR = :
|
||||
|
||||
# (2) specify "header" information
|
||||
JAVA_ARCH = alpha
|
||||
|
||||
INCLUDES += -I$(JAVA_HOME)/include
|
||||
INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH)
|
||||
|
||||
# no JIT option available on this platform
|
||||
JDK_JIT_OPT =
|
||||
endif
|
||||
|
||||
# set [Silicon Graphics IRIX] platforms
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
JAVA_CLASSES = $(JAVA_HOME)/lib/dev.jar:$(JAVA_HOME)/lib/rt.jar
|
||||
|
||||
ifeq ($(JRE_HOME),)
|
||||
JRE_HOME = $(JAVA_HOME)
|
||||
JRE_CLASSES = $(JAVA_CLASSES)
|
||||
else
|
||||
ifeq ($(JRE_CLASSES),)
|
||||
JRE_CLASSES = $(JRE_HOME)/lib/dev.jar:$(JRE_HOME)/lib/rt.jar
|
||||
endif
|
||||
endif
|
||||
|
||||
PATH_SEPARATOR = :
|
||||
|
||||
# (2) specify "header" information
|
||||
JAVA_ARCH = irix
|
||||
|
||||
INCLUDES += -I$(JAVA_HOME)/include
|
||||
INCLUDES += -I$(JAVA_HOME)/include/$(JAVA_ARCH)
|
||||
|
||||
# no JIT option available on this platform
|
||||
JDK_JIT_OPT =
|
||||
endif
|
||||
|
||||
#######################################################################
|
||||
# [4] Define remaining JDK "Core Components" default toolset options #
|
||||
#######################################################################
|
||||
|
||||
# set JDK optimization model
|
||||
ifeq ($(BUILD_OPT),1)
|
||||
JDK_OPTIMIZER_OPT = -O
|
||||
else
|
||||
JDK_OPTIMIZER_OPT = -g
|
||||
endif
|
||||
|
||||
# set minimal JDK debugging model
|
||||
ifeq ($(JDK_DEBUG),1)
|
||||
JDK_DEBUG_OPT = -debug
|
||||
else
|
||||
JDK_DEBUG_OPT =
|
||||
endif
|
||||
|
||||
# set default path to repository for JDK classes
|
||||
ifeq ($(JDK_CLASS_REPOSITORY_OPT),)
|
||||
JDK_CLASS_REPOSITORY_OPT = -d $(JAVA_DESTPATH)
|
||||
endif
|
||||
|
||||
# define a default JDK classpath
|
||||
ifeq ($(JDK_CLASSPATH),)
|
||||
JDK_CLASSPATH = '$(JAVA_DESTPATH)$(PATH_SEPARATOR)$(JAVA_SOURCEPATH)$(PATH_SEPARATOR)$(JAVA_CLASSES)'
|
||||
endif
|
||||
|
||||
# by default, override CLASSPATH environment variable using the JDK classpath option with $(JDK_CLASSPATH)
|
||||
ifeq ($(JDK_CLASSPATH_OPT),)
|
||||
JDK_CLASSPATH_OPT = -classpath $(JDK_CLASSPATH)
|
||||
endif
|
||||
|
||||
ifeq ($(USE_64), 1)
|
||||
JDK_USE_64 = -d64
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
#######################################################################
|
||||
# [5] Define JDK "Core Components" toolset; #
|
||||
# (always allow a user to override these values) #
|
||||
#######################################################################
|
||||
|
||||
#
|
||||
# (1) appletviewer
|
||||
#
|
||||
|
||||
ifeq ($(APPLETVIEWER),)
|
||||
APPLETVIEWER_PROG = $(JAVA_HOME)/bin/appletviewer$(PROG_SUFFIX)
|
||||
APPLETVIEWER_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
APPLETVIEWER_FLAGS += $(JDK_DEBUG_OPT)
|
||||
APPLETVIEWER_FLAGS += $(JDK_JIT_OPT)
|
||||
APPLETVIEWER = $(APPLETVIEWER_PROG) $(APPLETVIEWER_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (2) jar
|
||||
#
|
||||
|
||||
ifeq ($(JAR),)
|
||||
JAR_PROG = $(JAVA_HOME)/bin/jar$(PROG_SUFFIX)
|
||||
JAR_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JAR = $(JAR_PROG) $(JAR_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (3) java
|
||||
#
|
||||
|
||||
ifeq ($(JAVA),)
|
||||
JAVA_PROG = $(JAVA_HOME)/bin/java$(PROG_SUFFIX)
|
||||
JAVA_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JAVA_FLAGS += $(JDK_DEBUG_OPT)
|
||||
JAVA_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
JAVA_FLAGS += $(JDK_JIT_OPT)
|
||||
JAVA_FLAGS += $(JDK_USE_64)
|
||||
JAVA = $(JAVA_PROG) $(JAVA_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (4) javac
|
||||
#
|
||||
|
||||
ifeq ($(JAVAC),)
|
||||
JAVAC_PROG = $(JAVA_HOME)/bin/javac$(PROG_SUFFIX)
|
||||
JAVAC_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JAVAC_FLAGS += $(JDK_OPTIMIZER_OPT)
|
||||
JAVAC_FLAGS += $(JDK_DEBUG_OPT)
|
||||
JAVAC_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
JAVAC_FLAGS += $(JDK_CLASS_REPOSITORY_OPT)
|
||||
JAVAC_FLAGS += $(JDK_USE_64)
|
||||
JAVAC = $(JAVAC_PROG) $(JAVAC_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (5) javadoc
|
||||
#
|
||||
|
||||
ifeq ($(JAVADOC),)
|
||||
JAVADOC_PROG = $(JAVA_HOME)/bin/javadoc$(PROG_SUFFIX)
|
||||
JAVADOC_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JAVADOC_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
JAVADOC = $(JAVADOC_PROG) $(JAVADOC_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (6) javah
|
||||
#
|
||||
|
||||
ifeq ($(JAVAH),)
|
||||
JAVAH_PROG = $(JAVA_HOME)/bin/javah$(PROG_SUFFIX)
|
||||
JAVAH_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JAVAH_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
JAVAH = $(JAVAH_PROG) $(JAVAH_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (7) javakey
|
||||
#
|
||||
|
||||
ifeq ($(JAVAKEY),)
|
||||
JAVAKEY_PROG = $(JAVA_HOME)/bin/javakey$(PROG_SUFFIX)
|
||||
JAVAKEY_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JAVAKEY = $(JAVAKEY_PROG) $(JAVAKEY_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (8) javap
|
||||
#
|
||||
|
||||
ifeq ($(JAVAP),)
|
||||
JAVAP_PROG = $(JAVA_HOME)/bin/javap$(PROG_SUFFIX)
|
||||
JAVAP_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JAVAP_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
JAVAP = $(JAVAP_PROG) $(JAVAP_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (9) javat
|
||||
#
|
||||
|
||||
ifeq ($(JAVAT),)
|
||||
JAVAT_PROG = $(JAVA_HOME)/bin/javat$(PROG_SUFFIX)
|
||||
JAVAT_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JAVAT = $(JAVAT_PROG) $(JAVAT_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (10) javaverify
|
||||
#
|
||||
|
||||
ifeq ($(JAVAVERIFY),)
|
||||
JAVAVERIFY_PROG = $(JAVA_HOME)/bin/javaverify$(PROG_SUFFIX)
|
||||
JAVAVERIFY_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JAVAVERIFY = $(JAVAVERIFY_PROG) $(JAVAVERIFY_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (11) javaw
|
||||
#
|
||||
|
||||
ifeq ($(JAVAW),)
|
||||
jJAVAW_PROG = $(JAVA_HOME)/bin/javaw$(PROG_SUFFIX)
|
||||
jJAVAW_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
jJAVAW_FLAGS += $(JDK_DEBUG_OPT)
|
||||
jJAVAW_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
jJAVAW_FLAGS += $(JDK_JIT_OPT)
|
||||
jJAVAW = $(JAVAW_PROG) $(JAVAW_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (12) jdb
|
||||
#
|
||||
|
||||
ifeq ($(JDB),)
|
||||
JDB_PROG = $(JAVA_HOME)/bin/jdb$(PROG_SUFFIX)
|
||||
JDB_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JDB_FLAGS += $(JDK_DEBUG_OPT)
|
||||
JDB_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
JDB_FLAGS += $(JDK_JIT_OPT)
|
||||
JDB = $(JDB_PROG) $(JDB_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (13) jre
|
||||
#
|
||||
|
||||
ifeq ($(JRE),)
|
||||
JRE_PROG = $(JAVA_HOME)/bin/jre$(PROG_SUFFIX)
|
||||
JRE_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JRE_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
JRE_FLAGS += $(JDK_JIT_OPT)
|
||||
JRE = $(JRE_PROG) $(JRE_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (14) jrew
|
||||
#
|
||||
|
||||
ifeq ($(JREW),)
|
||||
JREW_PROG = $(JAVA_HOME)/bin/jrew$(PROG_SUFFIX)
|
||||
JREW_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
JREW_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
JREW_FLAGS += $(JDK_JIT_OPT)
|
||||
JREW = $(JREW_PROG) $(JREW_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (15) native2ascii
|
||||
#
|
||||
|
||||
ifeq ($(NATIVE2ASCII),)
|
||||
NATIVE2ASCII_PROG = $(JAVA_HOME)/bin/native2ascii$(PROG_SUFFIX)
|
||||
NATIVE2ASCII_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
NATIVE2ASCII = $(NATIVE2ASCII_PROG) $(NATIVE2ASCII_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (16) rmic
|
||||
#
|
||||
|
||||
ifeq ($(RMIC),)
|
||||
RMIC_PROG = $(JAVA_HOME)/bin/rmic$(PROG_SUFFIX)
|
||||
RMIC_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
RMIC_FLAGS += $(JDK_OPTIMIZER_OPT)
|
||||
RMIC_FLAGS += $(JDK_CLASSPATH_OPT)
|
||||
RMIC = $(RMIC_PROG) $(RMIC_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (17) rmiregistry
|
||||
#
|
||||
|
||||
ifeq ($(RMIREGISTRY),)
|
||||
RMIREGISTRY_PROG = $(JAVA_HOME)/bin/rmiregistry$(PROG_SUFFIX)
|
||||
RMIREGISTRY_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
RMIREGISTRY = $(RMIREGISTRY_PROG) $(RMIREGISTRY_FLAGS)
|
||||
endif
|
||||
|
||||
#
|
||||
# (18) serialver
|
||||
#
|
||||
|
||||
ifeq ($(SERIALVER),)
|
||||
SERIALVER_PROG = $(JAVA_HOME)/bin/serialver$(PROG_SUFFIX)
|
||||
SERIALVER_FLAGS = $(JDK_THREADING_MODEL_OPT)
|
||||
SERIALVER = $(SERIALVER_PROG) $(SERIALVER_FLAGS)
|
||||
endif
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
#!/usr/local/bin/perl
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Input: -d dir -j javahcmd foo1 foo2 . . .
|
||||
# Compares generated "_jni/foo1.h" file with "foo1.class", and
|
||||
# generated "_jni/foo2.h" file with "foo2.class", etc.
|
||||
# (NOTE: unlike its closely related cousin, outofdate.pl,
|
||||
# the "-d dir" must always be specified)
|
||||
# Runs the javahcmd on all files that are different.
|
||||
#
|
||||
# Returns: list of headers which are OLDER than corresponding class
|
||||
# files (non-existent class files are considered to be real old :-)
|
||||
|
||||
my $javah = "";
|
||||
my $classdir = "";
|
||||
|
||||
while(1) {
|
||||
if ($ARGV[0] eq '-d') {
|
||||
$classdir = $ARGV[1];
|
||||
$classdir .= "/";
|
||||
shift;
|
||||
shift;
|
||||
} elsif($ARGV[0] eq '-j') {
|
||||
$javah = $ARGV[1];
|
||||
shift;
|
||||
shift;
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if( $javah eq "") {
|
||||
die "Must specify -j <javah command>";
|
||||
}
|
||||
if( $classdir eq "") {
|
||||
die "Must specify -d <classdir>";
|
||||
}
|
||||
|
||||
foreach $filename (@ARGV)
|
||||
{
|
||||
$headerfilename = "_jni/";
|
||||
$headerfilename .= $filename;
|
||||
$headerfilename =~ s/\./_/g;
|
||||
$headerfilename .= ".h";
|
||||
|
||||
$classfilename = $filename;
|
||||
$classfilename =~ s|\.|/|g;
|
||||
$classfilename .= ".class";
|
||||
|
||||
$classfilename = $classdir . $classfilename;
|
||||
|
||||
|
||||
( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $headermtime,
|
||||
$ctime, $blksize, $blocks ) = stat( $headerfilename );
|
||||
|
||||
( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $classmtime,
|
||||
$ctime, $blksize, $blocks ) = stat( $classfilename );
|
||||
|
||||
if( $headermtime < $classmtime )
|
||||
{
|
||||
# NOTE: Since this is used by "javah", and "javah" refuses to overwrite
|
||||
# an existing file, we force an unlink from this script, since
|
||||
# we actually want to regenerate the header file at this time.
|
||||
unlink $headerfilename;
|
||||
push @filelist, $filename;
|
||||
}
|
||||
}
|
||||
|
||||
if( @filelist ) {
|
||||
$cmd = "$javah " . join(" ",@filelist);
|
||||
$cmd =~ s/\'/\"/g; # because windows doesn't understand single quote
|
||||
print "$cmd\n";
|
||||
exit (system($cmd) >> 8);
|
||||
} else {
|
||||
print "All JNI header files up to date.\n"
|
||||
}
|
||||
|
|
@ -15,16 +15,13 @@ ifdef BUILD_TREE
|
|||
ifdef LIBRARY_NAME
|
||||
BUILD = $(BUILD_TREE)/nss/$(LIBRARY_NAME)
|
||||
OBJDIR = $(BUILD_TREE)/nss/$(LIBRARY_NAME)
|
||||
DEPENDENCIES = $(BUILD_TREE)/nss/$(LIBRARY_NAME)/.md
|
||||
else
|
||||
BUILD = $(BUILD_TREE)/nss
|
||||
OBJDIR = $(BUILD_TREE)/nss
|
||||
DEPENDENCIES = $(BUILD_TREE)/nss/.md
|
||||
endif
|
||||
else
|
||||
BUILD = $(PLATFORM)
|
||||
OBJDIR = $(PLATFORM)
|
||||
DEPENDENCIES = $(PLATFORM)/.md
|
||||
endif
|
||||
|
||||
DIST = $(SOURCE_PREFIX)/$(PLATFORM)
|
||||
|
|
@ -33,7 +30,7 @@ ifdef BUILD_DEBUG_GC
|
|||
DEFINES += -DDEBUG_GC
|
||||
endif
|
||||
|
||||
GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*)
|
||||
GARBAGE += core $(wildcard core.[0-9]*)
|
||||
|
||||
ifdef NSPR_INCLUDE_DIR
|
||||
INCLUDES += -I$(NSPR_INCLUDE_DIR)
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEPTH = ../..
|
||||
CORE_DEPTH = ../..
|
||||
|
||||
MODULE = coreconf
|
||||
|
||||
CSRCS = \
|
||||
cppsetup.c \
|
||||
ifparser.c \
|
||||
include.c \
|
||||
main.c \
|
||||
parse.c \
|
||||
pr.c
|
||||
|
||||
PROGRAM = mkdepend
|
||||
|
||||
# Indicate that this directory builds build tools.
|
||||
INTERNAL_TOOLS = 1
|
||||
|
||||
|
||||
include $(DEPTH)/coreconf/config.mk
|
||||
|
||||
TARGETS = $(PROGRAM)
|
||||
ifeq (,$(filter-out OS2 WIN%,$(OS_TARGET)))
|
||||
DEFINES += -DNO_X11
|
||||
else
|
||||
INSTALL = true
|
||||
endif
|
||||
|
||||
ifdef NATIVE_CC
|
||||
CC=$(NATIVE_CC)
|
||||
endif
|
||||
|
||||
ifdef NATIVE_FLAGS
|
||||
OS_CFLAGS=$(NATIVE_FLAGS)
|
||||
endif
|
||||
|
||||
include $(DEPTH)/coreconf/rules.mk
|
||||
|
||||
ifdef GNU_CC
|
||||
OPTIMIZER = -O3
|
||||
else
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
OPTIMIZER = -fast
|
||||
endif
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OPTIMIZER = -Ox
|
||||
endif
|
||||
endif
|
||||
|
||||
DEFINES += -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".$(OBJ_SUFFIX)\"
|
||||
|
||||
# Redefine MAKE_OBJDIR for just this directory
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi
|
||||
endef
|
||||
|
||||
|
|
@ -1,233 +0,0 @@
|
|||
/* $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.11 2001/12/17 20:52:22 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 */
|
||||
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
/* $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.14 2003/01/17 17:09:49 tsi Exp $ */
|
||||
|
||||
#ifndef NO_X11
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xfuncproto.h>
|
||||
#endif
|
||||
#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 256 /* "-include" files */
|
||||
#define MAXDIRS 1024
|
||||
#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 *, ...);
|
||||
|
|
@ -1,551 +0,0 @@
|
|||
/*
|
||||
* $Xorg: ifparser.c,v 1.3 2000/08/17 19:41:50 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
|
||||
* | '~' VALUE
|
||||
* | 'defined' '(' variable ')'
|
||||
* | 'defined' variable
|
||||
* | # variable '(' variable-list ')'
|
||||
* | 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.c,v 3.11 2002/09/23 01:48:08 tsi Exp $ */
|
||||
|
||||
#include "ifparser.h"
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/****************************************************************************
|
||||
Internal Macros and Utilities for Parser
|
||||
****************************************************************************/
|
||||
|
||||
#define DO(val) if (!(val)) return NULL
|
||||
#define CALLFUNC(ggg,fff) (*((ggg)->funcs.fff))
|
||||
#define SKIPSPACE(ccc) while (isspace(*ccc)) ccc++
|
||||
#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_')
|
||||
|
||||
|
||||
static const char *
|
||||
parse_variable (IfParser *g, const char *cp, const char **varp)
|
||||
{
|
||||
SKIPSPACE (cp);
|
||||
|
||||
if (!isvarfirstletter (*cp))
|
||||
return CALLFUNC(g, handle_error) (g, cp, "variable name");
|
||||
|
||||
*varp = cp;
|
||||
/* EMPTY */
|
||||
for (cp++; isalnum(*cp) || *cp == '_'; cp++) ;
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_number (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long base = 10;
|
||||
SKIPSPACE (cp);
|
||||
|
||||
if (!isdigit(*cp))
|
||||
return CALLFUNC(g, handle_error) (g, cp, "number");
|
||||
|
||||
*valp = 0;
|
||||
|
||||
if (*cp == '0') {
|
||||
cp++;
|
||||
if ((*cp == 'x') || (*cp == 'X')) {
|
||||
base = 16;
|
||||
cp++;
|
||||
} else {
|
||||
base = 8;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ignore overflows and assume ASCII, what source is usually written in */
|
||||
while (1) {
|
||||
int increment = -1;
|
||||
if (base == 8) {
|
||||
if ((*cp >= '0') && (*cp <= '7'))
|
||||
increment = *cp++ - '0';
|
||||
} else if (base == 16) {
|
||||
if ((*cp >= '0') && (*cp <= '9'))
|
||||
increment = *cp++ - '0';
|
||||
else if ((*cp >= 'A') && (*cp <= 'F'))
|
||||
increment = *cp++ - ('A' - 10);
|
||||
else if ((*cp >= 'a') && (*cp <= 'f'))
|
||||
increment = *cp++ - ('a' - 10);
|
||||
} else { /* Decimal */
|
||||
if ((*cp >= '0') && (*cp <= '9'))
|
||||
increment = *cp++ - '0';
|
||||
}
|
||||
if (increment < 0)
|
||||
break;
|
||||
*valp = (*valp * base) + increment;
|
||||
}
|
||||
|
||||
/* Skip trailing qualifiers */
|
||||
while (*cp == 'U' || *cp == 'u' || *cp == 'L' || *cp == 'l') cp++;
|
||||
return cp;
|
||||
}
|
||||
|
||||
static const char *
|
||||
parse_character (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
char val;
|
||||
|
||||
SKIPSPACE (cp);
|
||||
if (*cp == '\\')
|
||||
switch (cp[1]) {
|
||||
case 'n': val = '\n'; break;
|
||||
case 't': val = '\t'; break;
|
||||
case 'v': val = '\v'; break;
|
||||
case 'b': val = '\b'; break;
|
||||
case 'r': val = '\r'; break;
|
||||
case 'f': val = '\f'; break;
|
||||
case 'a': val = '\a'; break;
|
||||
case '\\': val = '\\'; break;
|
||||
case '?': val = '\?'; break;
|
||||
case '\'': val = '\''; break;
|
||||
case '\"': val = '\"'; break;
|
||||
case 'x': val = (char) strtol (cp + 2, NULL, 16); break;
|
||||
default: val = (char) strtol (cp + 1, NULL, 8); break;
|
||||
}
|
||||
else
|
||||
val = *cp;
|
||||
while (*cp != '\'') cp++;
|
||||
*valp = (long) val;
|
||||
return cp;
|
||||
}
|
||||
|
||||
static const char *
|
||||
parse_value (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
const char *var, *varend;
|
||||
|
||||
*valp = 0;
|
||||
|
||||
SKIPSPACE (cp);
|
||||
if (!*cp)
|
||||
return cp;
|
||||
|
||||
switch (*cp) {
|
||||
case '(':
|
||||
DO (cp = ParseIfExpression (g, cp + 1, valp));
|
||||
SKIPSPACE (cp);
|
||||
if (*cp != ')')
|
||||
return CALLFUNC(g, handle_error) (g, cp, ")");
|
||||
|
||||
return cp + 1; /* skip the right paren */
|
||||
|
||||
case '!':
|
||||
DO (cp = parse_value (g, cp + 1, valp));
|
||||
*valp = !(*valp);
|
||||
return cp;
|
||||
|
||||
case '-':
|
||||
DO (cp = parse_value (g, cp + 1, valp));
|
||||
*valp = -(*valp);
|
||||
return cp;
|
||||
|
||||
case '+':
|
||||
DO (cp = parse_value (g, cp + 1, valp));
|
||||
return cp;
|
||||
|
||||
case '~':
|
||||
DO (cp = parse_value (g, cp + 1, valp));
|
||||
*valp = ~(*valp);
|
||||
return cp;
|
||||
|
||||
case '#':
|
||||
DO (cp = parse_variable (g, cp + 1, &var));
|
||||
SKIPSPACE (cp);
|
||||
if (*cp != '(')
|
||||
return CALLFUNC(g, handle_error) (g, cp, "(");
|
||||
do {
|
||||
DO (cp = parse_variable (g, cp + 1, &var));
|
||||
SKIPSPACE (cp);
|
||||
} while (*cp && *cp != ')');
|
||||
if (*cp != ')')
|
||||
return CALLFUNC(g, handle_error) (g, cp, ")");
|
||||
*valp = 1; /* XXX */
|
||||
return cp + 1;
|
||||
|
||||
case '\'':
|
||||
DO (cp = parse_character (g, cp + 1, valp));
|
||||
if (*cp != '\'')
|
||||
return CALLFUNC(g, handle_error) (g, cp, "'");
|
||||
return cp + 1;
|
||||
|
||||
case 'd':
|
||||
if (strncmp (cp, "defined", 7) == 0 && !isalnum(cp[7])) {
|
||||
int paren = 0;
|
||||
int len;
|
||||
|
||||
cp += 7;
|
||||
SKIPSPACE (cp);
|
||||
if (*cp == '(') {
|
||||
paren = 1;
|
||||
cp++;
|
||||
}
|
||||
DO (cp = parse_variable (g, cp, &var));
|
||||
len = cp - var;
|
||||
SKIPSPACE (cp);
|
||||
if (paren && *cp != ')')
|
||||
return CALLFUNC(g, handle_error) (g, cp, ")");
|
||||
*valp = (*(g->funcs.eval_defined)) (g, var, len);
|
||||
return cp + paren; /* skip the right paren */
|
||||
}
|
||||
/* fall out */
|
||||
}
|
||||
|
||||
if (isdigit(*cp)) {
|
||||
DO (cp = parse_number (g, cp, valp));
|
||||
} else if (!isvarfirstletter(*cp))
|
||||
return CALLFUNC(g, handle_error) (g, cp, "variable or number");
|
||||
else {
|
||||
DO (cp = parse_variable (g, cp, &var));
|
||||
varend = cp;
|
||||
SKIPSPACE(cp);
|
||||
if (*cp != '(') {
|
||||
*valp = (*(g->funcs.eval_variable)) (g, var, varend - var);
|
||||
} else {
|
||||
do {
|
||||
long dummy;
|
||||
DO (cp = ParseIfExpression (g, cp + 1, &dummy));
|
||||
SKIPSPACE(cp);
|
||||
if (*cp == ')')
|
||||
break;
|
||||
if (*cp != ',')
|
||||
return CALLFUNC(g, handle_error) (g, cp, ",");
|
||||
} while (1);
|
||||
|
||||
*valp = 1; /* XXX */
|
||||
cp++;
|
||||
}
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static const char *
|
||||
parse_product (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_value (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '*':
|
||||
DO (cp = parse_product (g, cp + 1, &rightval));
|
||||
*valp = (*valp * rightval);
|
||||
break;
|
||||
|
||||
case '/':
|
||||
DO (cp = parse_product (g, cp + 1, &rightval));
|
||||
if (rightval == 0)
|
||||
return CALLFUNC(g, handle_error) (g, cp, "0");
|
||||
*valp = (*valp / rightval);
|
||||
break;
|
||||
|
||||
case '%':
|
||||
DO (cp = parse_product (g, cp + 1, &rightval));
|
||||
*valp = (*valp % rightval);
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_sum (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_product (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '+':
|
||||
DO (cp = parse_sum (g, cp + 1, &rightval));
|
||||
*valp = (*valp + rightval);
|
||||
break;
|
||||
|
||||
case '-':
|
||||
DO (cp = parse_sum (g, cp + 1, &rightval));
|
||||
*valp = (*valp - rightval);
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_shift (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_sum (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '<':
|
||||
if (cp[1] == '<') {
|
||||
DO (cp = parse_shift (g, cp + 2, &rightval));
|
||||
*valp = (*valp << rightval);
|
||||
}
|
||||
break;
|
||||
|
||||
case '>':
|
||||
if (cp[1] == '>') {
|
||||
DO (cp = parse_shift (g, cp + 2, &rightval));
|
||||
*valp = (*valp >> rightval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_inequality (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_shift (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '<':
|
||||
if (cp[1] == '=') {
|
||||
DO (cp = parse_inequality (g, cp + 2, &rightval));
|
||||
*valp = (*valp <= rightval);
|
||||
} else {
|
||||
DO (cp = parse_inequality (g, cp + 1, &rightval));
|
||||
*valp = (*valp < rightval);
|
||||
}
|
||||
break;
|
||||
|
||||
case '>':
|
||||
if (cp[1] == '=') {
|
||||
DO (cp = parse_inequality (g, cp + 2, &rightval));
|
||||
*valp = (*valp >= rightval);
|
||||
} else {
|
||||
DO (cp = parse_inequality (g, cp + 1, &rightval));
|
||||
*valp = (*valp > rightval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_equality (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_inequality (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '=':
|
||||
if (cp[1] == '=')
|
||||
cp++;
|
||||
DO (cp = parse_equality (g, cp + 1, &rightval));
|
||||
*valp = (*valp == rightval);
|
||||
break;
|
||||
|
||||
case '!':
|
||||
if (cp[1] != '=')
|
||||
break;
|
||||
DO (cp = parse_equality (g, cp + 2, &rightval));
|
||||
*valp = (*valp != rightval);
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_band (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_equality (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '&':
|
||||
if (cp[1] != '&') {
|
||||
DO (cp = parse_band (g, cp + 1, &rightval));
|
||||
*valp = (*valp & rightval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_bxor (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_band (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '^':
|
||||
DO (cp = parse_bxor (g, cp + 1, &rightval));
|
||||
*valp = (*valp ^ rightval);
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_bor (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_bxor (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '|':
|
||||
if (cp[1] != '|') {
|
||||
DO (cp = parse_bor (g, cp + 1, &rightval));
|
||||
*valp = (*valp | rightval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_land (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_bor (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '&':
|
||||
if (cp[1] != '&')
|
||||
return CALLFUNC(g, handle_error) (g, cp, "&&");
|
||||
DO (cp = parse_land (g, cp + 2, &rightval));
|
||||
*valp = (*valp && rightval);
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_lor (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long rightval;
|
||||
|
||||
DO (cp = parse_land (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '|':
|
||||
if (cp[1] != '|')
|
||||
return CALLFUNC(g, handle_error) (g, cp, "||");
|
||||
DO (cp = parse_lor (g, cp + 2, &rightval));
|
||||
*valp = (*valp || rightval);
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
parse_cond(IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
long trueval, falseval;
|
||||
|
||||
DO (cp = parse_lor (g, cp, valp));
|
||||
SKIPSPACE (cp);
|
||||
|
||||
switch (*cp) {
|
||||
case '?':
|
||||
DO (cp = parse_cond (g, cp + 1, &trueval));
|
||||
SKIPSPACE (cp);
|
||||
if (*cp != ':')
|
||||
return CALLFUNC(g, handle_error) (g, cp, ":");
|
||||
DO (cp = parse_cond (g, cp + 1, &falseval));
|
||||
*valp = (*valp ? trueval : falseval);
|
||||
break;
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
External Entry Points
|
||||
****************************************************************************/
|
||||
|
||||
const char *
|
||||
ParseIfExpression (IfParser *g, const char *cp, long *valp)
|
||||
{
|
||||
return parse_cond (g, cp, valp);
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* $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.5 2001/07/25 15:04:40 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 *
|
||||
);
|
||||
|
||||
|
|
@ -1,782 +0,0 @@
|
|||
|
||||
/* $XConsortium: imakemdep.h,v 1.83 95/04/07 19:47:46 kaleb Exp $ */
|
||||
/* $XFree86: xc/config/imake/imakemdep.h,v 3.12 1995/07/08 10:22:17 dawes Exp $ */
|
||||
/*
|
||||
|
||||
Copyright (c) 1993, 1994 X Consortium
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
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
|
||||
X CONSORTIUM 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 X Consortium 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 X Consortium.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This file contains machine-dependent constants for the imake utility.
|
||||
* When porting imake, read each of the steps below and add in any necessary
|
||||
* definitions. In general you should *not* edit ccimake.c or imake.c!
|
||||
*/
|
||||
|
||||
#ifdef CCIMAKE
|
||||
/*
|
||||
* Step 1: imake_ccflags
|
||||
* Define any special flags that will be needed to get imake.c to compile.
|
||||
* These will be passed to the compile along with the contents of the
|
||||
* make variable BOOTSTRAPCFLAGS.
|
||||
*/
|
||||
#ifdef hpux
|
||||
#ifdef hp9000s800
|
||||
#define imake_ccflags "-DSYSV"
|
||||
#else
|
||||
#define imake_ccflags "-Wc,-Nd4000,-Ns3000 -DSYSV"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(macII) || defined(_AUX_SOURCE)
|
||||
#define imake_ccflags "-DmacII -DSYSV"
|
||||
#endif
|
||||
|
||||
#ifdef stellar
|
||||
#define imake_ccflags "-DSYSV"
|
||||
#endif
|
||||
|
||||
#if defined(USL) || defined(Oki) || defined(NCR)
|
||||
#define imake_ccflags "-Xc -DSVR4"
|
||||
#endif
|
||||
|
||||
#ifdef sony
|
||||
#if defined(SYSTYPE_SYSV) || defined(_SYSTYPE_SYSV)
|
||||
#define imake_ccflags "-DSVR4"
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
#if NEWSOS < 41
|
||||
#define imake_ccflags "-Dbsd43 -DNOSTDHDRS"
|
||||
#else
|
||||
#if NEWSOS < 42
|
||||
#define imake_ccflags "-Dbsd43"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _CRAY
|
||||
#define imake_ccflags "-DSYSV -DUSG"
|
||||
#endif
|
||||
|
||||
#if defined(_IBMR2) || defined(aix)
|
||||
#define imake_ccflags "-Daix -DSYSV"
|
||||
#endif
|
||||
|
||||
#ifdef Mips
|
||||
# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43)
|
||||
# define imake_ccflags "-DBSD43"
|
||||
# else
|
||||
# define imake_ccflags "-DSYSV"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef is68k
|
||||
#define imake_ccflags "-Dluna -Duniosb"
|
||||
#endif
|
||||
|
||||
#ifdef SYSV386
|
||||
# ifdef SVR4
|
||||
# define imake_ccflags "-Xc -DSVR4"
|
||||
# else
|
||||
# define imake_ccflags "-DSYSV"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef SVR4
|
||||
# ifdef i386
|
||||
# define imake_ccflags "-Xc -DSVR4"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef SYSV
|
||||
# ifdef i386
|
||||
# define imake_ccflags "-DSYSV"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __convex__
|
||||
#define imake_ccflags "-fn -tm c1"
|
||||
#endif
|
||||
|
||||
#ifdef apollo
|
||||
#define imake_ccflags "-DX_NOT_POSIX"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define imake_ccflags "-nologo -batch -D__STDC__"
|
||||
#endif
|
||||
|
||||
#ifdef __uxp__
|
||||
#define imake_ccflags "-DSVR4 -DANSICPP"
|
||||
#endif
|
||||
|
||||
#ifdef __sxg__
|
||||
#define imake_ccflags "-DSYSV -DUSG -DNOSTDHDRS"
|
||||
#endif
|
||||
|
||||
#ifdef sequent
|
||||
#define imake_ccflags "-DX_NOT_STDC_ENV -DX_NOT_POSIX"
|
||||
#endif
|
||||
|
||||
#ifdef _SEQUENT_
|
||||
#define imake_ccflags "-DSYSV -DUSG"
|
||||
#endif
|
||||
|
||||
#if defined(SX) || defined(PC_UX)
|
||||
#define imake_ccflags "-DSYSV"
|
||||
#endif
|
||||
|
||||
#ifdef nec_ews_svr2
|
||||
#define imake_ccflags "-DUSG"
|
||||
#endif
|
||||
|
||||
#if defined(nec_ews_svr4) || defined(_nec_ews_svr4) || defined(_nec_up) || defined(_nec_ft)
|
||||
#define imake_ccflags "-DSVR4"
|
||||
#endif
|
||||
|
||||
#ifdef MACH
|
||||
#define imake_ccflags "-DNOSTDHDRS"
|
||||
#endif
|
||||
|
||||
/* this is for OS/2 under EMX. This won't work with DOS */
|
||||
#if defined(__EMX__)
|
||||
#define imake_ccflags "-DBSD43"
|
||||
#endif
|
||||
|
||||
#else /* not CCIMAKE */
|
||||
#ifndef MAKEDEPEND
|
||||
/*
|
||||
* Step 2: dup2
|
||||
* If your OS doesn't have a dup2() system call to duplicate one file
|
||||
* descriptor onto another, define such a mechanism here (if you don't
|
||||
* already fall under the existing category(ies).
|
||||
*/
|
||||
#if defined(SYSV) && !defined(_CRAY) && !defined(Mips) && !defined(_SEQUENT_)
|
||||
#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : (close(fd2), \
|
||||
fcntl(fd1, F_DUPFD, fd2)))
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Step 3: FIXUP_CPP_WHITESPACE
|
||||
* If your cpp collapses tabs macro expansions into a single space and
|
||||
* replaces escaped newlines with a space, define this symbol. This will
|
||||
* cause imake to attempt to patch up the generated Makefile by looking
|
||||
* for lines that have colons in them (this is why the rules file escapes
|
||||
* all colons). One way to tell if you need this is to see whether or not
|
||||
* your Makefiles have no tabs in them and lots of @@ strings.
|
||||
*/
|
||||
#if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || (defined(AMOEBA) && defined(CROSS_COMPILE))
|
||||
#define FIXUP_CPP_WHITESPACE
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#define REMOVE_CPP_LEADSPACE
|
||||
#define INLINE_SYNTAX
|
||||
#define MAGIC_MAKE_VARS
|
||||
#endif
|
||||
#ifdef __minix_vmd
|
||||
#define FIXUP_CPP_WHITESPACE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Step 4: USE_CC_E, DEFAULT_CC, DEFAULT_CPP
|
||||
* If you want to use cc -E instead of cpp, define USE_CC_E.
|
||||
* If use cc -E but want a different compiler, define DEFAULT_CC.
|
||||
* If the cpp you need is not in /lib/cpp, define DEFAULT_CPP.
|
||||
*/
|
||||
#ifdef hpux
|
||||
#define USE_CC_E
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#define USE_CC_E
|
||||
#define DEFAULT_CC "cl"
|
||||
#endif
|
||||
#ifdef apollo
|
||||
#define DEFAULT_CPP "/usr/lib/cpp"
|
||||
#endif
|
||||
#if defined(_IBMR2) && !defined(DEFAULT_CPP)
|
||||
#define DEFAULT_CPP "/usr/lpp/X11/Xamples/util/cpp/cpp"
|
||||
#endif
|
||||
#if defined(sun) && defined(SVR4)
|
||||
#define DEFAULT_CPP "/usr/ccs/lib/cpp"
|
||||
#endif
|
||||
#ifdef __bsdi__
|
||||
#define DEFAULT_CPP "/usr/bin/cpp"
|
||||
#endif
|
||||
#ifdef __uxp__
|
||||
#define DEFAULT_CPP "/usr/ccs/lib/cpp"
|
||||
#endif
|
||||
#ifdef __sxg__
|
||||
#define DEFAULT_CPP "/usr/lib/cpp"
|
||||
#endif
|
||||
#ifdef _CRAY
|
||||
#define DEFAULT_CPP "/lib/pcpp"
|
||||
#endif
|
||||
#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#define DEFAULT_CPP "/usr/libexec/cpp"
|
||||
#endif
|
||||
#ifdef MACH
|
||||
#define USE_CC_E
|
||||
#endif
|
||||
#ifdef __minix_vmd
|
||||
#define DEFAULT_CPP "/usr/lib/cpp"
|
||||
#endif
|
||||
#if defined(__EMX__)
|
||||
/* expects cpp in PATH */
|
||||
#define DEFAULT_CPP "cpp"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Step 5: cpp_argv
|
||||
* The following table contains the flags that should be passed
|
||||
* whenever a Makefile is being generated. If your preprocessor
|
||||
* doesn't predefine any unique symbols, choose one and add it to the
|
||||
* end of this table. Then, do the following:
|
||||
*
|
||||
* a. Use this symbol in Imake.tmpl when setting MacroFile.
|
||||
* b. Put this symbol in the definition of BootstrapCFlags in your
|
||||
* <platform>.cf file.
|
||||
* c. When doing a make World, always add "BOOTSTRAPCFLAGS=-Dsymbol"
|
||||
* to the end of the command line.
|
||||
*
|
||||
* Note that you may define more than one symbol (useful for platforms
|
||||
* that support multiple operating systems).
|
||||
*/
|
||||
|
||||
#define ARGUMENTS 50 /* number of arguments in various arrays */
|
||||
char *cpp_argv[ARGUMENTS] = {
|
||||
"cc", /* replaced by the actual program to exec */
|
||||
"-I.", /* add current directory to include path */
|
||||
#ifdef unix
|
||||
"-Uunix", /* remove unix symbol so that filename unix.c okay */
|
||||
#endif
|
||||
#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(MACH)
|
||||
# ifdef __i386__
|
||||
"-D__i386__",
|
||||
# endif
|
||||
# ifdef __x86_64__
|
||||
"-D__x86_64__",
|
||||
# endif
|
||||
# ifdef __GNUC__
|
||||
"-traditional",
|
||||
# endif
|
||||
#endif
|
||||
#ifdef M4330
|
||||
"-DM4330", /* Tektronix */
|
||||
#endif
|
||||
#ifdef M4310
|
||||
"-DM4310", /* Tektronix */
|
||||
#endif
|
||||
#if defined(macII) || defined(_AUX_SOURCE)
|
||||
"-DmacII", /* Apple A/UX */
|
||||
#endif
|
||||
#ifdef USL
|
||||
"-DUSL", /* USL */
|
||||
#endif
|
||||
#ifdef sony
|
||||
"-Dsony", /* Sony */
|
||||
#if !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV) && NEWSOS < 42
|
||||
"-Dbsd43",
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _IBMR2
|
||||
"-D_IBMR2", /* IBM RS-6000 (we ensured that aix is defined above */
|
||||
#ifndef aix
|
||||
#define aix /* allow BOOTSTRAPCFLAGS="-D_IBMR2" */
|
||||
#endif
|
||||
#endif /* _IBMR2 */
|
||||
#ifdef aix
|
||||
"-Daix", /* AIX instead of AOS */
|
||||
#ifndef ibm
|
||||
#define ibm /* allow BOOTSTRAPCFLAGS="-Daix" */
|
||||
#endif
|
||||
#endif /* aix */
|
||||
#ifdef ibm
|
||||
"-Dibm", /* IBM PS/2 and RT under both AOS and AIX */
|
||||
#endif
|
||||
#ifdef luna
|
||||
"-Dluna", /* OMRON luna 68K and 88K */
|
||||
#ifdef luna1
|
||||
"-Dluna1",
|
||||
#endif
|
||||
#ifdef luna88k /* need not on UniOS-Mach Vers. 1.13 */
|
||||
"-traditional", /* for some older version */
|
||||
#endif /* instead of "-DXCOMM=\\#" */
|
||||
#ifdef uniosb
|
||||
"-Duniosb",
|
||||
#endif
|
||||
#ifdef uniosu
|
||||
"-Duniosu",
|
||||
#endif
|
||||
#endif /* luna */
|
||||
#ifdef _CRAY /* Cray */
|
||||
"-Ucray",
|
||||
#endif
|
||||
#ifdef Mips
|
||||
"-DMips", /* Define and use Mips for Mips Co. OS/mach. */
|
||||
# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43)
|
||||
"-DBSD43", /* Mips RISCOS supports two environments */
|
||||
# else
|
||||
"-DSYSV", /* System V environment is the default */
|
||||
# endif
|
||||
#endif /* Mips */
|
||||
#ifdef MOTOROLA
|
||||
"-DMOTOROLA", /* Motorola Delta Systems */
|
||||
# ifdef SYSV
|
||||
"-DSYSV",
|
||||
# endif
|
||||
# ifdef SVR4
|
||||
"-DSVR4",
|
||||
# endif
|
||||
#endif /* MOTOROLA */
|
||||
#ifdef i386
|
||||
"-Di386",
|
||||
# ifdef SVR4
|
||||
"-DSVR4",
|
||||
# endif
|
||||
# ifdef SYSV
|
||||
"-DSYSV",
|
||||
# ifdef ISC
|
||||
"-DISC",
|
||||
# ifdef ISC40
|
||||
"-DISC40", /* ISC 4.0 */
|
||||
# else
|
||||
# ifdef ISC202
|
||||
"-DISC202", /* ISC 2.0.2 */
|
||||
# else
|
||||
# ifdef ISC30
|
||||
"-DISC30", /* ISC 3.0 */
|
||||
# else
|
||||
"-DISC22", /* ISC 2.2.1 */
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# ifdef SCO
|
||||
"-DSCO",
|
||||
# ifdef SCO324
|
||||
"-DSCO324",
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# ifdef ESIX
|
||||
"-DESIX",
|
||||
# endif
|
||||
# ifdef ATT
|
||||
"-DATT",
|
||||
# endif
|
||||
# ifdef DELL
|
||||
"-DDELL",
|
||||
# endif
|
||||
#endif
|
||||
#ifdef SYSV386 /* System V/386 folks, obsolete */
|
||||
"-Di386",
|
||||
# ifdef SVR4
|
||||
"-DSVR4",
|
||||
# endif
|
||||
# ifdef ISC
|
||||
"-DISC",
|
||||
# ifdef ISC40
|
||||
"-DISC40", /* ISC 4.0 */
|
||||
# else
|
||||
# ifdef ISC202
|
||||
"-DISC202", /* ISC 2.0.2 */
|
||||
# else
|
||||
# ifdef ISC30
|
||||
"-DISC30", /* ISC 3.0 */
|
||||
# else
|
||||
"-DISC22", /* ISC 2.2.1 */
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# ifdef SCO
|
||||
"-DSCO",
|
||||
# ifdef SCO324
|
||||
"-DSCO324",
|
||||
# endif
|
||||
# endif
|
||||
# ifdef ESIX
|
||||
"-DESIX",
|
||||
# endif
|
||||
# ifdef ATT
|
||||
"-DATT",
|
||||
# endif
|
||||
# ifdef DELL
|
||||
"-DDELL",
|
||||
# endif
|
||||
#endif
|
||||
#ifdef __osf__
|
||||
"-D__osf__",
|
||||
# ifdef __mips__
|
||||
"-D__mips__",
|
||||
# endif
|
||||
# ifdef __alpha
|
||||
"-D__alpha",
|
||||
# endif
|
||||
# ifdef __i386__
|
||||
"-D__i386__",
|
||||
# endif
|
||||
# ifdef __GNUC__
|
||||
"-traditional",
|
||||
# endif
|
||||
#endif
|
||||
#ifdef Oki
|
||||
"-DOki",
|
||||
#endif
|
||||
#ifdef sun
|
||||
#ifdef SVR4
|
||||
"-DSVR4",
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
"-DWIN32",
|
||||
"-nologo",
|
||||
"-batch",
|
||||
"-D__STDC__",
|
||||
#endif
|
||||
#ifdef NCR
|
||||
"-DNCR", /* NCR */
|
||||
#endif
|
||||
#ifdef linux
|
||||
"-traditional",
|
||||
"-Dlinux",
|
||||
#endif
|
||||
#ifdef __uxp__
|
||||
"-D__uxp__",
|
||||
#endif
|
||||
#ifdef __sxg__
|
||||
"-D__sxg__",
|
||||
#endif
|
||||
#ifdef nec_ews_svr2
|
||||
"-Dnec_ews_svr2",
|
||||
#endif
|
||||
#ifdef AMOEBA
|
||||
"-DAMOEBA",
|
||||
# ifdef CROSS_COMPILE
|
||||
"-DCROSS_COMPILE",
|
||||
# ifdef CROSS_i80386
|
||||
"-Di80386",
|
||||
# endif
|
||||
# ifdef CROSS_sparc
|
||||
"-Dsparc",
|
||||
# endif
|
||||
# ifdef CROSS_mc68000
|
||||
"-Dmc68000",
|
||||
# endif
|
||||
# else
|
||||
# ifdef i80386
|
||||
"-Di80386",
|
||||
# endif
|
||||
# ifdef sparc
|
||||
"-Dsparc",
|
||||
# endif
|
||||
# ifdef mc68000
|
||||
"-Dmc68000",
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#ifdef __minix_vmd
|
||||
"-Dminix",
|
||||
#endif
|
||||
|
||||
#if defined(__EMX__)
|
||||
"-traditional",
|
||||
"-Demxos2",
|
||||
#endif
|
||||
|
||||
};
|
||||
#else /* else MAKEDEPEND */
|
||||
/*
|
||||
* Step 6: predefs
|
||||
* If your compiler and/or preprocessor define any specific symbols, add
|
||||
* them to the the following table. The definition of struct symtab is
|
||||
* in util/makedepend/def.h.
|
||||
*/
|
||||
#define QUOTEIT(x) #x
|
||||
#define QUOTEEXPANSION(x) QUOTEIT(x)
|
||||
|
||||
struct symtab predefs[] = {
|
||||
#ifdef apollo
|
||||
{"apollo", "1"},
|
||||
#endif
|
||||
#ifdef ibm032
|
||||
{"ibm032", "1"},
|
||||
#endif
|
||||
#ifdef ibm
|
||||
{"ibm", "1"},
|
||||
#endif
|
||||
#ifdef aix
|
||||
{"aix", "1"},
|
||||
#endif
|
||||
#ifdef sun
|
||||
{"sun", "1"},
|
||||
#endif
|
||||
#ifdef sun2
|
||||
{"sun2", "1"},
|
||||
#endif
|
||||
#ifdef sun3
|
||||
{"sun3", "1"},
|
||||
#endif
|
||||
#ifdef sun4
|
||||
{"sun4", "1"},
|
||||
#endif
|
||||
#ifdef sparc
|
||||
{"sparc", "1"},
|
||||
#endif
|
||||
#ifdef __sparc__
|
||||
{"__sparc__", "1"},
|
||||
#endif
|
||||
#ifdef hpux
|
||||
{"hpux", "1"},
|
||||
#endif
|
||||
#ifdef __hpux
|
||||
{"__hpux", "1"},
|
||||
#endif
|
||||
#ifdef __hp9000s800
|
||||
{"__hp9000s800", "1"},
|
||||
#endif
|
||||
#ifdef __hp9000s700
|
||||
{"__hp9000s700", "1"},
|
||||
#endif
|
||||
#ifdef vax
|
||||
{"vax", "1"},
|
||||
#endif
|
||||
#ifdef VMS
|
||||
{"VMS", "1"},
|
||||
#endif
|
||||
#ifdef cray
|
||||
{"cray", "1"},
|
||||
#endif
|
||||
#ifdef CRAY
|
||||
{"CRAY", "1"},
|
||||
#endif
|
||||
#ifdef _CRAY
|
||||
{"_CRAY", "1"},
|
||||
#endif
|
||||
#ifdef att
|
||||
{"att", "1"},
|
||||
#endif
|
||||
#ifdef mips
|
||||
{"mips", "1"},
|
||||
#endif
|
||||
#ifdef __mips__
|
||||
{"__mips__", "1"},
|
||||
#endif
|
||||
#ifdef ultrix
|
||||
{"ultrix", "1"},
|
||||
#endif
|
||||
#ifdef stellar
|
||||
{"stellar", "1"},
|
||||
#endif
|
||||
#ifdef mc68000
|
||||
{"mc68000", "1"},
|
||||
#endif
|
||||
#ifdef mc68020
|
||||
{"mc68020", "1"},
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
{"__GNUC__", "1"},
|
||||
#endif
|
||||
#if __STDC__
|
||||
{"__STDC__", "1"},
|
||||
#endif
|
||||
#ifdef __HIGHC__
|
||||
{"__HIGHC__", "1"},
|
||||
#endif
|
||||
#ifdef CMU
|
||||
{"CMU", "1"},
|
||||
#endif
|
||||
#ifdef luna
|
||||
{"luna", "1"},
|
||||
#ifdef luna1
|
||||
{"luna1", "1"},
|
||||
#endif
|
||||
#ifdef luna2
|
||||
{"luna2", "1"},
|
||||
#endif
|
||||
#ifdef luna88k
|
||||
{"luna88k", "1"},
|
||||
#endif
|
||||
#ifdef uniosb
|
||||
{"uniosb", "1"},
|
||||
#endif
|
||||
#ifdef uniosu
|
||||
{"uniosu", "1"},
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ieeep754
|
||||
{"ieeep754", "1"},
|
||||
#endif
|
||||
#ifdef is68k
|
||||
{"is68k", "1"},
|
||||
#endif
|
||||
#ifdef m68k
|
||||
{"m68k", "1"},
|
||||
#endif
|
||||
#ifdef m88k
|
||||
{"m88k", "1"},
|
||||
#endif
|
||||
#ifdef __m88k__
|
||||
{"__m88k__", "1"},
|
||||
#endif
|
||||
#ifdef bsd43
|
||||
{"bsd43", "1"},
|
||||
#endif
|
||||
#ifdef hcx
|
||||
{"hcx", "1"},
|
||||
#endif
|
||||
#ifdef sony
|
||||
{"sony", "1"},
|
||||
#ifdef SYSTYPE_SYSV
|
||||
{"SYSTYPE_SYSV", "1"},
|
||||
#endif
|
||||
#ifdef _SYSTYPE_SYSV
|
||||
{"_SYSTYPE_SYSV", "1"},
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __OSF__
|
||||
{"__OSF__", "1"},
|
||||
#endif
|
||||
#ifdef __osf__
|
||||
{"__osf__", "1"},
|
||||
#endif
|
||||
#ifdef __alpha
|
||||
{"__alpha", "1"},
|
||||
#endif
|
||||
#ifdef __DECC
|
||||
{"__DECC", "1"},
|
||||
#endif
|
||||
#ifdef __decc
|
||||
{"__decc", "1"},
|
||||
#endif
|
||||
#ifdef __uxp__
|
||||
{"__uxp__", "1"},
|
||||
#endif
|
||||
#ifdef __sxg__
|
||||
{"__sxg__", "1"},
|
||||
#endif
|
||||
#ifdef _SEQUENT_
|
||||
{"_SEQUENT_", "1"},
|
||||
{"__STDC__", "1"},
|
||||
#endif
|
||||
#ifdef __bsdi__
|
||||
{"__bsdi__", "1"},
|
||||
#endif
|
||||
#ifdef nec_ews_svr2
|
||||
{"nec_ews_svr2", "1"},
|
||||
#endif
|
||||
#ifdef nec_ews_svr4
|
||||
{"nec_ews_svr4", "1"},
|
||||
#endif
|
||||
#ifdef _nec_ews_svr4
|
||||
{"_nec_ews_svr4", "1"},
|
||||
#endif
|
||||
#ifdef _nec_up
|
||||
{"_nec_up", "1"},
|
||||
#endif
|
||||
#ifdef SX
|
||||
{"SX", "1"},
|
||||
#endif
|
||||
#ifdef nec
|
||||
{"nec", "1"},
|
||||
#endif
|
||||
#ifdef _nec_ft
|
||||
{"_nec_ft", "1"},
|
||||
#endif
|
||||
#ifdef PC_UX
|
||||
{"PC_UX", "1"},
|
||||
#endif
|
||||
#ifdef sgi
|
||||
{"sgi", "1"},
|
||||
#endif
|
||||
#ifdef __sgi
|
||||
{"__sgi", "1"},
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
{"__FreeBSD__", "1"},
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
{"__NetBSD__", "1"},
|
||||
#endif
|
||||
#ifdef __OpenBSD__
|
||||
{"__OpenBSD__", "1"},
|
||||
#endif
|
||||
#ifdef __EMX__
|
||||
{"__EMX__", "1"},
|
||||
#endif
|
||||
/* ADDED THE FOLLOWING SYMBOLS FOR WINDOWS */
|
||||
#ifdef _WIN32
|
||||
{"_WIN32", QUOTEEXPANSION(_WIN32) },
|
||||
#endif
|
||||
#ifdef _WIN64
|
||||
{"_WIN64", QUOTEEXPANSION(_WIN64) },
|
||||
#endif
|
||||
#ifdef _X86
|
||||
{"_X86", QUOTEEXPANSION(_X86) },
|
||||
#endif
|
||||
#ifdef _X86_
|
||||
{"_X86_", QUOTEEXPANSION(_X86_) },
|
||||
#endif
|
||||
#ifdef _X86_64
|
||||
{"_X86_64", QUOTEEXPANSION(_X86_64) },
|
||||
#endif
|
||||
#ifdef _X86_64_
|
||||
{"_X86_64_", QUOTEEXPANSION(_X86_64_) },
|
||||
#endif
|
||||
#ifdef _DEBUG
|
||||
{"_DEBUG", QUOTEEXPANSION(_DEBUG) },
|
||||
#endif
|
||||
#ifdef _DLL
|
||||
{"_DLL", QUOTEEXPANSION(_DLL) },
|
||||
#endif
|
||||
#ifdef _M_IX86
|
||||
{"_M_IX86", QUOTEEXPANSION(_M_IX86) },
|
||||
#endif
|
||||
#ifdef _M_X64
|
||||
{"_M_X64", QUOTEEXPANSION(_M_X64) },
|
||||
#endif
|
||||
#ifdef _MSC_FULL_VER
|
||||
{"_MSC_FULL_VER", QUOTEEXPANSION(_MSC_FULL_VER) },
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
{"_MSC_VER", QUOTEEXPANSION(_MSC_VER) },
|
||||
#endif
|
||||
#ifdef _MSVC_RUNTIME_CHECKS
|
||||
{"_MSVC_RUNTIME_CHECKS", QUOTEEXPANSION(_MSVC_RUNTIME_CHECKS) },
|
||||
#endif
|
||||
#ifdef _MT
|
||||
{"_MT", QUOTEEXPANSION(_MT) },
|
||||
#endif
|
||||
#ifdef _CHAR_UNSIGNED
|
||||
{"_CHAR_UNSIGNED", QUOTEEXPANSION(_CHAR_UNSIGNED) },
|
||||
#endif
|
||||
/* add any additional symbols before this line */
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
#endif /* MAKEDEPEND */
|
||||
#endif /* CCIMAKE */
|
||||
|
|
@ -1,337 +0,0 @@
|
|||
/* $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.7 2001/12/14 19:53:20 dawes Exp $ */
|
||||
|
||||
|
||||
#include "def.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <windows.h>
|
||||
static int
|
||||
does_file_exist(char *file)
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA data;
|
||||
BOOL b = GetFileAttributesExA(file, GetFileExInfoStandard, &data);
|
||||
if (!b)
|
||||
return 0;
|
||||
return (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0;
|
||||
}
|
||||
#else
|
||||
static int
|
||||
does_file_exist(char *file)
|
||||
{
|
||||
struct stat sb;
|
||||
return stat(file, &sb) == 0 && !S_ISDIR(sb.st_mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
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 >= ¬dotdot[ 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;
|
||||
|
||||
/*
|
||||
* 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 (does_file_exist(include))
|
||||
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 (does_file_exist(path))
|
||||
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 (does_file_exist(path)) {
|
||||
includedirsnext = pp + 1;
|
||||
return newinclude(path, include);
|
||||
}
|
||||
if (show_where_not)
|
||||
warning1("\tnot in %s\n", path);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1,870 +0,0 @@
|
|||
/* $Xorg: main.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
|
||||
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/main.c,v 3.32 2003/03/26 20:43:48 tsi Exp $ */
|
||||
|
||||
#include "def.h"
|
||||
#ifdef hpux
|
||||
#define sigvec sigvector
|
||||
#endif /* hpux */
|
||||
|
||||
#ifdef X_POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
|
||||
#include <signal.h>
|
||||
#undef _POSIX_C_SOURCE
|
||||
#else
|
||||
#if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE)
|
||||
#include <signal.h>
|
||||
#else
|
||||
#define _POSIX_SOURCE
|
||||
#include <signal.h>
|
||||
#undef _POSIX_SOURCE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#ifdef MINIX
|
||||
#define USE_CHMOD 1
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
int _debugmask;
|
||||
#endif
|
||||
|
||||
/* #define DEBUG_DUMP */
|
||||
#ifdef DEBUG_DUMP
|
||||
#define DBG_PRINT(file, fmt, args) fprintf(file, fmt, args)
|
||||
#else
|
||||
#define DBG_PRINT(file, fmt, args) /* empty */
|
||||
#endif
|
||||
|
||||
#define DASH_INC_PRE "#include \""
|
||||
#define DASH_INC_POST "\""
|
||||
|
||||
char *ProgramName;
|
||||
|
||||
char *directives[] = {
|
||||
"if",
|
||||
"ifdef",
|
||||
"ifndef",
|
||||
"else",
|
||||
"endif",
|
||||
"define",
|
||||
"undef",
|
||||
"include",
|
||||
"line",
|
||||
"pragma",
|
||||
"error",
|
||||
"ident",
|
||||
"sccs",
|
||||
"elif",
|
||||
"eject",
|
||||
"warning",
|
||||
"include_next",
|
||||
NULL
|
||||
};
|
||||
|
||||
#define MAKEDEPEND
|
||||
#include "imakemdep.h" /* from config sources */
|
||||
#undef MAKEDEPEND
|
||||
|
||||
struct inclist inclist[ MAXFILES ],
|
||||
*inclistp = inclist,
|
||||
*inclistnext = inclist,
|
||||
maininclist;
|
||||
|
||||
static char *filelist[ MAXFILES ];
|
||||
char *includedirs[ MAXDIRS + 1 ],
|
||||
**includedirsnext = includedirs;
|
||||
char *notdotdot[ MAXDIRS ];
|
||||
static int cmdinc_count = 0;
|
||||
static char *cmdinc_list[ 2 * MAXINCFILES ];
|
||||
char *objprefix = "";
|
||||
char *objsuffix = OBJSUFFIX;
|
||||
static char *startat = "# DO NOT DELETE";
|
||||
int width = 78;
|
||||
static boolean append = FALSE;
|
||||
boolean printed = FALSE;
|
||||
boolean verbose = FALSE;
|
||||
boolean show_where_not = FALSE;
|
||||
/* Warn on multiple includes of same file */
|
||||
boolean warn_multiple = FALSE;
|
||||
|
||||
static void setfile_cmdinc(struct filepointer *filep, long count, char **list);
|
||||
static void redirect(char *line, char *makefile);
|
||||
|
||||
static
|
||||
#ifdef SIGNALRETURNSINT
|
||||
int
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
catch (int sig)
|
||||
{
|
||||
fflush (stdout);
|
||||
fatalerr ("got signal %d\n", sig);
|
||||
}
|
||||
|
||||
#if defined(USG) || (defined(i386) && defined(SYSV)) || defined(WIN32) || defined(__UNIXOS2__) || defined(Lynx_22) || defined(__CYGWIN__)
|
||||
#define USGISH
|
||||
#endif
|
||||
|
||||
#ifndef USGISH
|
||||
#ifdef X_NOT_POSIX
|
||||
#define sigaction sigvec
|
||||
#define sa_handler sv_handler
|
||||
#define sa_mask sv_mask
|
||||
#define sa_flags sv_flags
|
||||
#endif
|
||||
struct sigaction sig_act;
|
||||
#endif /* USGISH */
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char **fp = filelist;
|
||||
char **incp = includedirs;
|
||||
char *p;
|
||||
struct inclist *ip;
|
||||
char *makefile = NULL;
|
||||
struct filepointer *filecontent;
|
||||
struct symtab *psymp = predefs;
|
||||
char *endmarker = NULL;
|
||||
char *defincdir = NULL;
|
||||
char **undeflist = NULL;
|
||||
int numundefs = 0, i;
|
||||
register char offset;
|
||||
|
||||
ProgramName = argv[0];
|
||||
|
||||
while (psymp->s_name)
|
||||
{
|
||||
define2(psymp->s_name, psymp->s_value, &maininclist);
|
||||
psymp++;
|
||||
}
|
||||
if (argc == 2 && argv[1][0] == '@') {
|
||||
struct stat ast;
|
||||
int afd;
|
||||
char *args;
|
||||
char **nargv;
|
||||
int nargc;
|
||||
char quotechar = '\0';
|
||||
|
||||
nargc = 1;
|
||||
if ((afd = open(argv[1]+1, O_RDONLY)) < 0)
|
||||
fatalerr("cannot open \"%s\"\n", argv[1]+1);
|
||||
fstat(afd, &ast);
|
||||
args = (char *)malloc(ast.st_size + 1);
|
||||
if ((ast.st_size = read(afd, args, ast.st_size)) < 0)
|
||||
fatalerr("failed to read %s\n", argv[1]+1);
|
||||
args[ast.st_size] = '\0';
|
||||
close(afd);
|
||||
for (p = args; *p; p++) {
|
||||
if (quotechar) {
|
||||
if (quotechar == '\\' ||
|
||||
(*p == quotechar && p[-1] != '\\'))
|
||||
quotechar = '\0';
|
||||
continue;
|
||||
}
|
||||
switch (*p) {
|
||||
case '\\':
|
||||
case '"':
|
||||
case '\'':
|
||||
quotechar = *p;
|
||||
break;
|
||||
case ' ':
|
||||
case '\n':
|
||||
*p = '\0';
|
||||
if (p > args && p[-1])
|
||||
nargc++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (p[-1])
|
||||
nargc++;
|
||||
nargv = (char **)malloc(nargc * sizeof(char *));
|
||||
nargv[0] = argv[0];
|
||||
argc = 1;
|
||||
for (p = args; argc < nargc; p += strlen(p) + 1)
|
||||
if (*p) nargv[argc++] = p;
|
||||
argv = nargv;
|
||||
}
|
||||
for(argc--, argv++; argc; argc--, argv++) {
|
||||
/* if looking for endmarker then check before parsing */
|
||||
if (endmarker && strcmp (endmarker, *argv) == 0) {
|
||||
endmarker = NULL;
|
||||
continue;
|
||||
}
|
||||
if (**argv != '-') {
|
||||
/* treat +thing as an option for C++ */
|
||||
if (endmarker && **argv == '+')
|
||||
continue;
|
||||
*fp++ = argv[0];
|
||||
continue;
|
||||
}
|
||||
switch(argv[0][1]) {
|
||||
case '-':
|
||||
endmarker = &argv[0][2];
|
||||
if (endmarker[0] == '\0') endmarker = "--";
|
||||
break;
|
||||
case 'D':
|
||||
offset = 2;
|
||||
if (argv[0][2] == '\0') {
|
||||
argv++;
|
||||
argc--;
|
||||
offset = 0;
|
||||
}
|
||||
/* offset +1 here since first def letter
|
||||
* cannot be `=`
|
||||
*/
|
||||
for (p = argv[0] + offset + 1; *p; p++)
|
||||
if (*p == '=') {
|
||||
*p = ' ';
|
||||
break;
|
||||
}
|
||||
define(argv[0] + offset, &maininclist);
|
||||
break;
|
||||
case 'I':
|
||||
if (incp >= includedirs + MAXDIRS)
|
||||
fatalerr("Too many -I flags.\n");
|
||||
*incp++ = argv[0]+2;
|
||||
if (**(incp-1) == '\0') {
|
||||
*(incp-1) = *(++argv);
|
||||
argc--;
|
||||
}
|
||||
break;
|
||||
case 'U':
|
||||
/* Undef's override all -D's so save them up */
|
||||
numundefs++;
|
||||
if (numundefs == 1)
|
||||
undeflist = malloc(sizeof(char *));
|
||||
else
|
||||
undeflist = realloc(undeflist,
|
||||
numundefs * sizeof(char *));
|
||||
offset = 2;
|
||||
if (argv[0][2] == '\0') {
|
||||
argv++;
|
||||
argc--;
|
||||
offset = 0;
|
||||
}
|
||||
undeflist[numundefs - 1] = argv[0] + offset;
|
||||
break;
|
||||
case 'Y':
|
||||
defincdir = argv[0]+2;
|
||||
break;
|
||||
/* do not use if endmarker processing */
|
||||
case 'a':
|
||||
if (endmarker) break;
|
||||
append = TRUE;
|
||||
break;
|
||||
case 'w':
|
||||
if (endmarker) break;
|
||||
if (argv[0][2] == '\0') {
|
||||
argv++;
|
||||
argc--;
|
||||
width = atoi(argv[0]);
|
||||
} else
|
||||
width = atoi(argv[0]+2);
|
||||
break;
|
||||
case 'o':
|
||||
if (endmarker) break;
|
||||
if (argv[0][2] == '\0') {
|
||||
argv++;
|
||||
argc--;
|
||||
objsuffix = argv[0];
|
||||
} else
|
||||
objsuffix = argv[0]+2;
|
||||
break;
|
||||
case 'p':
|
||||
if (endmarker) break;
|
||||
if (argv[0][2] == '\0') {
|
||||
argv++;
|
||||
argc--;
|
||||
objprefix = argv[0];
|
||||
} else
|
||||
objprefix = argv[0]+2;
|
||||
break;
|
||||
case 'v':
|
||||
if (endmarker) break;
|
||||
verbose = TRUE;
|
||||
#ifdef DEBUG
|
||||
if (argv[0][2])
|
||||
_debugmask = atoi(argv[0]+2);
|
||||
#endif
|
||||
break;
|
||||
case 's':
|
||||
if (endmarker) break;
|
||||
startat = argv[0]+2;
|
||||
if (*startat == '\0') {
|
||||
startat = *(++argv);
|
||||
argc--;
|
||||
}
|
||||
if (*startat != '#')
|
||||
fatalerr("-s flag's value should start %s\n",
|
||||
"with '#'.");
|
||||
break;
|
||||
case 'f':
|
||||
if (endmarker) break;
|
||||
makefile = argv[0]+2;
|
||||
if (*makefile == '\0') {
|
||||
makefile = *(++argv);
|
||||
argc--;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
warn_multiple = TRUE;
|
||||
break;
|
||||
|
||||
/* Ignore -O, -g so we can just pass ${CFLAGS} to
|
||||
makedepend
|
||||
*/
|
||||
case 'O':
|
||||
case 'g':
|
||||
break;
|
||||
case 'i':
|
||||
if (strcmp(&argv[0][1],"include") == 0) {
|
||||
char *buf;
|
||||
if (argc<2)
|
||||
fatalerr("option -include is a "
|
||||
"missing its parameter\n");
|
||||
if (cmdinc_count >= MAXINCFILES)
|
||||
fatalerr("Too many -include flags.\n");
|
||||
argc--;
|
||||
argv++;
|
||||
buf = malloc(strlen(DASH_INC_PRE) +
|
||||
strlen(argv[0]) +
|
||||
strlen(DASH_INC_POST) + 1);
|
||||
if(!buf)
|
||||
fatalerr("out of memory at "
|
||||
"-include string\n");
|
||||
cmdinc_list[2 * cmdinc_count + 0] = argv[0];
|
||||
cmdinc_list[2 * cmdinc_count + 1] = buf;
|
||||
cmdinc_count++;
|
||||
break;
|
||||
}
|
||||
/* intentional fall through */
|
||||
default:
|
||||
if (endmarker) break;
|
||||
/* fatalerr("unknown opt = %s\n", argv[0]); */
|
||||
warning("ignoring option %s\n", argv[0]);
|
||||
}
|
||||
}
|
||||
/* Now do the undefs from the command line */
|
||||
for (i = 0; i < numundefs; i++)
|
||||
undefine(undeflist[i], &maininclist);
|
||||
if (numundefs > 0)
|
||||
free(undeflist);
|
||||
|
||||
if (!defincdir) {
|
||||
#ifdef PREINCDIR
|
||||
if (incp >= includedirs + MAXDIRS)
|
||||
fatalerr("Too many -I flags.\n");
|
||||
*incp++ = PREINCDIR;
|
||||
#endif
|
||||
#if defined(__UNIXOS2__) || defined(_MSC_VER)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
char *includepath = getenv("INCLUDE");
|
||||
#else
|
||||
char *includepath = getenv("C_INCLUDE_PATH");
|
||||
#endif
|
||||
/* can have more than one component */
|
||||
if (includepath) {
|
||||
char *beg, *end;
|
||||
beg= (char*)strdup(includepath);
|
||||
for (;;) {
|
||||
end = (char*)strchr(beg,';');
|
||||
if (end) *end = 0;
|
||||
if (incp >= includedirs + MAXDIRS)
|
||||
fatalerr("Too many include dirs\n");
|
||||
*incp++ = beg;
|
||||
if (!end) break;
|
||||
beg = end+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else /* !__UNIXOS2__ && !_MSC_VER, does not use INCLUDEDIR at all */
|
||||
if (incp >= includedirs + MAXDIRS)
|
||||
fatalerr("Too many -I flags.\n");
|
||||
*incp++ = INCLUDEDIR;
|
||||
#endif
|
||||
|
||||
#ifdef EXTRAINCDIR
|
||||
if (incp >= includedirs + MAXDIRS)
|
||||
fatalerr("Too many -I flags.\n");
|
||||
*incp++ = EXTRAINCDIR;
|
||||
#endif
|
||||
|
||||
#ifdef POSTINCDIR
|
||||
if (incp >= includedirs + MAXDIRS)
|
||||
fatalerr("Too many -I flags.\n");
|
||||
*incp++ = POSTINCDIR;
|
||||
#endif
|
||||
} else if (*defincdir) {
|
||||
if (incp >= includedirs + MAXDIRS)
|
||||
fatalerr("Too many -I flags.\n");
|
||||
*incp++ = defincdir;
|
||||
}
|
||||
|
||||
redirect(startat, makefile);
|
||||
|
||||
/*
|
||||
* catch signals.
|
||||
*/
|
||||
#ifdef USGISH
|
||||
/* should really reset SIGINT to SIG_IGN if it was. */
|
||||
#ifdef SIGHUP
|
||||
signal (SIGHUP, catch);
|
||||
#endif
|
||||
signal (SIGINT, catch);
|
||||
#ifdef SIGQUIT
|
||||
signal (SIGQUIT, catch);
|
||||
#endif
|
||||
signal (SIGILL, catch);
|
||||
#ifdef SIGBUS
|
||||
signal (SIGBUS, catch);
|
||||
#endif
|
||||
signal (SIGSEGV, catch);
|
||||
#ifdef SIGSYS
|
||||
signal (SIGSYS, catch);
|
||||
#endif
|
||||
#else
|
||||
sig_act.sa_handler = catch;
|
||||
#if defined(_POSIX_SOURCE) || !defined(X_NOT_POSIX)
|
||||
sigemptyset(&sig_act.sa_mask);
|
||||
sigaddset(&sig_act.sa_mask, SIGINT);
|
||||
sigaddset(&sig_act.sa_mask, SIGQUIT);
|
||||
#ifdef SIGBUS
|
||||
sigaddset(&sig_act.sa_mask, SIGBUS);
|
||||
#endif
|
||||
sigaddset(&sig_act.sa_mask, SIGILL);
|
||||
sigaddset(&sig_act.sa_mask, SIGSEGV);
|
||||
sigaddset(&sig_act.sa_mask, SIGHUP);
|
||||
sigaddset(&sig_act.sa_mask, SIGPIPE);
|
||||
#ifdef SIGSYS
|
||||
sigaddset(&sig_act.sa_mask, SIGSYS);
|
||||
#endif
|
||||
#else
|
||||
sig_act.sa_mask = ((1<<(SIGINT -1))
|
||||
|(1<<(SIGQUIT-1))
|
||||
#ifdef SIGBUS
|
||||
|(1<<(SIGBUS-1))
|
||||
#endif
|
||||
|(1<<(SIGILL-1))
|
||||
|(1<<(SIGSEGV-1))
|
||||
|(1<<(SIGHUP-1))
|
||||
|(1<<(SIGPIPE-1))
|
||||
#ifdef SIGSYS
|
||||
|(1<<(SIGSYS-1))
|
||||
#endif
|
||||
);
|
||||
#endif /* _POSIX_SOURCE */
|
||||
sig_act.sa_flags = 0;
|
||||
sigaction(SIGHUP, &sig_act, (struct sigaction *)0);
|
||||
sigaction(SIGINT, &sig_act, (struct sigaction *)0);
|
||||
sigaction(SIGQUIT, &sig_act, (struct sigaction *)0);
|
||||
sigaction(SIGILL, &sig_act, (struct sigaction *)0);
|
||||
#ifdef SIGBUS
|
||||
sigaction(SIGBUS, &sig_act, (struct sigaction *)0);
|
||||
#endif
|
||||
sigaction(SIGSEGV, &sig_act, (struct sigaction *)0);
|
||||
#ifdef SIGSYS
|
||||
sigaction(SIGSYS, &sig_act, (struct sigaction *)0);
|
||||
#endif
|
||||
#endif /* USGISH */
|
||||
|
||||
/*
|
||||
* now peruse through the list of files.
|
||||
*/
|
||||
for(fp=filelist; *fp; fp++) {
|
||||
DBG_PRINT(stderr,"file: %s\n",*fp);
|
||||
filecontent = getfile(*fp);
|
||||
setfile_cmdinc(filecontent, cmdinc_count, cmdinc_list);
|
||||
ip = newinclude(*fp, (char *)NULL);
|
||||
|
||||
find_includes(filecontent, ip, ip, 0, FALSE);
|
||||
freefile(filecontent);
|
||||
recursive_pr_include(ip, ip->i_file, base_name(*fp));
|
||||
inc_clean();
|
||||
}
|
||||
if (printed)
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __UNIXOS2__
|
||||
/*
|
||||
* eliminate \r chars from file
|
||||
*/
|
||||
static int
|
||||
elim_cr(char *buf, int sz)
|
||||
{
|
||||
int i,wp;
|
||||
for (i= wp = 0; i<sz; i++) {
|
||||
if (buf[i] != '\r')
|
||||
buf[wp++] = buf[i];
|
||||
}
|
||||
return wp;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct filepointer *
|
||||
getfile(char *file)
|
||||
{
|
||||
int fd;
|
||||
struct filepointer *content;
|
||||
struct stat st;
|
||||
|
||||
content = (struct filepointer *)malloc(sizeof(struct filepointer));
|
||||
content->f_name = file;
|
||||
if ((fd = open(file, O_RDONLY)) < 0) {
|
||||
warning("cannot open \"%s\"\n", file);
|
||||
content->f_p = content->f_base = content->f_end = (char *)malloc(1);
|
||||
*content->f_p = '\0';
|
||||
return(content);
|
||||
}
|
||||
fstat(fd, &st);
|
||||
content->f_base = (char *)malloc(st.st_size+1);
|
||||
if (content->f_base == NULL)
|
||||
fatalerr("cannot allocate mem\n");
|
||||
if ((st.st_size = read(fd, content->f_base, st.st_size)) < 0)
|
||||
fatalerr("failed to read %s\n", file);
|
||||
#ifdef __UNIXOS2__
|
||||
st.st_size = elim_cr(content->f_base,st.st_size);
|
||||
#endif
|
||||
close(fd);
|
||||
content->f_len = st.st_size+1;
|
||||
content->f_p = content->f_base;
|
||||
content->f_end = content->f_base + st.st_size;
|
||||
*content->f_end = '\0';
|
||||
content->f_line = 0;
|
||||
content->cmdinc_count = 0;
|
||||
content->cmdinc_list = NULL;
|
||||
content->cmdinc_line = 0;
|
||||
return(content);
|
||||
}
|
||||
|
||||
void
|
||||
setfile_cmdinc(struct filepointer* filep, long count, char** list)
|
||||
{
|
||||
filep->cmdinc_count = count;
|
||||
filep->cmdinc_list = list;
|
||||
filep->cmdinc_line = 0;
|
||||
}
|
||||
|
||||
void
|
||||
freefile(struct filepointer *fp)
|
||||
{
|
||||
free(fp->f_base);
|
||||
free(fp);
|
||||
}
|
||||
|
||||
char *copy(char *str)
|
||||
{
|
||||
char *p = (char *)malloc(strlen(str) + 1);
|
||||
|
||||
strcpy(p, str);
|
||||
return(p);
|
||||
}
|
||||
|
||||
int
|
||||
match(char *str, char **list)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; *list; i++, list++)
|
||||
if (strcmp(str, *list) == 0)
|
||||
return(i);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the next line. We only return lines beginning with '#' since that
|
||||
* is all this program is ever interested in.
|
||||
*/
|
||||
char *getnextline(struct filepointer *filep)
|
||||
{
|
||||
char *p, /* walking pointer */
|
||||
*eof, /* end of file pointer */
|
||||
*bol; /* beginning of line pointer */
|
||||
int lineno; /* line number */
|
||||
boolean whitespace = FALSE;
|
||||
|
||||
/*
|
||||
* Fake the "-include" line files in form of #include to the
|
||||
* start of each file.
|
||||
*/
|
||||
if (filep->cmdinc_line < filep->cmdinc_count) {
|
||||
char *inc = filep->cmdinc_list[2 * filep->cmdinc_line + 0];
|
||||
char *buf = filep->cmdinc_list[2 * filep->cmdinc_line + 1];
|
||||
filep->cmdinc_line++;
|
||||
sprintf(buf,"%s%s%s",DASH_INC_PRE,inc,DASH_INC_POST);
|
||||
DBG_PRINT(stderr,"%s\n",buf);
|
||||
return(buf);
|
||||
}
|
||||
|
||||
p = filep->f_p;
|
||||
eof = filep->f_end;
|
||||
if (p >= eof)
|
||||
return((char *)NULL);
|
||||
lineno = filep->f_line;
|
||||
|
||||
for (bol = p--; ++p < eof; ) {
|
||||
if ((bol == p) && ((*p == ' ') || (*p == '\t')))
|
||||
{
|
||||
/* Consume leading white-spaces for this line */
|
||||
while (((p+1) < eof) && ((*p == ' ') || (*p == '\t')))
|
||||
{
|
||||
p++;
|
||||
bol++;
|
||||
}
|
||||
whitespace = TRUE;
|
||||
}
|
||||
|
||||
if (*p == '/' && (p+1) < eof && *(p+1) == '*') {
|
||||
/* Consume C comments */
|
||||
*(p++) = ' ';
|
||||
*(p++) = ' ';
|
||||
while (p < eof && *p) {
|
||||
if (*p == '*' && (p+1) < eof && *(p+1) == '/') {
|
||||
*(p++) = ' ';
|
||||
*(p++) = ' ';
|
||||
break;
|
||||
}
|
||||
if (*p == '\n')
|
||||
lineno++;
|
||||
*(p++) = ' ';
|
||||
}
|
||||
--p;
|
||||
}
|
||||
else if (*p == '/' && (p+1) < eof && *(p+1) == '/') {
|
||||
/* Consume C++ comments */
|
||||
*(p++) = ' ';
|
||||
*(p++) = ' ';
|
||||
while (p < eof && *p) {
|
||||
if (*p == '\\' && (p+1) < eof &&
|
||||
*(p+1) == '\n') {
|
||||
*(p++) = ' ';
|
||||
lineno++;
|
||||
}
|
||||
else if (*p == '?' && (p+3) < eof &&
|
||||
*(p+1) == '?' &&
|
||||
*(p+2) == '/' &&
|
||||
*(p+3) == '\n') {
|
||||
*(p++) = ' ';
|
||||
*(p++) = ' ';
|
||||
*(p++) = ' ';
|
||||
lineno++;
|
||||
}
|
||||
else if (*p == '\n')
|
||||
break; /* to process end of line */
|
||||
*(p++) = ' ';
|
||||
}
|
||||
--p;
|
||||
}
|
||||
else if (*p == '\\' && (p+1) < eof && *(p+1) == '\n') {
|
||||
/* Consume backslash line terminations */
|
||||
*(p++) = ' ';
|
||||
*p = ' ';
|
||||
lineno++;
|
||||
}
|
||||
else if (*p == '?' && (p+3) < eof &&
|
||||
*(p+1) == '?' && *(p+2) == '/' && *(p+3) == '\n') {
|
||||
/* Consume trigraph'ed backslash line terminations */
|
||||
*(p++) = ' ';
|
||||
*(p++) = ' ';
|
||||
*(p++) = ' ';
|
||||
*p = ' ';
|
||||
lineno++;
|
||||
}
|
||||
else if (*p == '\n') {
|
||||
lineno++;
|
||||
if (*bol == '#') {
|
||||
char *cp;
|
||||
|
||||
*(p++) = '\0';
|
||||
/* punt lines with just # (yacc generated) */
|
||||
for (cp = bol+1;
|
||||
*cp && (*cp == ' ' || *cp == '\t'); cp++);
|
||||
if (*cp) goto done;
|
||||
--p;
|
||||
}
|
||||
bol = p+1;
|
||||
whitespace = FALSE;
|
||||
}
|
||||
}
|
||||
if (*bol != '#')
|
||||
bol = NULL;
|
||||
done:
|
||||
#if !defined(__UNIXOS2__) && !defined(_MSC_VER) && !defined(_WIN32)
|
||||
/* Don't print warnings for system header files */
|
||||
if (bol && whitespace && !strstr(filep->f_name, INCLUDEDIR)) {
|
||||
warning("%s: non-portable whitespace encountered at line %d\n",
|
||||
filep->f_name, lineno);
|
||||
}
|
||||
#endif
|
||||
filep->f_p = p;
|
||||
filep->f_line = lineno;
|
||||
#ifdef DEBUG_DUMP
|
||||
if (bol)
|
||||
DBG_PRINT(stderr,"%s\n",bol);
|
||||
#endif
|
||||
return(bol);
|
||||
}
|
||||
|
||||
/*
|
||||
* Strip the file name down to what we want to see in the Makefile.
|
||||
* It will have objprefix and objsuffix around it.
|
||||
*/
|
||||
char *base_name(char *file)
|
||||
{
|
||||
char *p;
|
||||
|
||||
file = copy(file);
|
||||
for(p=file+strlen(file); p>file && *p != '.'; p--) ;
|
||||
|
||||
if (*p == '.')
|
||||
*p = '\0';
|
||||
return(file);
|
||||
}
|
||||
|
||||
#if defined(USG) && !defined(CRAY) && !defined(SVR4) && !defined(__UNIXOS2__) && !defined(clipper) && !defined(__clipper__)
|
||||
int rename (char *from, char *to)
|
||||
{
|
||||
(void) unlink (to);
|
||||
if (link (from, to) == 0) {
|
||||
unlink (from);
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif /* USGISH */
|
||||
|
||||
void
|
||||
redirect(char *line, char *makefile)
|
||||
{
|
||||
struct stat st;
|
||||
FILE *fdin, *fdout;
|
||||
char backup[ BUFSIZ ],
|
||||
buf[ BUFSIZ ];
|
||||
boolean found = FALSE;
|
||||
int len;
|
||||
|
||||
/*
|
||||
* if makefile is "-" then let it pour onto stdout.
|
||||
*/
|
||||
if (makefile && *makefile == '-' && *(makefile+1) == '\0') {
|
||||
puts(line);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* use a default makefile is not specified.
|
||||
*/
|
||||
if (!makefile) {
|
||||
if (stat("Makefile", &st) == 0)
|
||||
makefile = "Makefile";
|
||||
else if (stat("makefile", &st) == 0)
|
||||
makefile = "makefile";
|
||||
else
|
||||
fatalerr("[mM]akefile is not present\n");
|
||||
}
|
||||
else
|
||||
stat(makefile, &st);
|
||||
if ((fdin = fopen(makefile, "r")) == NULL)
|
||||
fatalerr("cannot open \"%s\"\n", makefile);
|
||||
sprintf(backup, "%s.bak", makefile);
|
||||
unlink(backup);
|
||||
#if defined(WIN32) || defined(__UNIXOS2__) || defined(__CYGWIN__)
|
||||
fclose(fdin);
|
||||
#endif
|
||||
if (rename(makefile, backup) < 0)
|
||||
fatalerr("cannot rename %s to %s\n", makefile, backup);
|
||||
#if defined(WIN32) || defined(__UNIXOS2__) || defined(__CYGWIN__)
|
||||
if ((fdin = fopen(backup, "r")) == NULL)
|
||||
fatalerr("cannot open \"%s\"\n", backup);
|
||||
#endif
|
||||
if ((fdout = freopen(makefile, "w", stdout)) == NULL)
|
||||
fatalerr("cannot open \"%s\"\n", backup);
|
||||
len = strlen(line);
|
||||
while (!found && fgets(buf, BUFSIZ, fdin)) {
|
||||
if (*buf == '#' && strncmp(line, buf, len) == 0)
|
||||
found = TRUE;
|
||||
fputs(buf, fdout);
|
||||
}
|
||||
if (!found) {
|
||||
if (verbose)
|
||||
warning("Adding new delimiting line \"%s\" and dependencies...\n",
|
||||
line);
|
||||
puts(line); /* same as fputs(fdout); but with newline */
|
||||
} else if (append) {
|
||||
while (fgets(buf, BUFSIZ, fdin)) {
|
||||
fputs(buf, fdout);
|
||||
}
|
||||
}
|
||||
fflush(fdout);
|
||||
#if defined(USGISH) || defined(_SEQUENT_) || defined(USE_CHMOD)
|
||||
chmod(makefile, st.st_mode);
|
||||
#else
|
||||
fchmod(fileno(fdout), st.st_mode);
|
||||
#endif /* USGISH */
|
||||
}
|
||||
|
||||
void
|
||||
fatalerr(char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
fprintf(stderr, "%s: error: ", ProgramName);
|
||||
va_start(args, msg);
|
||||
vfprintf(stderr, msg, args);
|
||||
va_end(args);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
void
|
||||
warning(char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
fprintf(stderr, "%s: warning: ", ProgramName);
|
||||
va_start(args, msg);
|
||||
vfprintf(stderr, msg, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
warning1(char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
vfprintf(stderr, msg, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
|
@ -1,382 +0,0 @@
|
|||
.\" $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.7 2002/12/14 02:39:45 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
|
||||
|
|
@ -1,693 +0,0 @@
|
|||
/* $Xorg: parse.c,v 1.6 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/parse.c,v 1.12 2002/02/26 05:09:10 tsi Exp $ */
|
||||
|
||||
#include "def.h"
|
||||
|
||||
extern char *directives[];
|
||||
extern struct inclist inclist[ MAXFILES ],
|
||||
*inclistnext,
|
||||
maininclist;
|
||||
extern char *includedirs[ ],
|
||||
**includedirsnext;
|
||||
|
||||
static int deftype (char *line, struct filepointer *filep,
|
||||
struct inclist *file_red, struct inclist *file,
|
||||
int parse_it);
|
||||
static int zero_value(char *filename, char *exp, struct filepointer *filep,
|
||||
struct inclist *file_red);
|
||||
static int merge2defines(struct inclist *file1, struct inclist *file2);
|
||||
|
||||
static int
|
||||
gobble(struct filepointer *filep, struct inclist *file,
|
||||
struct inclist *file_red)
|
||||
{
|
||||
char *line;
|
||||
int type;
|
||||
|
||||
while ((line = getnextline(filep))) {
|
||||
switch(type = deftype(line, filep, file_red, file, FALSE)) {
|
||||
case IF:
|
||||
case IFFALSE:
|
||||
case IFGUESSFALSE:
|
||||
case IFDEF:
|
||||
case IFNDEF:
|
||||
type = gobble(filep, file, file_red);
|
||||
while ((type == ELIF) || (type == ELIFFALSE) ||
|
||||
(type == ELIFGUESSFALSE))
|
||||
type = gobble(filep, file, file_red);
|
||||
if (type == ELSE)
|
||||
(void)gobble(filep, file, file_red);
|
||||
break;
|
||||
case ELSE:
|
||||
case ENDIF:
|
||||
debug(0,("%s, line %d: #%s\n",
|
||||
file->i_file, filep->f_line,
|
||||
directives[type]));
|
||||
return(type);
|
||||
case DEFINE:
|
||||
case UNDEF:
|
||||
case INCLUDE:
|
||||
case INCLUDEDOT:
|
||||
case PRAGMA:
|
||||
case ERROR:
|
||||
case IDENT:
|
||||
case SCCS:
|
||||
case EJECT:
|
||||
case WARNING:
|
||||
case INCLUDENEXT:
|
||||
case INCLUDENEXTDOT:
|
||||
break;
|
||||
case ELIF:
|
||||
case ELIFFALSE:
|
||||
case ELIFGUESSFALSE:
|
||||
return(type);
|
||||
case -1:
|
||||
warning("%s", file_red->i_file);
|
||||
if (file_red != file)
|
||||
warning1(" (reading %s)", file->i_file);
|
||||
warning1(", line %d: unknown directive == \"%s\"\n",
|
||||
filep->f_line, line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Decide what type of # directive this line is.
|
||||
*/
|
||||
static int
|
||||
deftype (char *line, struct filepointer *filep,
|
||||
struct inclist *file_red, struct inclist *file, int parse_it)
|
||||
{
|
||||
register char *p;
|
||||
char *directive, savechar, *q;
|
||||
register int ret;
|
||||
|
||||
/*
|
||||
* Parse the directive...
|
||||
*/
|
||||
directive=line+1;
|
||||
while (*directive == ' ' || *directive == '\t')
|
||||
directive++;
|
||||
|
||||
p = directive;
|
||||
while ((*p == '_') || (*p >= 'a' && *p <= 'z'))
|
||||
p++;
|
||||
savechar = *p;
|
||||
*p = '\0';
|
||||
ret = match(directive, directives);
|
||||
*p = savechar;
|
||||
|
||||
/* If we don't recognize this compiler directive or we happen to just
|
||||
* be gobbling up text while waiting for an #endif or #elif or #else
|
||||
* in the case of an #elif we must check the zero_value and return an
|
||||
* ELIF or an ELIFFALSE.
|
||||
*/
|
||||
|
||||
if (ret == ELIF && !parse_it)
|
||||
{
|
||||
while (*p == ' ' || *p == '\t')
|
||||
p++;
|
||||
/*
|
||||
* parse an expression.
|
||||
*/
|
||||
debug(0,("%s, line %d: #elif %s ",
|
||||
file->i_file, filep->f_line, p));
|
||||
ret = zero_value(file->i_file, p, filep, file_red);
|
||||
if (ret != IF)
|
||||
{
|
||||
debug(0,("false...\n"));
|
||||
if (ret == IFFALSE)
|
||||
return(ELIFFALSE);
|
||||
else
|
||||
return(ELIFGUESSFALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug(0,("true...\n"));
|
||||
return(ELIF);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret < 0 || ! parse_it)
|
||||
return(ret);
|
||||
|
||||
/*
|
||||
* now decide how to parse the directive, and do it.
|
||||
*/
|
||||
while (*p == ' ' || *p == '\t')
|
||||
p++;
|
||||
q = p + strlen(p);
|
||||
do {
|
||||
q--;
|
||||
} while (*q == ' ' || *q == '\t');
|
||||
q[1] = '\0';
|
||||
switch (ret) {
|
||||
case IF:
|
||||
/*
|
||||
* parse an expression.
|
||||
*/
|
||||
ret = zero_value(file->i_file, p, filep, file_red);
|
||||
debug(0,("%s, line %d: %s #if %s\n",
|
||||
file->i_file, filep->f_line, ret?"false":"true", p));
|
||||
break;
|
||||
case IFDEF:
|
||||
case IFNDEF:
|
||||
debug(0,("%s, line %d: #%s %s\n",
|
||||
file->i_file, filep->f_line, directives[ret], p));
|
||||
case UNDEF:
|
||||
/*
|
||||
* separate the name of a single symbol.
|
||||
*/
|
||||
while (isalnum(*p) || *p == '_')
|
||||
*line++ = *p++;
|
||||
*line = '\0';
|
||||
break;
|
||||
case INCLUDE:
|
||||
case INCLUDENEXT:
|
||||
debug(2,("%s, line %d: #include%s %s\n",
|
||||
file->i_file, filep->f_line,
|
||||
(ret == INCLUDE) ? "" : "_next", p));
|
||||
|
||||
/* Support ANSI macro substitution */
|
||||
while (1) {
|
||||
struct symtab **sym;
|
||||
|
||||
if (!*p || *p == '"' || *p == '<')
|
||||
break;
|
||||
|
||||
sym = isdefined(p, file_red, NULL);
|
||||
if (!sym)
|
||||
break;
|
||||
|
||||
p = (*sym)->s_value;
|
||||
debug(3,("%s : #includes SYMBOL %s = %s\n",
|
||||
file->i_incstring,
|
||||
(*sym) -> s_name,
|
||||
(*sym) -> s_value));
|
||||
/* mark file as having included a 'soft include' */
|
||||
file->i_flags |= INCLUDED_SYM;
|
||||
}
|
||||
|
||||
/*
|
||||
* Separate the name of the include file.
|
||||
*/
|
||||
while (*p && *p != '"' && *p != '<')
|
||||
p++;
|
||||
if (! *p)
|
||||
return(-2);
|
||||
if (*p++ == '"') {
|
||||
if (ret == INCLUDE)
|
||||
ret = INCLUDEDOT;
|
||||
else
|
||||
ret = INCLUDENEXTDOT;
|
||||
while (*p && *p != '"')
|
||||
*line++ = *p++;
|
||||
} else
|
||||
while (*p && *p != '>')
|
||||
*line++ = *p++;
|
||||
*line = '\0';
|
||||
break;
|
||||
case DEFINE:
|
||||
/*
|
||||
* copy the definition back to the beginning of the line.
|
||||
*/
|
||||
strcpy (line, p);
|
||||
break;
|
||||
case ELSE:
|
||||
case ENDIF:
|
||||
case ELIF:
|
||||
case PRAGMA:
|
||||
case ERROR:
|
||||
case IDENT:
|
||||
case SCCS:
|
||||
case EJECT:
|
||||
case WARNING:
|
||||
debug(0,("%s, line %d: #%s\n",
|
||||
file->i_file, filep->f_line, directives[ret]));
|
||||
/*
|
||||
* nothing to do.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
struct symtab **
|
||||
fdefined(char *symbol, struct inclist *file, struct inclist **srcfile)
|
||||
{
|
||||
struct inclist **ip;
|
||||
struct symtab **val;
|
||||
int i;
|
||||
static int recurse_lvl = 0;
|
||||
|
||||
if (file->i_flags & DEFCHECKED)
|
||||
return(NULL);
|
||||
debug(2,("Looking for %s in %s\n", symbol, file->i_file));
|
||||
file->i_flags |= DEFCHECKED;
|
||||
if ((val = slookup(symbol, file)))
|
||||
debug(1,("%s defined in %s as %s\n",
|
||||
symbol, file->i_file, (*val)->s_value));
|
||||
if (val == NULL && file->i_list)
|
||||
{
|
||||
for (ip = file->i_list, i=0; i < file->i_listlen; i++, ip++)
|
||||
if (file->i_merged[i]==FALSE) {
|
||||
val = fdefined(symbol, *ip, srcfile);
|
||||
file->i_merged[i]=merge2defines(file,*ip);
|
||||
if (val!=NULL) break;
|
||||
}
|
||||
}
|
||||
else if (val != NULL && srcfile != NULL) *srcfile = file;
|
||||
recurse_lvl--;
|
||||
file->i_flags &= ~DEFCHECKED;
|
||||
|
||||
return(val);
|
||||
}
|
||||
|
||||
struct symtab **
|
||||
isdefined(char *symbol, struct inclist *file, struct inclist **srcfile)
|
||||
{
|
||||
struct symtab **val;
|
||||
|
||||
if ((val = slookup(symbol, &maininclist))) {
|
||||
debug(1,("%s defined on command line\n", symbol));
|
||||
if (srcfile != NULL) *srcfile = &maininclist;
|
||||
return(val);
|
||||
}
|
||||
if ((val = fdefined(symbol, file, srcfile)))
|
||||
return(val);
|
||||
debug(1,("%s not defined in %s\n", symbol, file->i_file));
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return type based on if the #if expression evaluates to 0
|
||||
*/
|
||||
static int
|
||||
zero_value(char *filename,
|
||||
char *exp,
|
||||
struct filepointer *filep,
|
||||
struct inclist *file_red)
|
||||
{
|
||||
if (cppsetup(filename, exp, filep, file_red))
|
||||
return(IFFALSE);
|
||||
else
|
||||
return(IF);
|
||||
}
|
||||
|
||||
void
|
||||
define2(char *name, char *val, struct inclist *file)
|
||||
{
|
||||
int first, last, below;
|
||||
register struct symtab **sp = NULL, **dest;
|
||||
struct symtab *stab;
|
||||
|
||||
/* Make space if it's needed */
|
||||
if (file->i_defs == NULL)
|
||||
{
|
||||
file->i_defs = (struct symtab **)
|
||||
malloc(sizeof (struct symtab*) * SYMTABINC);
|
||||
file->i_ndefs = 0;
|
||||
}
|
||||
else if (!(file->i_ndefs % SYMTABINC))
|
||||
file->i_defs = (struct symtab **)
|
||||
realloc(file->i_defs,
|
||||
sizeof(struct symtab*)*(file->i_ndefs+SYMTABINC));
|
||||
|
||||
if (file->i_defs == NULL)
|
||||
fatalerr("malloc()/realloc() failure in insert_defn()\n");
|
||||
|
||||
below = first = 0;
|
||||
last = file->i_ndefs - 1;
|
||||
while (last >= first)
|
||||
{
|
||||
/* Fast inline binary search */
|
||||
register char *s1;
|
||||
register char *s2;
|
||||
register int middle = first + (last - first) / 2;
|
||||
|
||||
/* Fast inline strchr() */
|
||||
s1 = name;
|
||||
s2 = file->i_defs[middle]->s_name;
|
||||
while (*s1++ == *s2++)
|
||||
if (s2[-1] == '\0') break;
|
||||
|
||||
/* If exact match, set sp and break */
|
||||
if (*--s1 == *--s2)
|
||||
{
|
||||
sp = file->i_defs + middle;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If name > i_defs[middle] ... */
|
||||
if (*s1 > *s2)
|
||||
{
|
||||
below = first;
|
||||
first = middle + 1;
|
||||
}
|
||||
/* else ... */
|
||||
else
|
||||
{
|
||||
below = last = middle - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Search is done. If we found an exact match to the symbol name,
|
||||
just replace its s_value */
|
||||
if (sp != NULL)
|
||||
{
|
||||
debug(1,("redefining %s from %s to %s in file %s\n",
|
||||
name, (*sp)->s_value, val, file->i_file));
|
||||
free((*sp)->s_value);
|
||||
(*sp)->s_value = copy(val);
|
||||
return;
|
||||
}
|
||||
|
||||
sp = file->i_defs + file->i_ndefs++;
|
||||
dest = file->i_defs + below + 1;
|
||||
while (sp > dest)
|
||||
{
|
||||
*sp = sp[-1];
|
||||
sp--;
|
||||
}
|
||||
stab = (struct symtab *) malloc(sizeof (struct symtab));
|
||||
if (stab == NULL)
|
||||
fatalerr("malloc()/realloc() failure in insert_defn()\n");
|
||||
|
||||
debug(1,("defining %s to %s in file %s\n", name, val, file->i_file));
|
||||
stab->s_name = copy(name);
|
||||
stab->s_value = copy(val);
|
||||
*sp = stab;
|
||||
}
|
||||
|
||||
void
|
||||
define(char *def, struct inclist *file)
|
||||
{
|
||||
char *val;
|
||||
|
||||
/* Separate symbol name and its value */
|
||||
val = def;
|
||||
while (isalnum(*val) || *val == '_')
|
||||
val++;
|
||||
if (*val)
|
||||
*val++ = '\0';
|
||||
while (*val == ' ' || *val == '\t')
|
||||
val++;
|
||||
|
||||
if (!*val)
|
||||
val = "1";
|
||||
define2(def, val, file);
|
||||
}
|
||||
|
||||
struct symtab **
|
||||
slookup(char *symbol, struct inclist *file)
|
||||
{
|
||||
register int first = 0;
|
||||
register int last;
|
||||
|
||||
if (!file)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
last = file->i_ndefs - 1;
|
||||
|
||||
while (last >= first)
|
||||
{
|
||||
/* Fast inline binary search */
|
||||
register char *s1;
|
||||
register char *s2;
|
||||
register int middle = first + (last - first) / 2;
|
||||
|
||||
/* Fast inline strchr() */
|
||||
s1 = symbol;
|
||||
s2 = file->i_defs[middle]->s_name;
|
||||
while (*s1++ == *s2++)
|
||||
if (s2[-1] == '\0') break;
|
||||
|
||||
/* If exact match, we're done */
|
||||
if (*--s1 == *--s2)
|
||||
{
|
||||
return file->i_defs + middle;
|
||||
}
|
||||
|
||||
/* If symbol > i_defs[middle] ... */
|
||||
if (*s1 > *s2)
|
||||
{
|
||||
first = middle + 1;
|
||||
}
|
||||
/* else ... */
|
||||
else
|
||||
{
|
||||
last = middle - 1;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
merge2defines(struct inclist *file1, struct inclist *file2)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ((file1==NULL) || (file2==NULL) ||
|
||||
!(file2->i_flags & FINISHED))
|
||||
return 0;
|
||||
|
||||
for (i=0; i < file2->i_listlen; i++)
|
||||
if (file2->i_merged[i]==FALSE)
|
||||
return 0;
|
||||
|
||||
{
|
||||
int first1 = 0;
|
||||
int last1 = file1->i_ndefs - 1;
|
||||
|
||||
int first2 = 0;
|
||||
int last2 = file2->i_ndefs - 1;
|
||||
|
||||
int first=0;
|
||||
struct symtab** i_defs = NULL;
|
||||
int deflen=file1->i_ndefs+file2->i_ndefs;
|
||||
|
||||
debug(2,("merging %s into %s\n",
|
||||
file2->i_file, file1->i_file));
|
||||
|
||||
if (deflen>0)
|
||||
{
|
||||
/* make sure deflen % SYMTABINC == 0 is still true */
|
||||
deflen += (SYMTABINC - deflen % SYMTABINC) % SYMTABINC;
|
||||
i_defs=(struct symtab**)
|
||||
malloc(deflen*sizeof(struct symtab*));
|
||||
if (i_defs==NULL) return 0;
|
||||
}
|
||||
|
||||
while ((last1 >= first1) && (last2 >= first2))
|
||||
{
|
||||
char *s1=file1->i_defs[first1]->s_name;
|
||||
char *s2=file2->i_defs[first2]->s_name;
|
||||
|
||||
if (strcmp(s1,s2) < 0)
|
||||
i_defs[first++]=file1->i_defs[first1++];
|
||||
else if (strcmp(s1,s2) > 0)
|
||||
i_defs[first++]=file2->i_defs[first2++];
|
||||
else /* equal */
|
||||
{
|
||||
i_defs[first++]=file2->i_defs[first2++];
|
||||
first1++;
|
||||
}
|
||||
}
|
||||
while (last1 >= first1)
|
||||
{
|
||||
i_defs[first++]=file1->i_defs[first1++];
|
||||
}
|
||||
while (last2 >= first2)
|
||||
{
|
||||
i_defs[first++]=file2->i_defs[first2++];
|
||||
}
|
||||
|
||||
if (file1->i_defs) free(file1->i_defs);
|
||||
file1->i_defs=i_defs;
|
||||
file1->i_ndefs=first;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
undefine(char *symbol, struct inclist *file)
|
||||
{
|
||||
register struct symtab **ptr;
|
||||
struct inclist *srcfile;
|
||||
while ((ptr = isdefined(symbol, file, &srcfile)) != NULL)
|
||||
{
|
||||
srcfile->i_ndefs--;
|
||||
for (; ptr < srcfile->i_defs + srcfile->i_ndefs; ptr++)
|
||||
*ptr = ptr[1];
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
find_includes(struct filepointer *filep, struct inclist *file,
|
||||
struct inclist *file_red, int recursion, boolean failOK)
|
||||
{
|
||||
struct inclist *inclistp;
|
||||
char **includedirsp;
|
||||
register char *line;
|
||||
register int type;
|
||||
boolean recfailOK;
|
||||
|
||||
while ((line = getnextline(filep))) {
|
||||
switch(type = deftype(line, filep, file_red, file, TRUE)) {
|
||||
case IF:
|
||||
doif:
|
||||
type = find_includes(filep, file,
|
||||
file_red, recursion+1, failOK);
|
||||
while ((type == ELIF) || (type == ELIFFALSE) ||
|
||||
(type == ELIFGUESSFALSE))
|
||||
type = gobble(filep, file, file_red);
|
||||
if (type == ELSE)
|
||||
gobble(filep, file, file_red);
|
||||
break;
|
||||
case IFFALSE:
|
||||
case IFGUESSFALSE:
|
||||
doiffalse:
|
||||
if (type == IFGUESSFALSE || type == ELIFGUESSFALSE)
|
||||
recfailOK = TRUE;
|
||||
else
|
||||
recfailOK = failOK;
|
||||
type = gobble(filep, file, file_red);
|
||||
if (type == ELSE)
|
||||
find_includes(filep, file,
|
||||
file_red, recursion+1, recfailOK);
|
||||
else
|
||||
if (type == ELIF)
|
||||
goto doif;
|
||||
else
|
||||
if ((type == ELIFFALSE) || (type == ELIFGUESSFALSE))
|
||||
goto doiffalse;
|
||||
break;
|
||||
case IFDEF:
|
||||
case IFNDEF:
|
||||
if ((type == IFDEF && isdefined(line, file_red, NULL))
|
||||
|| (type == IFNDEF && !isdefined(line, file_red, NULL))) {
|
||||
debug(1,(type == IFNDEF ?
|
||||
"line %d: %s !def'd in %s via %s%s\n" : "",
|
||||
filep->f_line, line,
|
||||
file->i_file, file_red->i_file, ": doit"));
|
||||
type = find_includes(filep, file,
|
||||
file_red, recursion+1, failOK);
|
||||
while (type == ELIF || type == ELIFFALSE || type == ELIFGUESSFALSE)
|
||||
type = gobble(filep, file, file_red);
|
||||
if (type == ELSE)
|
||||
gobble(filep, file, file_red);
|
||||
}
|
||||
else {
|
||||
debug(1,(type == IFDEF ?
|
||||
"line %d: %s !def'd in %s via %s%s\n" : "",
|
||||
filep->f_line, line,
|
||||
file->i_file, file_red->i_file, ": gobble"));
|
||||
type = gobble(filep, file, file_red);
|
||||
if (type == ELSE)
|
||||
find_includes(filep, file,
|
||||
file_red, recursion+1, failOK);
|
||||
else if (type == ELIF)
|
||||
goto doif;
|
||||
else if (type == ELIFFALSE || type == ELIFGUESSFALSE)
|
||||
goto doiffalse;
|
||||
}
|
||||
break;
|
||||
case ELSE:
|
||||
case ELIFFALSE:
|
||||
case ELIFGUESSFALSE:
|
||||
case ELIF:
|
||||
if (!recursion)
|
||||
gobble(filep, file, file_red);
|
||||
case ENDIF:
|
||||
if (recursion)
|
||||
return(type);
|
||||
case DEFINE:
|
||||
define(line, file);
|
||||
break;
|
||||
case UNDEF:
|
||||
if (!*line) {
|
||||
warning("%s", file_red->i_file);
|
||||
if (file_red != file)
|
||||
warning1(" (reading %s)", file->i_file);
|
||||
warning1(", line %d: incomplete undef == \"%s\"\n",
|
||||
filep->f_line, line);
|
||||
break;
|
||||
}
|
||||
undefine(line, file_red);
|
||||
break;
|
||||
case INCLUDE:
|
||||
case INCLUDEDOT:
|
||||
case INCLUDENEXT:
|
||||
case INCLUDENEXTDOT:
|
||||
inclistp = inclistnext;
|
||||
includedirsp = includedirsnext;
|
||||
debug(2,("%s, reading %s, includes %s\n",
|
||||
file_red->i_file, file->i_file, line));
|
||||
add_include(filep, file, file_red, line, type, failOK);
|
||||
inclistnext = inclistp;
|
||||
includedirsnext = includedirsp;
|
||||
break;
|
||||
case ERROR:
|
||||
case WARNING:
|
||||
warning("%s", file_red->i_file);
|
||||
if (file_red != file)
|
||||
warning1(" (reading %s)", file->i_file);
|
||||
warning1(", line %d: %s\n",
|
||||
filep->f_line, line);
|
||||
break;
|
||||
|
||||
case PRAGMA:
|
||||
case IDENT:
|
||||
case SCCS:
|
||||
case EJECT:
|
||||
break;
|
||||
case -1:
|
||||
warning("%s", file_red->i_file);
|
||||
if (file_red != file)
|
||||
warning1(" (reading %s)", file->i_file);
|
||||
warning1(", line %d: unknown directive == \"%s\"\n",
|
||||
filep->f_line, line);
|
||||
break;
|
||||
case -2:
|
||||
warning("%s", file_red->i_file);
|
||||
if (file_red != file)
|
||||
warning1(" (reading %s)", file->i_file);
|
||||
warning1(", line %d: incomplete include == \"%s\"\n",
|
||||
filep->f_line, line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
file->i_flags |= FINISHED;
|
||||
debug(2,("finished with %s\n", file->i_file));
|
||||
return(-1);
|
||||
}
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
/* $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.5 2001/12/14 19:53:21 dawes 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);
|
||||
}
|
||||
|
|
@ -14,10 +14,6 @@
|
|||
# always be identified for compiling/linking purposes
|
||||
#
|
||||
|
||||
ifndef JAVA_SOURCE_COMPONENT
|
||||
JAVA_SOURCE_COMPONENT = java
|
||||
endif
|
||||
|
||||
ifndef NETLIB_SOURCE_COMPONENT
|
||||
NETLIB_SOURCE_COMPONENT = netlib
|
||||
endif
|
||||
|
|
|
|||
0
security/nss/coreconf/msvc.sh
Normal file → Executable file
0
security/nss/coreconf/msvc.sh
Normal file → Executable file
|
|
@ -20,6 +20,7 @@ include $(DEPTH)/coreconf/config.mk
|
|||
|
||||
ifeq (,$(filter-out OS2 WIN%,$(OS_TARGET)))
|
||||
PROGRAM =
|
||||
TARGETS =
|
||||
else
|
||||
TARGETS = $(PROGRAM)
|
||||
INSTALL = true
|
||||
|
|
@ -33,10 +34,14 @@ ifdef NATIVE_FLAGS
|
|||
OS_CFLAGS=$(NATIVE_FLAGS)
|
||||
endif
|
||||
|
||||
ifdef NATIVE_LDFLAGS
|
||||
LDFLAGS=$(NATIVE_LDFLAGS)
|
||||
endif
|
||||
|
||||
include $(DEPTH)/coreconf/rules.mk
|
||||
|
||||
# Redefine MAKE_OBJDIR for just this directory
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi
|
||||
if test ! -d $(@D); then mkdir -p $(@D); fi
|
||||
endef
|
||||
|
||||
|
|
|
|||
|
|
@ -26,16 +26,12 @@ typedef unsigned int mode_t;
|
|||
|
||||
#define HAVE_LCHOWN
|
||||
|
||||
#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) || defined(NTO) || defined(DARWIN) || defined(BEOS) || defined(__riscos__)
|
||||
#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) || defined(NTO) || defined(DARWIN) || defined(__riscos__)
|
||||
#undef HAVE_LCHOWN
|
||||
#endif
|
||||
|
||||
#define HAVE_FCHMOD
|
||||
|
||||
#if defined(BEOS)
|
||||
#undef HAVE_FCHMOD
|
||||
#endif
|
||||
|
||||
#ifdef LINUX
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
|
@ -88,8 +84,8 @@ mkdirs(char *path, mode_t mode)
|
|||
char * cp;
|
||||
int rv;
|
||||
struct stat sb;
|
||||
|
||||
if (!path || !path[0])
|
||||
|
||||
if (!path || !path[0])
|
||||
fail("Null pointer or empty string passed to mkdirs()");
|
||||
while (*path == '/' && path[1] == '/')
|
||||
path++;
|
||||
|
|
@ -107,7 +103,7 @@ mkdirs(char *path, mode_t mode)
|
|||
if (errno != EEXIST)
|
||||
fail("mkdirs cannot make %s", path);
|
||||
fprintf(stderr, "directory creation race: %s\n", path);
|
||||
if (!stat(path, &sb) && S_ISDIR(sb.st_mode))
|
||||
if (!stat(path, &sb) && S_ISDIR(sb.st_mode))
|
||||
rv = 0;
|
||||
}
|
||||
return rv;
|
||||
|
|
@ -120,7 +116,7 @@ touid(char *owner)
|
|||
uid_t uid;
|
||||
char *cp;
|
||||
|
||||
if (!owner || !owner[0])
|
||||
if (!owner || !owner[0])
|
||||
fail("Null pointer or empty string passed to touid()");
|
||||
pw = getpwnam(owner);
|
||||
if (pw)
|
||||
|
|
@ -138,7 +134,7 @@ togid(char *group)
|
|||
gid_t gid;
|
||||
char *cp;
|
||||
|
||||
if (!group || !group[0])
|
||||
if (!group || !group[0])
|
||||
fail("Null pointer or empty string passed to togid()");
|
||||
gr = getgrnam(group);
|
||||
if (gr)
|
||||
|
|
@ -259,8 +255,9 @@ main(int argc, char **argv)
|
|||
len = strlen(name);
|
||||
base = xbasename(name);
|
||||
bnlen = strlen(base);
|
||||
toname = (char*)xmalloc(tdlen + 1 + bnlen + 1);
|
||||
sprintf(toname, "%s/%s", todir, base);
|
||||
size_t toname_len = tdlen + 1 + bnlen + 1;
|
||||
toname = (char*)xmalloc(toname_len);
|
||||
snprintf(toname, toname_len, "%s/%s", todir, base);
|
||||
retry:
|
||||
exists = (lstat(toname, &tosb) == 0);
|
||||
|
||||
|
|
@ -274,7 +271,7 @@ retry:
|
|||
}
|
||||
if (!exists && mkdir(toname, mode) < 0) {
|
||||
/* we probably have two nsinstall programs in a race here. */
|
||||
if (errno == EEXIST && !stat(toname, &sb) &&
|
||||
if (errno == EEXIST && !stat(toname, &sb) &&
|
||||
S_ISDIR(sb.st_mode)) {
|
||||
fprintf(stderr, "directory creation race: %s\n", toname);
|
||||
goto retry;
|
||||
|
|
@ -292,7 +289,7 @@ retry:
|
|||
/* -L implies -l and prefixes names with a $cwd arg. */
|
||||
len += lplen + 1;
|
||||
linkname = (char*)xmalloc(len + 1);
|
||||
sprintf(linkname, "%s/%s", linkprefix, name);
|
||||
snprintf(linkname, len+1, "%s/%s", linkprefix, name);
|
||||
} else if (dorelsymlink) {
|
||||
/* Symlink the relative path from todir to source name. */
|
||||
linkname = (char*)xmalloc(PATH_MAX);
|
||||
|
|
@ -348,7 +345,7 @@ retry:
|
|||
fromfd = open(name, O_RDONLY);
|
||||
if (fromfd < 0 || fstat(fromfd, &sb) < 0)
|
||||
fail("cannot access %s", name);
|
||||
if (exists &&
|
||||
if (exists &&
|
||||
(!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0)) {
|
||||
int rmrv;
|
||||
rmrv = (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ fail(char *format, ...)
|
|||
fprintf(stderr, ": %s", strerror(errno));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
putc('\n', stderr);
|
||||
abort();
|
||||
exit(1);
|
||||
|
|
@ -123,7 +123,7 @@ xmalloc(size_t size)
|
|||
char *
|
||||
xstrdup(char *s)
|
||||
{
|
||||
if (!s || !s[0])
|
||||
if (!s || !s[0])
|
||||
fail("Null pointer or empty string passed to xstrdup()");
|
||||
return strcpy((char*)xmalloc(strlen(s) + 1), s);
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ xbasename(char *path)
|
|||
{
|
||||
char *cp;
|
||||
|
||||
if (!path || !path[0])
|
||||
if (!path || !path[0])
|
||||
fail("Null pointer or empty string passed to xbasename()");
|
||||
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
|
||||
*cp = '\0';
|
||||
|
|
@ -144,7 +144,7 @@ xbasename(char *path)
|
|||
void
|
||||
xchdir(char *dir)
|
||||
{
|
||||
if (!dir || !dir[0])
|
||||
if (!dir || !dir[0])
|
||||
fail("Null pointer or empty string passed to xchdir()");
|
||||
if (chdir(dir) < 0)
|
||||
fail("cannot change directory to %s", dir);
|
||||
|
|
@ -181,7 +181,7 @@ relatepaths(char *from, char *to, char *outpath)
|
|||
len += 3;
|
||||
}
|
||||
while ((cp = getcomponent(cp, buf)) != 0) {
|
||||
sprintf(outpath + len, "%s/", buf);
|
||||
snprintf(outpath + len, PATH_MAX - len, "%s/", buf);
|
||||
len += strlen(outpath + len);
|
||||
}
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ diagnosePath(const char * path)
|
|||
struct stat sb;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
if (!path || !path[0])
|
||||
if (!path || !path[0])
|
||||
fail("Null pointer or empty string passed to mkdirs()");
|
||||
myPath = strdup(path);
|
||||
if (!myPath)
|
||||
|
|
|
|||
0
security/nss/coreconf/nspr.sh
Normal file → Executable file
0
security/nss/coreconf/nspr.sh
Normal file → Executable file
|
|
@ -1,39 +0,0 @@
|
|||
#!/usr/local/bin/perl
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#Input: [-d dir] foo1.java foo2.java
|
||||
#Compares with: foo1.class foo2.class (if -d specified, checks in 'dir',
|
||||
# otherwise assumes .class files in same directory as .java files)
|
||||
#Returns: list of input arguments which are newer than corresponding class
|
||||
#files (non-existent class files are considered to be real old :-)
|
||||
|
||||
$found = 1;
|
||||
|
||||
if ($ARGV[0] eq '-d') {
|
||||
$classdir = $ARGV[1];
|
||||
$classdir .= "/";
|
||||
shift;
|
||||
shift;
|
||||
} else {
|
||||
$classdir = "./";
|
||||
}
|
||||
|
||||
foreach $filename (@ARGV) {
|
||||
$classfilename = $classdir;
|
||||
$classfilename .= $filename;
|
||||
$classfilename =~ s/.java$/.class/;
|
||||
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
|
||||
$ctime,$blksize,$blocks) = stat($filename);
|
||||
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime,
|
||||
$ctime,$blksize,$blocks) = stat($classfilename);
|
||||
# print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n";
|
||||
if ($mtime > $classmtime) {
|
||||
print $filename, " ";
|
||||
$found = 0;
|
||||
}
|
||||
}
|
||||
|
||||
print "\n";
|
||||
0
security/nss/coreconf/precommit.clang-format.sh
Normal file → Executable file
0
security/nss/coreconf/precommit.clang-format.sh
Normal file → Executable file
|
|
@ -1,112 +0,0 @@
|
|||
#! /usr/local/bin/perl
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
require('coreconf.pl');
|
||||
|
||||
#######-- read in variables on command line into %var
|
||||
|
||||
$use_jar = 1;
|
||||
$ZIP = "$ENV{JAVA_HOME}/bin/jar";
|
||||
|
||||
if ( $ENV{JAVA_HOME} eq "" ) {
|
||||
$ZIP = "zip";
|
||||
$use_jar = 0;
|
||||
}
|
||||
|
||||
|
||||
&parse_argv;
|
||||
|
||||
|
||||
######-- Do the packaging of jars.
|
||||
|
||||
foreach $jarfile (split(/ /,$var{FILES}) ) {
|
||||
print STDERR "---------------------------------------------\n";
|
||||
print STDERR "Packaging jar file $jarfile....\n";
|
||||
|
||||
$jarinfo = $var{$jarfile};
|
||||
|
||||
($jardir,$jaropts) = split(/\|/,$jarinfo);
|
||||
|
||||
if ( $use_jar ) {
|
||||
$zipoptions = "-cvf";
|
||||
} else {
|
||||
$zipoptions = "-T -r";
|
||||
if ($jaropts =~ /a/) {
|
||||
if ($var{OS_ARCH} eq 'WINNT') {
|
||||
$zipoptions .= ' -ll';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# just in case the directory ends in a /, remove it
|
||||
if ($jardir =~ /\/$/) {
|
||||
chop $jardir;
|
||||
}
|
||||
|
||||
$dirdepth --;
|
||||
|
||||
print STDERR "jardir = $jardir\n";
|
||||
system("ls $jardir");
|
||||
|
||||
if (-d $jardir) {
|
||||
|
||||
|
||||
# count the number of slashes
|
||||
|
||||
$slashes =0;
|
||||
|
||||
foreach $i (split(//,$jardir)) {
|
||||
if ($i =~ /\//) {
|
||||
$slashes++;
|
||||
}
|
||||
}
|
||||
|
||||
$dotdots =0;
|
||||
|
||||
foreach $i (split(m|/|,$jardir)) {
|
||||
if ($i eq '..') {
|
||||
$dotdots ++;
|
||||
}
|
||||
}
|
||||
|
||||
$dirdepth = ($slashes +1) - (2*$dotdots);
|
||||
|
||||
print STDERR "changing dir $jardir\n";
|
||||
chdir($jardir);
|
||||
print STDERR "making dir META-INF\n";
|
||||
mkdir("META-INF",0755);
|
||||
|
||||
$filelist = "";
|
||||
opendir(DIR,".");
|
||||
while ($_ = readdir(DIR)) {
|
||||
if (! ( ($_ eq '.') || ($_ eq '..'))) {
|
||||
if ( $jaropts =~ /i/) {
|
||||
if (! /^include$/) {
|
||||
$filelist .= "$_ ";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$filelist .= "$_ ";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
|
||||
print STDERR "$ZIP $zipoptions $jarfile $filelist\n";
|
||||
system("$ZIP $zipoptions $jarfile $filelist");
|
||||
rmdir("META-INF");
|
||||
for $i (1 .. $dirdepth) {
|
||||
chdir("..");
|
||||
print STDERR "chdir ..\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
print STDERR "Directory $jardir doesn't exist\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -10,73 +10,55 @@
|
|||
#######################################################################
|
||||
|
||||
#######################################################################
|
||||
# Double-Colon rules for utilizing the binary release model. #
|
||||
# Dont't use double-colon rules! #
|
||||
#######################################################################
|
||||
|
||||
all:: export libs
|
||||
|
||||
ifeq ($(AUTOCLEAN),1)
|
||||
autobuild:: clean export private_export libs program install
|
||||
else
|
||||
autobuild:: export private_export libs program install
|
||||
ifndef HAVE_ALL_TARGET
|
||||
all: libs
|
||||
endif
|
||||
|
||||
platform::
|
||||
autobuild:
|
||||
ifeq ($(AUTOCLEAN),1)
|
||||
$(MAKE) clean
|
||||
endif
|
||||
$(MAKE) all
|
||||
$(MAKE) install
|
||||
|
||||
platform:
|
||||
@echo $(OBJDIR_NAME)
|
||||
|
||||
ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
|
||||
USE_NT_C_SYNTAX=1
|
||||
endif
|
||||
|
||||
#
|
||||
# IMPORTS will always be associated with a component. Therefore,
|
||||
# the "import" rule will always change directory to the top-level
|
||||
# of a component, and traverse the IMPORTS keyword from the
|
||||
# "manifest.mn" file located at this level only.
|
||||
#
|
||||
# note: if there is a trailing slash, the component will be appended
|
||||
# (see import.pl - only used for xpheader.jar)
|
||||
|
||||
import::
|
||||
@echo "== import.pl =="
|
||||
@$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/import.pl \
|
||||
"RELEASE_TREE=$(RELEASE_TREE)" \
|
||||
"IMPORTS=$(IMPORTS)" \
|
||||
"VERSION=$(VERSION)" \
|
||||
"OS_ARCH=$(OS_ARCH)" \
|
||||
"PLATFORM=$(PLATFORM)" \
|
||||
"OVERRIDE_IMPORT_CHECK=$(OVERRIDE_IMPORT_CHECK)" \
|
||||
"ALLOW_VERSION_OVERRIDE=$(ALLOW_VERSION_OVERRIDE)" \
|
||||
"SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)" \
|
||||
"SOURCE_MD_DIR=$(SOURCE_MD_DIR)" \
|
||||
"SOURCE_XP_DIR=$(SOURCE_XP_DIR)" \
|
||||
"FILES=$(IMPORT_XPCLASS_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \
|
||||
"$(IMPORT_XPCLASS_JAR)=$(IMPORT_XP_DIR)|$(IMPORT_XPCLASS_DIR)|" \
|
||||
"$(XPHEADER_JAR)=$(IMPORT_XP_DIR)|$(SOURCE_XP_DIR)/public/|v" \
|
||||
"$(MDHEADER_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)/include|" \
|
||||
"$(MDBINARY_JAR)=$(IMPORT_MD_DIR)|$(SOURCE_MD_DIR)|"
|
||||
# On Mac OS X ranlib needs to be rerun after static libs are moved.
|
||||
ifeq ($(OS_TARGET),Darwin)
|
||||
find $(SOURCE_MD_DIR)/lib -name "*.a" -exec $(RANLIB) {} \;
|
||||
# For whatever reason, "." can't be handled using make conditionals.
|
||||
# Based on automake's SUBDIRS "." handling.
|
||||
ifdef DIRS
|
||||
ifndef IGNORE_DIRS
|
||||
ifneq (,$(filter .,$(DIRS)))
|
||||
TARGETS = $(NULL)
|
||||
ALL_TRASH = $(NULL)
|
||||
endif
|
||||
|
||||
export::
|
||||
+$(LOOP_OVER_DIRS)
|
||||
$(DIRS):
|
||||
$(IGNORE_ERROR)@if [ "$@" != "." ]; then \
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS) ; \
|
||||
else \
|
||||
IGNORE_DIRS=1 $(MAKE) -C $@ $(MAKECMDGOALS) ; \
|
||||
fi
|
||||
@$(CLICK_STOPWATCH)
|
||||
endif
|
||||
endif
|
||||
|
||||
private_export::
|
||||
+$(LOOP_OVER_DIRS)
|
||||
export: $(DIRS) private_export
|
||||
|
||||
release_export::
|
||||
+$(LOOP_OVER_DIRS)
|
||||
release_export: $(DIRS)
|
||||
|
||||
release_classes::
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
libs program install:: $(TARGETS)
|
||||
ifdef LIBRARY
|
||||
libs program install: $(DIRS) $(TARGETS)
|
||||
ifneq ($(LIBRARY),)
|
||||
$(INSTALL) -m 664 $(LIBRARY) $(SOURCE_LIB_DIR)
|
||||
endif
|
||||
ifdef SHARED_LIBRARY
|
||||
ifneq ($(SHARED_LIBRARY),)
|
||||
$(INSTALL) -m 775 $(SHARED_LIBRARY) $(SOURCE_LIB_DIR)
|
||||
ifdef MOZ_DEBUG_SYMBOLS
|
||||
ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
|
||||
|
|
@ -84,10 +66,10 @@ ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
|
|||
endif
|
||||
endif
|
||||
endif
|
||||
ifdef IMPORT_LIBRARY
|
||||
ifneq ($(IMPORT_LIBRARY),)
|
||||
$(INSTALL) -m 775 $(IMPORT_LIBRARY) $(SOURCE_LIB_DIR)
|
||||
endif
|
||||
ifdef PROGRAM
|
||||
ifneq ($(PROGRAM),)
|
||||
$(INSTALL) -m 775 $(PROGRAM) $(SOURCE_BIN_DIR)
|
||||
ifdef MOZ_DEBUG_SYMBOLS
|
||||
ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
|
||||
|
|
@ -95,115 +77,24 @@ ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
|
|||
endif
|
||||
endif
|
||||
endif
|
||||
ifdef PROGRAMS
|
||||
ifneq ($(PROGRAMS),)
|
||||
$(INSTALL) -m 775 $(PROGRAMS) $(SOURCE_BIN_DIR)
|
||||
endif
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
tests::
|
||||
+$(LOOP_OVER_DIRS)
|
||||
check: $(DIRS)
|
||||
|
||||
clean clobber::
|
||||
clean clobber: $(DIRS)
|
||||
ifneq (,$(ALL_TRASH))
|
||||
rm -rf $(ALL_TRASH)
|
||||
+$(LOOP_OVER_DIRS)
|
||||
endif
|
||||
|
||||
realclean clobber_all::
|
||||
realclean clobber_all: $(DIRS)
|
||||
rm -rf $(wildcard *.OBJ) dist $(ALL_TRASH)
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
#######################################################################
|
||||
# Double-Colon rules for populating the binary release model. #
|
||||
#######################################################################
|
||||
|
||||
|
||||
release_clean::
|
||||
release_clean:
|
||||
rm -rf $(SOURCE_XP_DIR)/release/$(RELEASE_MD_DIR)
|
||||
|
||||
release:: release_clean release_export release_classes release_policy release_md release_jars release_cpdistdir
|
||||
|
||||
release_cpdistdir::
|
||||
@echo "== cpdist.pl =="
|
||||
@$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/cpdist.pl \
|
||||
"RELEASE_TREE=$(RELEASE_TREE)" \
|
||||
"CORE_DEPTH=$(CORE_DEPTH)" \
|
||||
"MODULE=${MODULE}" \
|
||||
"OS_ARCH=$(OS_ARCH)" \
|
||||
"RELEASE=$(RELEASE)" \
|
||||
"PLATFORM=$(PLATFORM)" \
|
||||
"RELEASE_VERSION=$(RELEASE_VERSION)" \
|
||||
"SOURCE_RELEASE_PREFIX=$(SOURCE_RELEASE_XP_DIR)" \
|
||||
"RELEASE_XP_DIR=$(RELEASE_XP_DIR)" \
|
||||
"RELEASE_MD_DIR=$(RELEASE_MD_DIR)" \
|
||||
"FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR) XP_FILES MD_FILES" \
|
||||
"$(XPCLASS_JAR)=$(SOURCE_RELEASE_CLASSES_DIR)|x"\
|
||||
"$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_CLASSES_DBG_DIR)|x"\
|
||||
"$(XPHEADER_JAR)=$(SOURCE_RELEASE_XPHEADERS_DIR)|x" \
|
||||
"$(MDHEADER_JAR)=$(SOURCE_RELEASE_MDHEADERS_DIR)|m" \
|
||||
"$(MDBINARY_JAR)=$(SOURCE_RELEASE_MD_DIR)|m" \
|
||||
"XP_FILES=$(XP_FILES)|xf" \
|
||||
"MD_FILES=$(MD_FILES)|mf"
|
||||
|
||||
|
||||
# $(SOURCE_RELEASE_xxx_JAR) is a name like yyy.jar
|
||||
# $(SOURCE_RELEASE_xx_DIR) is a name like
|
||||
|
||||
release_jars::
|
||||
@echo "== release.pl =="
|
||||
@$(PERL) -I$(CORE_DEPTH)/coreconf $(CORE_DEPTH)/coreconf/release.pl \
|
||||
"RELEASE_TREE=$(RELEASE_TREE)" \
|
||||
"PLATFORM=$(PLATFORM)" \
|
||||
"OS_ARCH=$(OS_ARCH)" \
|
||||
"RELEASE_VERSION=$(RELEASE_VERSION)" \
|
||||
"SOURCE_RELEASE_DIR=$(SOURCE_RELEASE_DIR)" \
|
||||
"FILES=$(XPCLASS_JAR) $(XPCLASS_DBG_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \
|
||||
"$(XPCLASS_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DIR)|b"\
|
||||
"$(XPCLASS_DBG_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DBG_DIR)|b"\
|
||||
"$(XPHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_XPHEADERS_DIR)|a" \
|
||||
"$(MDHEADER_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MDHEADERS_DIR)|a" \
|
||||
"$(MDBINARY_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_MD_DIR)|bi"
|
||||
|
||||
# Rules for releasing classes.
|
||||
# We have to do some REALLY gross stuff to deal with multiple classes in one
|
||||
# file, as well as nested classes, which have a filename of the form
|
||||
# ContainingClass$NestedClass.class.
|
||||
# RELEASE_CLASSES simply performs a required patsubst on CLASSES
|
||||
# RELEASE_CLASS_PATH is RELEASE_CLASSES with the path (in ns/dist) prepended
|
||||
# RELEASE_NESTED is all the nested classes in RELEASE_CLASS_PATH. We use a
|
||||
# foreach and wildcard to get all the files that start out like one of the
|
||||
# class files, then have a $. So, for each class file, we look for file$*
|
||||
# RELEASE_FILES is the combination of RELEASE_NESTED and the class files
|
||||
# specified by RELEASE_CLASSES which have .class appended to them. Note that
|
||||
# the RELEASE_NESTED don't need to have .class appended because they were
|
||||
# read in from the wildcard as complete filenames.
|
||||
#
|
||||
# The _DBG versions are the debuggable ones.
|
||||
ifneq ($(CLASSES),)
|
||||
|
||||
RELEASE_CLASSES := $(patsubst %,%,$(CLASSES))
|
||||
|
||||
ifdef BUILD_OPT
|
||||
RELEASE_CLASS_PATH := $(patsubst %,$(SOURCE_CLASSES_DIR)/$(PACKAGE)/%, $(RELEASE_CLASSES))
|
||||
RELEASE_NESTED := $(foreach file,$(RELEASE_CLASS_PATH),$(wildcard $(file)$$*))
|
||||
RELEASE_FILES := $(patsubst %,%.class,$(RELEASE_CLASS_PATH)) $(RELEASE_NESTED)
|
||||
else
|
||||
RELEASE_DBG_CLASS_PATH:= $(patsubst %,$(SOURCE_CLASSES_DBG_DIR)/$(PACKAGE)/%, $(RELEASE_CLASSES))
|
||||
RELEASE_DBG_NESTED := $(foreach file,$(RELEASE_DBG_CLASS_PATH),$(wildcard $(file)$$*))
|
||||
RELEASE_DBG_FILES := $(patsubst %,%.class,$(RELEASE_DBG_CLASS_PATH)) $(RELEASE_DBG_NESTED)
|
||||
endif
|
||||
|
||||
# Substitute \$ for $ so the shell doesn't choke
|
||||
ifdef BUILD_OPT
|
||||
release_classes::
|
||||
$(INSTALL) -m 444 $(subst $$,\$$,$(RELEASE_FILES)) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DIR)/$(PACKAGE)
|
||||
else
|
||||
release_classes::
|
||||
$(INSTALL) -m 444 $(subst $$,\$$,$(RELEASE_DBG_FILES)) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_DBG_DIR)/$(PACKAGE)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
release_policy::
|
||||
+$(LOOP_OVER_DIRS)
|
||||
release: release_clean release_export release_md
|
||||
|
||||
ifndef NO_MD_RELEASE
|
||||
ifdef LIBRARY
|
||||
|
|
@ -223,40 +114,64 @@ ifndef NO_MD_RELEASE
|
|||
endif
|
||||
endif
|
||||
|
||||
release_md::
|
||||
release_md:: $(DIRS)
|
||||
ifneq ($(MD_LIB_RELEASE_FILES),)
|
||||
$(INSTALL) -m 444 $(MD_LIB_RELEASE_FILES) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR)
|
||||
endif
|
||||
ifneq ($(MD_BIN_RELEASE_FILES),)
|
||||
$(INSTALL) -m 555 $(MD_BIN_RELEASE_FILES) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_BIN_DIR)
|
||||
endif
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
|
||||
alltags:
|
||||
rm -f TAGS
|
||||
find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
|
||||
find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs ctags -a
|
||||
|
||||
$(PROGRAM): $(OBJS) $(EXTRA_LIBS)
|
||||
.SECONDEXPANSION:
|
||||
%/d:
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
|
||||
$(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(XLDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
|
||||
|
||||
define PROGRAM_template
|
||||
|
||||
ifndef $(1)_OBJS
|
||||
ifdef LIBRARY_NAME
|
||||
$(1)_OBJS := $$(patsubst $$(PROG_PREFIX)%,%,$$(patsubst %$$(PROG_SUFFIX),%,$(1)))$$(OBJ_SUFFIX)
|
||||
endif
|
||||
ifdef PROGRAMS
|
||||
$(1)_OBJS := $$(patsubst $$(PROG_PREFIX)%,%,$$(patsubst %$$(PROG_SUFFIX),%,$(1)))$$(OBJ_SUFFIX)
|
||||
endif
|
||||
ifndef $(1)_OBJS
|
||||
$(1)_OBJS := $$(OBJS)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(1): $$($(1)_OBJS) $$(EXTRA_LIBS) | $$$$(@D)/d
|
||||
rm -f $$@
|
||||
ifeq (,$$(filter-out _WIN%,$$(NS_USE_GCC)_$$(OS_TARGET)))
|
||||
$$(MKPROG) $$($(1)_OBJS) -Fe$$@ -link $$(LDFLAGS) $$(XLDFLAGS) $$(EXTRA_LIBS) $$(EXTRA_SHARED_LIBS) $$(OS_LIBS)
|
||||
ifdef MT
|
||||
if test -f $@.manifest; then \
|
||||
$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
rm -f $@.manifest; \
|
||||
if test -f $$@.manifest; then \
|
||||
$$(MT) -NOLOGO -MANIFEST $$@.manifest -OUTPUTRESOURCE:$$@\;1; \
|
||||
rm -f $$@.manifest; \
|
||||
fi
|
||||
endif # MSVC with manifest tool
|
||||
else
|
||||
$(MKPROG) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
|
||||
$$(MKPROG) -o $$@ $$(CFLAGS) $$($(1)_OBJS) $$(LDFLAGS) $$(EXTRA_LIBS) $$(EXTRA_SHARED_LIBS) $$(OS_LIBS)
|
||||
endif
|
||||
endef # PROGRAM_template
|
||||
|
||||
ifdef PROGRAM
|
||||
$(eval $(call PROGRAM_template,$(PROGRAM)))
|
||||
else
|
||||
ifdef PROGRAMS
|
||||
$(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog))))
|
||||
endif
|
||||
endif
|
||||
|
||||
get_objs:
|
||||
@echo $(OBJS)
|
||||
|
||||
$(LIBRARY): $(OBJS)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(LIBRARY): $(OBJS) | $$(@D)/d
|
||||
rm -f $@
|
||||
ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
|
||||
$(AR) $(subst /,\\,$(OBJS))
|
||||
|
|
@ -273,8 +188,7 @@ $(IMPORT_LIBRARY): $(MAPFILE)
|
|||
$(RANLIB) $@
|
||||
endif
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
$(IMPORT_LIBRARY): $(LIBRARY)
|
||||
cp -f $< $@
|
||||
$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
|
||||
endif
|
||||
|
||||
ifdef SHARED_LIBRARY_LIBS
|
||||
|
|
@ -285,8 +199,7 @@ SUB_SHLOBJS = $(foreach dir,$(SHARED_LIBRARY_DIRS),$(addprefix $(dir)/,$(shell $
|
|||
endif
|
||||
endif
|
||||
|
||||
$(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE) $(SUB_SHLOBJS)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE) $(SUB_SHLOBJS) | $$(@D)/d
|
||||
rm -f $@
|
||||
ifeq ($(OS_TARGET)$(OS_RELEASE), AIX4.1)
|
||||
echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms
|
||||
|
|
@ -316,8 +229,7 @@ endif
|
|||
endif
|
||||
|
||||
ifeq (,$(filter-out WIN%,$(OS_TARGET)))
|
||||
$(RES): $(RESNAME)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(RES): $(RESNAME) | $$(@D)/d
|
||||
# The resource compiler does not understand the -U option.
|
||||
ifdef NS_USE_GCC
|
||||
$(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) -o $@ $<
|
||||
|
|
@ -327,27 +239,9 @@ endif
|
|||
@echo $(RES) finished
|
||||
endif
|
||||
|
||||
$(MAPFILE): $(MAPFILE_SOURCE)
|
||||
@$(MAKE_OBJDIR)
|
||||
$(MAPFILE): $(MAPFILE_SOURCE) | $$(@D)/d
|
||||
$(PROCESS_MAP_FILE)
|
||||
|
||||
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(PROG_SUFFIX): $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX)
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
|
||||
$(MKPROG) $< -Fe$@ -link \
|
||||
$(LDFLAGS) $(XLDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
|
||||
ifdef MT
|
||||
if test -f $@.manifest; then \
|
||||
$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
rm -f $@.manifest; \
|
||||
fi
|
||||
endif # MSVC with manifest tool
|
||||
else
|
||||
$(MKPROG) -o $@ $(CFLAGS) $< \
|
||||
$(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
|
||||
endif
|
||||
|
||||
WCCFLAGS1 := $(subst /,\\,$(CFLAGS))
|
||||
WCCFLAGS2 := $(subst -I,-i=,$(WCCFLAGS1))
|
||||
WCCFLAGS3 := $(subst -D,-d,$(WCCFLAGS2))
|
||||
|
|
@ -388,8 +282,7 @@ endif
|
|||
# The quotes allow absolute paths to contain spaces.
|
||||
core_abspath = '$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))'
|
||||
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
|
||||
@$(MAKE_OBJDIR)
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c | $$(@D)/d
|
||||
ifdef USE_NT_C_SYNTAX
|
||||
$(CC) -Fo$@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
|
||||
else
|
||||
|
|
@ -400,7 +293,7 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
|
||||
$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c | $$(@D)/d
|
||||
ifdef USE_NT_C_SYNTAX
|
||||
$(CC) -Fo$@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
|
||||
else
|
||||
|
|
@ -412,21 +305,17 @@ endif
|
|||
endif
|
||||
|
||||
ifneq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.s
|
||||
@$(MAKE_OBJDIR)
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.s | $$(@D)/d
|
||||
$(AS) -o $@ $(ASFLAGS) -c $<
|
||||
endif
|
||||
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.asm
|
||||
@$(MAKE_OBJDIR)
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.asm | $$(@D)/d
|
||||
$(AS) -Fo$@ $(ASFLAGS) -c $<
|
||||
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.S
|
||||
@$(MAKE_OBJDIR)
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.S | $$(@D)/d
|
||||
$(AS) -o $@ $(ASFLAGS) -c $<
|
||||
|
||||
$(OBJDIR)/$(PROG_PREFIX)%: %.cpp
|
||||
@$(MAKE_OBJDIR)
|
||||
$(OBJDIR)/$(PROG_PREFIX)%: %.cpp | $$(@D)/d
|
||||
ifdef USE_NT_C_SYNTAX
|
||||
$(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||
else
|
||||
|
|
@ -437,44 +326,28 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Please keep the next two rules in sync.
|
||||
#
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cc
|
||||
$(MAKE_OBJDIR)
|
||||
ifdef STRICT_CPLUSPLUS_SUFFIX
|
||||
echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
|
||||
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
|
||||
rm -f $(OBJDIR)/t_$*.cc
|
||||
else
|
||||
ifdef USE_NT_C_SYNTAX
|
||||
$(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||
else
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||
else
|
||||
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $<
|
||||
endif
|
||||
endif
|
||||
endif #STRICT_CPLUSPLUS_SUFFIX
|
||||
define compile_ccc_pattern_RULE
|
||||
|
||||
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cpp
|
||||
@$(MAKE_OBJDIR)
|
||||
$$(OBJDIR)/$$(PROG_PREFIX)%$$(OBJ_SUFFIX): %.$(1) | $$$$(@D)/d
|
||||
ifdef STRICT_CPLUSPLUS_SUFFIX
|
||||
echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
|
||||
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
|
||||
rm -f $(OBJDIR)/t_$*.cc
|
||||
echo "#line 1 \"$$<\"" | cat - $$< > $$(OBJDIR)/t_$$*.cc
|
||||
$$(CCC) -o $$@ -c $$(CXXSTD) $$(CFLAGS) $$(CXXFLAGS) $$(OBJDIR)/t_$$*.cc
|
||||
rm -f $$(OBJDIR)/t_$$*.cc
|
||||
else
|
||||
ifdef USE_NT_C_SYNTAX
|
||||
$(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||
$$(CCC) -Fo$$@ -c $$(CXXSTD) $$(CFLAGS) $$(CXXFLAGS) $$(call core_abspath,$$<)
|
||||
else
|
||||
ifdef NEED_ABSOLUTE_PATH
|
||||
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
|
||||
$$(CCC) -o $$@ -c $$(CXXSTD) $$(CFLAGS) $$(CXXFLAGS) $$(call core_abspath,$$<)
|
||||
else
|
||||
$(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $<
|
||||
$$(CCC) -o $$@ -c $$(CXXSTD) $$(CFLAGS) $$(CXXFLAGS) $$<
|
||||
endif
|
||||
endif
|
||||
endif #STRICT_CPLUSPLUS_SUFFIX
|
||||
endef # compile_ccc_pattern_RULE
|
||||
|
||||
$(eval $(call compile_ccc_pattern_RULE,cc))
|
||||
$(eval $(call compile_ccc_pattern_RULE,cpp))
|
||||
|
||||
%.i: %.cpp
|
||||
$(CCC) -C -E $(CFLAGS) $(CXXFLAGS) $< > $@
|
||||
|
|
@ -497,304 +370,26 @@ endif
|
|||
%: %.sh
|
||||
rm -f $@; cp $< $@; chmod +x $@
|
||||
|
||||
################################################################################
|
||||
# Bunch of things that extend the 'export' rule (in order):
|
||||
################################################################################
|
||||
define copy_varlist_into_dir_RULE
|
||||
ifdef $(2)
|
||||
ifneq (,$$(strip $$($(2))))
|
||||
$(3)/%: %
|
||||
$$(INSTALL) -m 444 $$^ $(3)
|
||||
|
||||
$(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) $(JMCSRCDIR)::
|
||||
@if test ! -d $@; then \
|
||||
echo Creating $@; \
|
||||
rm -rf $@; \
|
||||
$(NSINSTALL) -D $@; \
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
## IDL_GEN
|
||||
|
||||
ifneq ($(IDL_GEN),)
|
||||
|
||||
#export::
|
||||
# $(IDL2JAVA) $(IDL_GEN)
|
||||
|
||||
#all:: export
|
||||
|
||||
#clobber::
|
||||
# rm -f $(IDL_GEN:.idl=.class) # XXX wrong!
|
||||
$(1): $$(addprefix $(3)/,$$($(2))) | $(3)/d
|
||||
|
||||
.NOTPARALLEL: $(1)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
### JSRCS -- for compiling java files
|
||||
###
|
||||
### NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
|
||||
### replace $(CORE_DEPTH) with $(NETLIBDEPTH).
|
||||
###
|
||||
|
||||
ifneq ($(JSRCS),)
|
||||
ifneq ($(JAVAC),)
|
||||
ifdef NETLIBDEPTH
|
||||
CORE_DEPTH := $(NETLIBDEPTH)
|
||||
endif
|
||||
|
||||
JAVA_EXPORT_SRCS=$(shell $(PERL) $(CORE_DEPTH)/coreconf/outofdate.pl $(PERLARG) -d $(JAVA_DESTPATH)/$(PACKAGE) $(JSRCS) $(PRIVATE_JSRCS))
|
||||
|
||||
export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
|
||||
ifneq ($(JAVA_EXPORT_SRCS),)
|
||||
$(JAVAC) $(JAVA_EXPORT_SRCS)
|
||||
endif
|
||||
|
||||
all:: export
|
||||
|
||||
clobber::
|
||||
rm -f $(SOURCE_XP_DIR)/classes/$(PACKAGE)/*.class
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# JDIRS -- like JSRCS, except you can give a list of directories and it will
|
||||
# compile all the out-of-date java files in those directories.
|
||||
#
|
||||
# NOTE: recursing through these can speed things up, but they also cause
|
||||
# some builds to run out of memory
|
||||
#
|
||||
# NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
|
||||
# replace $(CORE_DEPTH) with $(NETLIBDEPTH).
|
||||
#
|
||||
ifdef JDIRS
|
||||
ifneq ($(JAVAC),)
|
||||
ifdef NETLIBDEPTH
|
||||
CORE_DEPTH := $(NETLIBDEPTH)
|
||||
endif
|
||||
|
||||
# !!!!! THIS WILL CRASH SHMSDOS.EXE !!!!!
|
||||
# shmsdos does not support shell variables. It will crash when it tries
|
||||
# to parse the '=' character. A solution is to rewrite outofdate.pl so it
|
||||
# takes the Javac command as an argument and executes the command itself,
|
||||
# instead of returning a list of files.
|
||||
export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
|
||||
@echo "!!! THIS COMMAND IS BROKEN ON WINDOWS--SEE rules.mk FOR DETAILS !!!"
|
||||
return -1
|
||||
@for d in $(JDIRS); do \
|
||||
if test -d $$d; then \
|
||||
set $(EXIT_ON_ERROR); \
|
||||
files=`echo $$d/*.java`; \
|
||||
list=`$(PERL) $(CORE_DEPTH)/coreconf/outofdate.pl $(PERLARG) \
|
||||
-d $(JAVA_DESTPATH)/$(PACKAGE) $$files`; \
|
||||
if test "$${list}x" != "x"; then \
|
||||
echo Building all java files in $$d; \
|
||||
echo $(JAVAC) $$list; \
|
||||
$(JAVAC) $$list; \
|
||||
fi; \
|
||||
set +e; \
|
||||
else \
|
||||
echo "Skipping non-directory $$d..."; \
|
||||
fi; \
|
||||
$(CLICK_STOPWATCH); \
|
||||
done
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# JDK_GEN -- for generating "old style" native methods
|
||||
#
|
||||
# Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory
|
||||
#
|
||||
# NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
|
||||
# replace $(CORE_DEPTH) with $(NETLIBDEPTH).
|
||||
#
|
||||
ifneq ($(JDK_GEN),)
|
||||
ifneq ($(JAVAH),)
|
||||
ifdef NSBUILDROOT
|
||||
INCLUDES += -I$(JDK_GEN_DIR) -I$(SOURCE_XP_DIR)
|
||||
else
|
||||
INCLUDES += -I$(JDK_GEN_DIR)
|
||||
$(1):
|
||||
endif
|
||||
endef # copy_varlist_into_dir_RULE
|
||||
|
||||
ifdef NETLIBDEPTH
|
||||
CORE_DEPTH := $(NETLIBDEPTH)
|
||||
endif
|
||||
# export rule
|
||||
$(eval $(call copy_varlist_into_dir_RULE,export,EXPORTS,$(SOURCE_XPHEADERS_DIR)))
|
||||
|
||||
JDK_PACKAGE_CLASSES := $(JDK_GEN)
|
||||
JDK_PATH_CLASSES := $(subst .,/,$(JDK_PACKAGE_CLASSES))
|
||||
JDK_HEADER_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES))
|
||||
JDK_STUB_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JDK_PATH_CLASSES))
|
||||
JDK_HEADER_CFILES := $(patsubst %,$(JDK_GEN_DIR)/%.h,$(JDK_GEN))
|
||||
JDK_STUB_CFILES := $(patsubst %,$(JDK_STUB_DIR)/%.c,$(JDK_GEN))
|
||||
|
||||
$(JDK_HEADER_CFILES): $(JDK_HEADER_CLASSFILES)
|
||||
$(JDK_STUB_CFILES): $(JDK_STUB_CLASSFILES)
|
||||
|
||||
export::
|
||||
@echo Generating/Updating JDK headers
|
||||
$(JAVAH) -d $(JDK_GEN_DIR) $(JDK_PACKAGE_CLASSES)
|
||||
@echo Generating/Updating JDK stubs
|
||||
$(JAVAH) -stubs -d $(JDK_STUB_DIR) $(JDK_PACKAGE_CLASSES)
|
||||
ifndef NO_MAC_JAVA_SHIT
|
||||
@if test ! -d $(CORE_DEPTH)/lib/mac/Java/; then \
|
||||
echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \
|
||||
echo "!!! This allows us to automatically update generated files for the mac."; \
|
||||
echo "!!! If you see any modified files there, please check them in."; \
|
||||
fi
|
||||
@echo Generating/Updating JDK headers for the Mac
|
||||
$(JAVAH) -mac -d $(CORE_DEPTH)/lib/mac/Java/_gen $(JDK_PACKAGE_CLASSES)
|
||||
@echo Generating/Updating JDK stubs for the Mac
|
||||
$(JAVAH) -mac -stubs -d $(CORE_DEPTH)/lib/mac/Java/_stubs $(JDK_PACKAGE_CLASSES)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# JRI_GEN -- for generating "old style" JRI native methods
|
||||
#
|
||||
# Generate JRI Headers and Stubs into the 'jri' directory
|
||||
#
|
||||
# NOTE: For backwards compatibility, if $(NETLIBDEPTH) is defined,
|
||||
# replace $(CORE_DEPTH) with $(NETLIBDEPTH).
|
||||
#
|
||||
ifneq ($(JRI_GEN),)
|
||||
ifneq ($(JAVAH),)
|
||||
ifdef NSBUILDROOT
|
||||
INCLUDES += -I$(JRI_GEN_DIR) -I$(SOURCE_XP_DIR)
|
||||
else
|
||||
INCLUDES += -I$(JRI_GEN_DIR)
|
||||
endif
|
||||
|
||||
ifdef NETLIBDEPTH
|
||||
CORE_DEPTH := $(NETLIBDEPTH)
|
||||
endif
|
||||
|
||||
JRI_PACKAGE_CLASSES := $(JRI_GEN)
|
||||
JRI_PATH_CLASSES := $(subst .,/,$(JRI_PACKAGE_CLASSES))
|
||||
JRI_HEADER_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JRI_PATH_CLASSES))
|
||||
JRI_STUB_CLASSFILES := $(patsubst %,$(JAVA_DESTPATH)/%.class,$(JRI_PATH_CLASSES))
|
||||
JRI_HEADER_CFILES := $(patsubst %,$(JRI_GEN_DIR)/%.h,$(JRI_GEN))
|
||||
JRI_STUB_CFILES := $(patsubst %,$(JRI_GEN_DIR)/%.c,$(JRI_GEN))
|
||||
|
||||
$(JRI_HEADER_CFILES): $(JRI_HEADER_CLASSFILES)
|
||||
$(JRI_STUB_CFILES): $(JRI_STUB_CLASSFILES)
|
||||
|
||||
export::
|
||||
@echo Generating/Updating JRI headers
|
||||
$(JAVAH) -jri -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES)
|
||||
@echo Generating/Updating JRI stubs
|
||||
$(JAVAH) -jri -stubs -d $(JRI_GEN_DIR) $(JRI_PACKAGE_CLASSES)
|
||||
ifndef NO_MAC_JAVA_SHIT
|
||||
@if test ! -d $(CORE_DEPTH)/lib/mac/Java/; then \
|
||||
echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \
|
||||
echo "!!! This allows us to automatically update generated files for the mac."; \
|
||||
echo "!!! If you see any modified files there, please check them in."; \
|
||||
fi
|
||||
@echo Generating/Updating JRI headers for the Mac
|
||||
$(JAVAH) -jri -mac -d $(CORE_DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
|
||||
@echo Generating/Updating JRI stubs for the Mac
|
||||
$(JAVAH) -jri -mac -stubs -d $(CORE_DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# JNI_GEN -- for generating JNI native methods
|
||||
#
|
||||
# Generate JNI Headers into the 'jni' directory
|
||||
#
|
||||
ifneq ($(JNI_GEN),)
|
||||
ifneq ($(JAVAH),)
|
||||
JNI_HEADERS := $(patsubst %,$(JNI_GEN_DIR)/%.h,$(JNI_GEN))
|
||||
|
||||
export::
|
||||
@if test ! -d $(JNI_GEN_DIR); then \
|
||||
echo $(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_GEN); \
|
||||
$(JAVAH) -jni -d $(JNI_GEN_DIR) $(JNI_GEN); \
|
||||
else \
|
||||
echo "Checking for out of date header files" ; \
|
||||
$(PERL) $(CORE_DEPTH)/coreconf/jniregen.pl $(PERLARG) \
|
||||
-d $(JAVA_DESTPATH) -j "$(JAVAH) -jni -d $(JNI_GEN_DIR)" $(JNI_GEN);\
|
||||
fi
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# JMC_EXPORT -- for declaring which java classes are to be exported for jmc
|
||||
#
|
||||
ifneq ($(JMC_EXPORT),)
|
||||
JMC_EXPORT_PATHS := $(subst .,/,$(JMC_EXPORT))
|
||||
JMC_EXPORT_FILES := $(patsubst %,$(JAVA_DESTPATH)/$(PACKAGE)/%.class,$(JMC_EXPORT_PATHS))
|
||||
|
||||
#
|
||||
# We're doing NSINSTALL -t here (copy mode) because calling INSTALL will pick up
|
||||
# your NSDISTMODE and make links relative to the current directory. This is a
|
||||
# problem because the source isn't in the current directory:
|
||||
#
|
||||
export:: $(JMC_EXPORT_FILES) $(JMCSRCDIR)
|
||||
$(NSINSTALL) -t -m 444 $(JMC_EXPORT_FILES) $(JMCSRCDIR)
|
||||
endif
|
||||
|
||||
#
|
||||
# JMC_GEN -- for generating java modules
|
||||
#
|
||||
# Provide default export & install rules when using JMC_GEN
|
||||
#
|
||||
ifneq ($(JMC_GEN),)
|
||||
ifneq ($(JMC),)
|
||||
INCLUDES += -I$(JMC_GEN_DIR) -I.
|
||||
JMC_HEADERS := $(patsubst %,$(JMC_GEN_DIR)/%.h,$(JMC_GEN))
|
||||
JMC_STUBS := $(patsubst %,$(JMC_GEN_DIR)/%.c,$(JMC_GEN))
|
||||
JMC_OBJS := $(patsubst %,$(OBJDIR)/%$(OBJ_SUFFIX),$(JMC_GEN))
|
||||
|
||||
$(JMC_GEN_DIR)/M%.h: $(JMCSRCDIR)/%.class
|
||||
$(JMC) -d $(JMC_GEN_DIR) -interface $(JMC_GEN_FLAGS) $(?F:.class=)
|
||||
|
||||
$(JMC_GEN_DIR)/M%.c: $(JMCSRCDIR)/%.class
|
||||
$(JMC) -d $(JMC_GEN_DIR) -module $(JMC_GEN_FLAGS) $(?F:.class=)
|
||||
|
||||
$(OBJDIR)/M%$(OBJ_SUFFIX): $(JMC_GEN_DIR)/M%.c $(JMC_GEN_DIR)/M%.h
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CC) -o $@ -c $(CFLAGS) $<
|
||||
|
||||
export:: $(JMC_HEADERS) $(JMC_STUBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Copy each element of EXPORTS to $(SOURCE_XP_DIR)/public/$(MODULE)/
|
||||
#
|
||||
PUBLIC_EXPORT_DIR = $(SOURCE_XP_DIR)/public/$(MODULE)
|
||||
|
||||
ifneq ($(EXPORTS),)
|
||||
$(PUBLIC_EXPORT_DIR)::
|
||||
@if test ! -d $@; then \
|
||||
echo Creating $@; \
|
||||
$(NSINSTALL) -D $@; \
|
||||
fi
|
||||
|
||||
export:: $(PUBLIC_EXPORT_DIR)
|
||||
|
||||
export:: $(EXPORTS)
|
||||
$(INSTALL) -m 444 $^ $(PUBLIC_EXPORT_DIR)
|
||||
|
||||
export:: $(BUILT_SRCS)
|
||||
endif
|
||||
|
||||
# Duplicate export rule for private exports, with different directories
|
||||
|
||||
PRIVATE_EXPORT_DIR = $(SOURCE_XP_DIR)/private/$(MODULE)
|
||||
|
||||
ifneq ($(PRIVATE_EXPORTS),)
|
||||
$(PRIVATE_EXPORT_DIR)::
|
||||
@if test ! -d $@; then \
|
||||
echo Creating $@; \
|
||||
$(NSINSTALL) -D $@; \
|
||||
fi
|
||||
|
||||
private_export:: $(PRIVATE_EXPORT_DIR)
|
||||
|
||||
private_export:: $(PRIVATE_EXPORTS)
|
||||
$(INSTALL) -m 444 $^ $(PRIVATE_EXPORT_DIR)
|
||||
else
|
||||
private_export::
|
||||
@echo There are no private exports.;
|
||||
endif
|
||||
# private_export rule
|
||||
$(eval $(call copy_varlist_into_dir_RULE,private_export,PRIVATE_EXPORTS,$(SOURCE_XPPRIVATE_DIR)))
|
||||
|
||||
##########################################################################
|
||||
### RULES FOR RUNNING REGRESSION SUITE TESTS
|
||||
|
|
@ -810,13 +405,9 @@ ifneq ($(BUILD_OPT),)
|
|||
REGDATE = $(subst \ ,, $(shell $(PERL) $(CORE_DEPTH)/$(MODULE)/scripts/now))
|
||||
endif
|
||||
|
||||
tests:: $(REGRESSION_SPEC)
|
||||
check: $(REGRESSION_SPEC) | $(TESTS_DIR)/d
|
||||
cd $(PLATFORM); \
|
||||
../$(SOURCE_MD_DIR)/bin/regress$(PROG_SUFFIX) specfile=../$(REGRESSION_SPEC) progress $(EXTRA_REGRESS_OPTIONS); \
|
||||
if test ! -d $(TESTS_DIR); then \
|
||||
echo Creating $(TESTS_DIR); \
|
||||
$(NSINSTALL) -D $(TESTS_DIR); \
|
||||
fi
|
||||
../$(SOURCE_MD_DIR)/bin/regress$(PROG_SUFFIX) specfile=../$(REGRESSION_SPEC) progress $(EXTRA_REGRESS_OPTIONS)
|
||||
ifneq ($(BUILD_OPT),)
|
||||
$(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).sum $(TESTS_DIR); \
|
||||
$(NSINSTALL) -m 664 $(PLATFORM)/$(REGDATE).htm $(TESTS_DIR); \
|
||||
|
|
@ -824,104 +415,12 @@ ifneq ($(BUILD_OPT),)
|
|||
echo "then run 'reporter specfile=$(RESULTS_DIR)/rptspec'"
|
||||
endif
|
||||
else
|
||||
tests::
|
||||
@echo Error: you didn't specify REGRESSION_SPEC in your manifest.mn file!;
|
||||
check:
|
||||
@echo "Error: you didn't specify REGRESSION_SPEC in your manifest.mn file!"
|
||||
endif
|
||||
|
||||
|
||||
# Duplicate export rule for releases, with different directories
|
||||
|
||||
ifneq ($(EXPORTS),)
|
||||
$(SOURCE_RELEASE_XP_DIR)/include::
|
||||
@if test ! -d $@; then \
|
||||
echo Creating $@; \
|
||||
$(NSINSTALL) -D $@; \
|
||||
fi
|
||||
|
||||
release_export:: $(SOURCE_RELEASE_XP_DIR)/include
|
||||
|
||||
release_export:: $(EXPORTS)
|
||||
$(INSTALL) -m 444 $^ $(SOURCE_RELEASE_XP_DIR)/include
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
-include $(DEPENDENCIES)
|
||||
|
||||
ifneq (,$(filter-out OS2 WIN%,$(OS_TARGET)))
|
||||
# Can't use sed because of its 4000-char line length limit, so resort to perl
|
||||
PERL_DEPENDENCIES_PROGRAM = \
|
||||
open(MD, "< $(DEPENDENCIES)"); \
|
||||
while (<MD>) { \
|
||||
if (m@ \.*/*$< @) { \
|
||||
$$found = 1; \
|
||||
last; \
|
||||
} \
|
||||
} \
|
||||
if ($$found) { \
|
||||
print "Removing stale dependency $< from $(DEPENDENCIES)\n"; \
|
||||
seek(MD, 0, 0); \
|
||||
$$tmpname = "$(OBJDIR)/fix.md" . $$$$; \
|
||||
open(TMD, "> " . $$tmpname); \
|
||||
while (<MD>) { \
|
||||
s@ \.*/*$< @ @; \
|
||||
if (!print TMD "$$_") { \
|
||||
unlink(($$tmpname)); \
|
||||
exit(1); \
|
||||
} \
|
||||
} \
|
||||
close(TMD); \
|
||||
if (!rename($$tmpname, "$(DEPENDENCIES)")) { \
|
||||
unlink(($$tmpname)); \
|
||||
} \
|
||||
} elsif ("$<" ne "$(DEPENDENCIES)") { \
|
||||
print "$(MAKE): *** No rule to make target $<. Stop.\n"; \
|
||||
exit(1); \
|
||||
}
|
||||
|
||||
.DEFAULT:
|
||||
@$(PERL) -e '$(PERL_DEPENDENCIES_PROGRAM)'
|
||||
endif
|
||||
|
||||
#############################################################################
|
||||
# X dependency system
|
||||
#############################################################################
|
||||
|
||||
ifdef MKDEPENDENCIES
|
||||
|
||||
# For Windows, $(MKDEPENDENCIES) must be -included before including rules.mk
|
||||
|
||||
$(MKDEPENDENCIES)::
|
||||
@$(MAKE_OBJDIR)
|
||||
touch $(MKDEPENDENCIES)
|
||||
chmod u+w $(MKDEPENDENCIES)
|
||||
#on NT, the preceding touch command creates a read-only file !?!?!
|
||||
#which is why we have to explicitly chmod it.
|
||||
$(MKDEPEND) -p$(OBJDIR_NAME)/ -o'$(OBJ_SUFFIX)' -f$(MKDEPENDENCIES) \
|
||||
$(NOMD_CFLAGS) $(YOPT) $(CSRCS) $(CPPSRCS) $(ASFILES)
|
||||
|
||||
$(MKDEPEND):: $(MKDEPEND_DIR)/*.c $(MKDEPEND_DIR)/*.h
|
||||
$(MAKE) -C $(MKDEPEND_DIR)
|
||||
|
||||
ifdef OBJS
|
||||
depend:: $(MKDEPEND) $(MKDEPENDENCIES)
|
||||
else
|
||||
depend::
|
||||
endif
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
dependclean::
|
||||
rm -f $(MKDEPENDENCIES)
|
||||
+$(LOOP_OVER_DIRS)
|
||||
|
||||
#-include $(NSINSTALL_DIR)/$(OBJDIR)/depend.mk
|
||||
|
||||
else
|
||||
depend::
|
||||
endif
|
||||
# release_export rule
|
||||
$(eval $(call copy_varlist_into_dir_RULE,release_export,EXPORTS,$(SOURCE_RELEASE_XP_DIR)/include))
|
||||
|
||||
#
|
||||
# HACK ALERT
|
||||
|
|
@ -955,16 +454,11 @@ $(filter $(OBJDIR)/%$(OBJ_SUFFIX),$(OBJS)): $(OBJDIR)/%$(OBJ_SUFFIX): $(DUMMY_DE
|
|||
# hundreds of built-in suffix rules for stuff we don't need.
|
||||
#
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .out .a .ln .o .obj .c .cc .C .cpp .y .l .s .S .h .sh .i .pl .class .java .html .asm .dep
|
||||
|
||||
#
|
||||
# Don't delete these files if we get killed.
|
||||
#
|
||||
.PRECIOUS: .java $(JDK_HEADERS) $(JDK_STUBS) $(JRI_HEADERS) $(JRI_STUBS) $(JMC_HEADERS) $(JMC_STUBS) $(JNI_HEADERS)
|
||||
.SUFFIXES: .out .a .ln .o .obj .c .cc .C .cpp .y .l .s .S .h .sh .i .pl .html .asm .dep
|
||||
|
||||
#
|
||||
# Fake targets. Always run these rules, even if a file/directory with that
|
||||
# name already exists.
|
||||
#
|
||||
.PHONY: all all_platforms alltags boot clean clobber clobber_all export install libs program realclean release $(OBJDIR)
|
||||
.PHONY: all all_platforms alltags boot clean clobber clobber_all export install libs program realclean release $(DIRS)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,29 +22,6 @@
|
|||
# e) #
|
||||
# LIBRARY -- the target library name to create from $OBJS #
|
||||
# ($OBJDIR automatically prepended to it) #
|
||||
# f) #
|
||||
# JSRCS -- java source files to compile into class files #
|
||||
# (if you don't specify this it will default #
|
||||
# to *.java) #
|
||||
# g) #
|
||||
# PACKAGE -- the package to put the .class files into #
|
||||
# (e.g. netscape/applet) #
|
||||
# (NOTE: the default definition for this may be #
|
||||
# overridden if "jdk.mk" is included) #
|
||||
# h) #
|
||||
# JMC_EXPORT -- java files to be exported for use by JMC_GEN #
|
||||
# (this is a list of Class names) #
|
||||
# i) #
|
||||
# JRI_GEN -- files to run through javah to generate headers #
|
||||
# and stubs #
|
||||
# (output goes into the _jri sub-dir) #
|
||||
# j) #
|
||||
# JMC_GEN -- files to run through jmc to generate headers #
|
||||
# and stubs #
|
||||
# (output goes into the _jmc sub-dir) #
|
||||
# k) #
|
||||
# JNI_GEN -- files to run through javah to generate headers #
|
||||
# (output goes into the _jni sub-dir) #
|
||||
# #
|
||||
#######################################################################
|
||||
|
||||
|
|
@ -79,20 +56,54 @@ endif
|
|||
# - (3) IMPORT_LIBRARY: an import library, defined in $(OS_TARGET).mk
|
||||
# - (4) PROGRAM: an executable binary
|
||||
#
|
||||
# NOTE: The names of libraries can be generated by simply specifying
|
||||
# LIBRARY_NAME (and LIBRARY_VERSION in the case of non-static libraries).
|
||||
# LIBRARY and SHARED_LIBRARY may be defined differently in $(OS_TARGET).mk
|
||||
# A library is build by specifying the LIBRARY_NAME variable.
|
||||
# If you want to build only a static library, set SHARED_LIBRARY = $(NULL)
|
||||
# If you want to build only a shared library, set LIBRARY = $(NULL)
|
||||
# You can specify the shared library major version via LIBRARY_VERSION.
|
||||
#
|
||||
# Normally you want to link to the shared library. In this case you must
|
||||
# provide an export script, like:
|
||||
# MAPFILE = $(OBJDIR)/$(LIBRARY_NAME).def.
|
||||
# Unfortunatly this variable is needed by the ARCH setup, so you have to set
|
||||
# it explicitly in the manifest.mn.
|
||||
#
|
||||
# Per default, it's assumed the shared library provides resource specification
|
||||
# in the file RES. You can set it to $(NULL), if that is not true.
|
||||
#
|
||||
# If you have an unversioned SHARED_LIBRARY, you must explicitly change or
|
||||
# disable the static LIBRARY, as these normally clash on Windows.
|
||||
|
||||
ifdef LIBRARY_NAME
|
||||
ifndef LIBRARY
|
||||
LIBRARY = $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
|
||||
LIBRARY := $(OBJDIR)/$(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX)
|
||||
endif
|
||||
ifndef SHARED_LIBRARY
|
||||
SHARED_LIBRARY = $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(JDK_DEBUG_SUFFIX).$(DLL_SUFFIX)
|
||||
SHARED_LIBRARY := $(OBJDIR)/$(DLL_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
|
||||
endif
|
||||
|
||||
ifneq ($(SHARED_LIBRARY),)
|
||||
|
||||
ifdef IMPORT_LIB_SUFFIX
|
||||
ifdef MAPFILE
|
||||
ifndef IMPORT_LIBRARY
|
||||
IMPORT_LIBRARY := $(OBJDIR)/$(IMPORT_LIB_PREFIX)$(LIBRARY_NAME)$(LIBRARY_VERSION)$(IMPORT_LIB_SUFFIX)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef MAPFILE_SOURCE
|
||||
MAPFILE_SOURCE = $(LIBRARY_NAME).def
|
||||
MAPFILE_SOURCE := $(LIBRARY_NAME).def
|
||||
endif
|
||||
|
||||
ifeq (,$(filter-out WIN%,$(OS_TARGET)))
|
||||
ifndef RES
|
||||
RES := $(OBJDIR)/$(LIBRARY_NAME).res
|
||||
endif
|
||||
ifndef RESNAME
|
||||
RESNAME := $(LIBRARY_NAME).rc
|
||||
endif
|
||||
endif
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
@ -101,11 +112,11 @@ endif
|
|||
#
|
||||
|
||||
ifdef PROGRAM
|
||||
PROGRAM := $(addprefix $(OBJDIR)/, $(PROGRAM)$(JDK_DEBUG_SUFFIX)$(PROG_SUFFIX))
|
||||
PROGRAM := $(addprefix $(OBJDIR)/, $(PROGRAM)$(PROG_SUFFIX))
|
||||
endif
|
||||
|
||||
ifdef PROGRAMS
|
||||
PROGRAMS := $(addprefix $(OBJDIR)/, $(PROGRAMS:%=%$(JDK_DEBUG_SUFFIX)$(PROG_SUFFIX)))
|
||||
PROGRAMS := $(addprefix $(OBJDIR)/, $(PROGRAMS:%=%$(PROG_SUFFIX)))
|
||||
endif
|
||||
|
||||
ifndef TARGETS
|
||||
|
|
@ -117,8 +128,7 @@ CPPSRCS1 = $(CPPSRCS:.cpp=$(OBJ_SUFFIX))
|
|||
CPPSRCS2 = $(CPPSRCS1:.cc=$(OBJ_SUFFIX))
|
||||
|
||||
ifndef OBJS
|
||||
SIMPLE_OBJS = $(JRI_STUB_CFILES) \
|
||||
$(addsuffix $(OBJ_SUFFIX), $(JMC_GEN)) \
|
||||
SIMPLE_OBJS = \
|
||||
$(CSRCS:.c=$(OBJ_SUFFIX)) \
|
||||
$(CPPSRCS2) \
|
||||
$(ASFILES:$(ASM_SUFFIX)=$(OBJ_SUFFIX)) \
|
||||
|
|
@ -133,55 +143,15 @@ ifndef BUILT_SRCS
|
|||
$(BUILT_CSRCS) $(BUILT_CPPSRCS) $(BUILT_ASFILES))
|
||||
endif
|
||||
|
||||
|
||||
ifeq (,$(filter-out WIN%,$(OS_TARGET)))
|
||||
MAKE_OBJDIR = $(INSTALL) -D $(OBJDIR)
|
||||
else
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
|
||||
endef
|
||||
endif
|
||||
|
||||
ifndef PACKAGE
|
||||
PACKAGE = .
|
||||
endif
|
||||
|
||||
ifdef NSBUILDROOT
|
||||
JDK_GEN_DIR = $(SOURCE_XP_DIR)/_gen
|
||||
JMC_GEN_DIR = $(SOURCE_XP_DIR)/_jmc
|
||||
JNI_GEN_DIR = $(SOURCE_XP_DIR)/_jni
|
||||
JRI_GEN_DIR = $(SOURCE_XP_DIR)/_jri
|
||||
JDK_STUB_DIR = $(SOURCE_XP_DIR)/_stubs
|
||||
else
|
||||
JDK_GEN_DIR = _gen
|
||||
JMC_GEN_DIR = _jmc
|
||||
JNI_GEN_DIR = _jni
|
||||
JRI_GEN_DIR = _jri
|
||||
JDK_STUB_DIR = _stubs
|
||||
ifndef MAKE_OBJDIR
|
||||
define MAKE_OBJDIR
|
||||
if test ! -d $(@D); then $(NSINSTALL) -D $(@D); fi
|
||||
endef
|
||||
endif
|
||||
|
||||
ALL_TRASH = $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \
|
||||
so_locations $(BUILT_SRCS) $(NOSUCHFILE)
|
||||
|
||||
ifdef NS_USE_JDK
|
||||
ALL_TRASH += $(JDK_HEADER_CFILES) $(JDK_STUB_CFILES) \
|
||||
$(JMC_HEADERS) $(JMC_STUBS) $(JMC_EXPORT_FILES) \
|
||||
$(JNI_HEADERS) \
|
||||
$(JRI_HEADER_CFILES) $(JRI_STUB_CFILES) \
|
||||
$(JDK_GEN_DIR) $(JMC_GEN_DIR) $(JNI_GEN_DIR) \
|
||||
$(JRI_GEN_DIR) $(JDK_STUB_DIR)
|
||||
|
||||
ifdef JAVA_DESTPATH
|
||||
ALL_TRASH += $(wildcard $(JAVA_DESTPATH)/$(PACKAGE)/*.class)
|
||||
ifdef JDIRS
|
||||
ALL_TRASH += $(addprefix $(JAVA_DESTPATH)/,$(JDIRS))
|
||||
endif
|
||||
else # !JAVA_DESTPATH
|
||||
ALL_TRASH += $(wildcard $(PACKAGE)/*.class) $(JDIRS)
|
||||
endif
|
||||
|
||||
endif #NS_USE_JDK
|
||||
|
||||
ifdef NSS_BUILD_CONTINUE_ON_ERROR
|
||||
# Try to build everything. I.e., don't exit on errors.
|
||||
EXIT_ON_ERROR = +e
|
||||
|
|
@ -206,15 +176,4 @@ ifdef SYSTEM_INCL_DIR
|
|||
YOPT = -Y$(SYSTEM_INCL_DIR)
|
||||
endif
|
||||
|
||||
ifdef DIRS
|
||||
define SUBMAKE
|
||||
+@echo "cd $2; $(MAKE) $1"
|
||||
$(IGNORE_ERROR)@$(MAKE) -C $(2) $(1)
|
||||
@$(CLICK_STOPWATCH)
|
||||
|
||||
endef
|
||||
|
||||
LOOP_OVER_DIRS = $(foreach dir,$(DIRS),$(call SUBMAKE,$@,$(dir)))
|
||||
endif
|
||||
|
||||
MK_RULESET = included
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ import sys
|
|||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
raise Exception('Specify either "asan", "msan", "sancov" or "ubsan" as argument.')
|
||||
raise Exception('Specify either "asan", "fuzzer", "msan", "sancov", "sourcecov" or "ubsan" as argument.')
|
||||
|
||||
sanitizer = sys.argv[1]
|
||||
if sanitizer == "ubsan":
|
||||
if len(sys.argv) < 3:
|
||||
raise Exception('ubsan requires another argument.')
|
||||
print('-fsanitize='+sys.argv[2]+' -fno-sanitize-recover=undefined ', end='')
|
||||
print('-fsanitize='+sys.argv[2]+' -fno-sanitize-recover='+sys.argv[2] + ' ', end='')
|
||||
print('-fno-sanitize=nonnull-attribute -fno-sanitize=enum ', end='')
|
||||
return
|
||||
if sanitizer == "asan":
|
||||
print('-fsanitize=address -fsanitize-address-use-after-scope ', end='')
|
||||
|
|
@ -26,8 +27,14 @@ def main():
|
|||
raise Exception('sancov requires another argument (edge|bb|func).')
|
||||
print('-fsanitize-coverage='+sys.argv[2]+' ', end='')
|
||||
return
|
||||
if sanitizer == "sourcecov":
|
||||
print('-fprofile-instr-generate -fcoverage-mapping', end='')
|
||||
return
|
||||
if sanitizer == "fuzzer":
|
||||
print('-fsanitize=fuzzer-no-link ', end='')
|
||||
return
|
||||
|
||||
raise Exception('Specify either "asan", "msan", "sancov" or "ubsan" as argument.')
|
||||
raise Exception('Specify either "asan", "fuzzer", "msan", "sancov", "sourcecov" or "ubsan" as argument.')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
7
security/nss/coreconf/sanitizers.sh
Normal file → Executable file
7
security/nss/coreconf/sanitizers.sh
Normal file → Executable file
|
|
@ -42,13 +42,18 @@ enable_sancov()
|
|||
enable_sanitizer sancov "$sancov"
|
||||
}
|
||||
|
||||
enable_sourcecov()
|
||||
{
|
||||
enable_sanitizer sourcecov
|
||||
}
|
||||
|
||||
enable_ubsan()
|
||||
{
|
||||
local ubsan
|
||||
if [ -n "$1" ]; then
|
||||
ubsan="$1"
|
||||
else
|
||||
ubsan=bool,signed-integer-overflow,shift,vptr
|
||||
ubsan=undefined,local-bounds
|
||||
fi
|
||||
enable_sanitizer ubsan "$ubsan"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,17 +31,9 @@ endif
|
|||
# <user_source_tree> cross-platform (xp) import/export directories
|
||||
#
|
||||
|
||||
SOURCE_CLASSES_DIR = $(SOURCE_XP_DIR)/classes
|
||||
SOURCE_CLASSES_DBG_DIR = $(SOURCE_XP_DIR)/classes_DBG
|
||||
SOURCE_XPHEADERS_DIR = $(SOURCE_XP_DIR)/public/$(MODULE)
|
||||
SOURCE_XPPRIVATE_DIR = $(SOURCE_XP_DIR)/private/$(MODULE)
|
||||
|
||||
ifdef BUILD_OPT
|
||||
IMPORT_XPCLASS_DIR = $(SOURCE_CLASSES_DIR)
|
||||
else
|
||||
IMPORT_XPCLASS_DIR = $(SOURCE_CLASSES_DBG_DIR)
|
||||
endif
|
||||
|
||||
#
|
||||
# <user_source_tree> machine-dependent (md) master import/export directory
|
||||
#
|
||||
|
|
@ -110,26 +102,8 @@ SOURCE_RELEASE_XP_DIR = $(SOURCE_RELEASE_PREFIX)
|
|||
# <user_source_tree> cross-platform (xp) source-side release directories
|
||||
#
|
||||
|
||||
SOURCE_RELEASE_CLASSES_DIR = classes
|
||||
SOURCE_RELEASE_CLASSES_DBG_DIR = classes_DBG
|
||||
SOURCE_RELEASE_XPHEADERS_DIR = include
|
||||
|
||||
#
|
||||
# <user_source_tree> cross-platform (xp) JAR source-side release files
|
||||
#
|
||||
|
||||
XPCLASS_JAR = xpclass.jar
|
||||
XPCLASS_DBG_JAR = xpclass_dbg.jar
|
||||
XPHEADER_JAR = xpheader.jar
|
||||
|
||||
ifdef BUILD_OPT
|
||||
SOURCE_RELEASE_XP_CLASSES_DIR = $(SOURCE_RELEASE_CLASSES_DIR)
|
||||
IMPORT_XPCLASS_JAR = $(XPCLASS_JAR)
|
||||
else
|
||||
SOURCE_RELEASE_XP_CLASSES_DIR = $(SOURCE_RELEASE_CLASSES_DBG_DIR)
|
||||
IMPORT_XPCLASS_JAR = $(XPCLASS_DBG_JAR)
|
||||
endif
|
||||
|
||||
#
|
||||
# <user_source_tree> machine-dependent (md) source-side master release directory
|
||||
#
|
||||
|
|
@ -145,14 +119,6 @@ SOURCE_RELEASE_LIB_DIR = $(PLATFORM)/lib
|
|||
SOURCE_RELEASE_MDHEADERS_DIR = $(PLATFORM)/include
|
||||
SOURCE_RELEASE_SPEC_DIR = $(SOURCE_RELEASE_MD_DIR)
|
||||
|
||||
#
|
||||
# <user_source_tree> machine-dependent (md) JAR/tar source-side release files
|
||||
#
|
||||
|
||||
MDBINARY_JAR = mdbinary.jar
|
||||
MDHEADER_JAR = mdheader.jar
|
||||
|
||||
|
||||
# Where to put the results
|
||||
|
||||
ifneq ($(RESULTS_DIR),)
|
||||
|
|
|
|||
|
|
@ -40,11 +40,6 @@ ifndef DYNAMIC_LIB_SUFFIX
|
|||
DYNAMIC_LIB_SUFFIX = .$(DLL_SUFFIX)
|
||||
endif
|
||||
|
||||
# WIN% overridese this
|
||||
ifndef IMPORT_LIB_SUFFIX
|
||||
IMPORT_LIB_SUFFIX =
|
||||
endif
|
||||
|
||||
|
||||
ifndef STATIC_LIB_SUFFIX_FOR_LINKING
|
||||
STATIC_LIB_SUFFIX_FOR_LINKING = $(STATIC_LIB_SUFFIX)
|
||||
|
|
|
|||
|
|
@ -54,10 +54,6 @@ endif
|
|||
# Set <component>-specific versions for compiliation and linkage.
|
||||
#
|
||||
|
||||
ifndef JAVA_VERSION
|
||||
JAVA_VERSION = $(CURRENT_VERSION_SYMLINK)
|
||||
endif
|
||||
|
||||
ifndef NETLIB_VERSION
|
||||
NETLIB_VERSION = $(CURRENT_VERSION_SYMLINK)
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -43,15 +43,35 @@ def main():
|
|||
|
||||
def set_warning(warning, contra=''):
|
||||
if warning_supported(warning):
|
||||
print('-W%s%s' % (contra, warning))
|
||||
print(('-W%s%s' % (contra, warning)))
|
||||
|
||||
if cc_is_clang:
|
||||
# clang is unable to handle glib's expansion of strcmp and similar for
|
||||
# optimized builds, so disable the resulting errors.
|
||||
# See https://llvm.org/bugs/show_bug.cgi?id=20144
|
||||
for w in ['array-bounds', 'unevaluated-expression',
|
||||
'parentheses-equality']:
|
||||
for w in ['array-bounds',
|
||||
'unevaluated-expression',
|
||||
'parentheses-equality',
|
||||
'tautological-type-limit-compare',
|
||||
'sign-compare',
|
||||
'comma',
|
||||
'implicit-fallthrough'
|
||||
]:
|
||||
set_warning(w, 'no-')
|
||||
for w in ['tautological-constant-in-range-compare',
|
||||
'bitfield-enum-conversion',
|
||||
'empty-body',
|
||||
'format-type-confusion',
|
||||
'ignored-qualifiers',
|
||||
'pointer-arith',
|
||||
'type-limits',
|
||||
'unreachable-code',
|
||||
'unreachable-code-return',
|
||||
'duplicated-cond',
|
||||
'logical-op',
|
||||
'implicit-function-declaration'
|
||||
]:
|
||||
set_warning(w,'')
|
||||
print('-Qunused-arguments')
|
||||
|
||||
set_warning('shadow')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue