diff --git a/gconfig/.cshrc b/gconfig/.cshrc new file mode 100644 index 00000000000..d38cebf7398 --- /dev/null +++ b/gconfig/.cshrc @@ -0,0 +1,272 @@ +#! /bin/csh +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +# +# +# Startup file for csh and tcsh. It is meant to work on +# Sun Solaris and SGI IRIX, and everything else. + +# * Let's try to get this .cshrc file working much better... + +#limit coredumpsize 0 + +setenv EDITOR vi + +# For Java class loading path +# For RDClient +#setenv CLASSPATH .:/u/wtc/public_html/java:/u/wtc/public_html/java/apps +# For RDServer +#setenv CLASSPATH .:/u/wtc/public_html/java +#setenv NSROOT /u/wtc/ns +setenv CVSROOT /m/src +#setenv NNTPSERVER news.mcom.com +#setenv MOZILLA_CLIENT 1 + +# Operating system name and release level +set os_name=`uname -s` +set os_release=`uname -r` + +# Command search path +if ($os_name == "SunOS" && $os_release == "4.1.3_U1") then +############################## +# SunOS 4.1.3_U1 +# + +setenv NO_MDUPDATE 1 + +set path = ( /tools/ns/soft/gcc-2.6.3/run/default/sparc_sun_sunos4.1.3_U1/bin \ + /tools/ns/bin \ + /sbin \ + /usr/bin \ + /usr/openwin/bin \ + /usr/openwin/include \ + /usr/ucb \ + /usr/local/bin \ + /etc \ + /usr/etc \ + /usr/etc/install \ + . ) + +else if ($os_name == "SunOS") then +################################ +# Assume it is Sun Solaris +# + +# To build Navigator on Solaris 2.5, I must set the environment +# variable NO_MDUPDATE and use gcc-2.6.3. +setenv NO_MDUPDATE 1 + +# To build with the native Solaris cc compiler +setenv NS_USE_NATIVE 1 + +# /tools/ns/soft/gcc-2.6.3/run/default/sparc_sun_solaris2.4/bin +# /u/wtc/bin +set path = ( /u/wtc/bin \ + /usr/ccs/bin \ + /usr/opt/bin \ + /tools/ns/bin \ + /usr/sbin \ + /sbin \ + /usr/bin \ + /usr/dt/bin \ + /usr/openwin/bin \ + /usr/openwin/include \ + /usr/ucb \ + /usr/opt/java/bin \ + /usr/local/bin \ + /etc \ + /usr/etc \ + /usr/etc/install \ + /opt/Acrobat3/bin \ + . ) + +# To get the native Solaris cc +if (`uname -m` == i86pc) then +set path = (/h/solx86/export/home/opt/SUNWspro/SC3.0.1/bin $path) +else +#/tools/ns/soft/sparcworks-3.0.1/run/default/share/lib/sparcworks/SUNWspro/bin +#/tools/ns/workshop/bin +set path = ( \ + /tools/ns/workshop/bin \ + /tools/ns/soft/gcc-2.6.3/run/default/sparc_sun_solaris2.4/bin \ + $path) +endif + +setenv MANPATH /usr/local/man:/usr/local/lib/mh/man:/usr/local/lib/rcscvs/man:/usr/local/lib/fvwm/man:/usr/local/lib/xscreensaver/man:/usr/share/man:/usr/openwin/man:/usr/opt/man + +# For Purify +setenv PURIFYHOME /usr/local-sparc-solaris/pure/purify-4.0-solaris2 +setenv PATH /usr/local-sparc-solaris/pure/purify-4.0-solaris2:$PATH +setenv MANPATH $PURIFYHOME/man:$MANPATH +setenv LD_LIBRARY_PATH /usr/local-sparc-solaris/pure/purify-4.0-solaris2 +setenv PURIFYOPTIONS "-max_threads=1000 -follow-child-processes=yes" + +else if ($os_name == "IRIX" || $os_name == "IRIX64") then +############# +# SGI Irix +# + +set path = ( /tools/ns/bin \ + /tools/contrib/bin \ + /usr/local/bin \ + /usr/sbin \ + /usr/bsd \ + /usr/bin \ + /bin \ + /etc \ + /usr/etc \ + /usr/bin/X11 \ + .) + +else if ($os_name == "UNIX_SV") then +################# +# UNIX_SV +# + +set path = ( /usr/local/bin \ + /tools/ns/bin \ + /bin \ + /usr/bin \ + /usr/bin/X11 \ + /X11/bin \ + /usr/X/bin \ + /usr/ucb \ + /usr/sbin \ + /sbin \ + /usr/ccs/bin \ + .) + +else if ($os_name == "AIX") then +################# +# IBM AIX +# + +set path = ( /usr/ucb/ \ + /tools/ns-arch/rs6000_ibm_aix4.1/bin \ + /tools/ns-arch/rs6000_ibm_aix3.2.5/bin \ + /share/tools/ns/soft/cvs-1.8/run/default/rs6000_ibm_aix3.2.5/bin \ + /bin \ + /usr/bin \ + /usr/ccs/bin \ + /usr/sbin \ + /usr/local/bin \ + /usr/bin/X11 \ + /usr/etc \ + /etc \ + /sbin \ + .) + +else if ($os_name == "HP-UX") then +################# +# HP UX +# + +set path = ( /usr/bin \ + /opt/ansic/bin \ + /usr/ccs/bin \ + /usr/contrib/bin \ + /opt/nettladm/bin \ + /opt/graphics/common/bin \ + /usr/bin/X11 \ + /usr/contrib/bin/X11 \ + /opt/upgrade/bin \ + /opt/CC/bin \ + /opt/aCC/bin \ + /opt/langtools/bin \ + /opt/imake/bin \ + /etc \ + /usr/etc \ + /usr/local/bin \ + /tools/ns/bin \ + /tools/contrib/bin \ + /usr/sbin \ + /usr/local/bin \ + /tools/ns/bin \ + /tools/contrib/bin \ + /usr/sbin \ + /usr/include/X11R5 \ + .) + +else if ($os_name == "SCO_SV") then +################# +# SCO +# + +set path = ( /bin \ + /usr/bin \ + /tools/ns/bin \ + /tools/contrib/bin \ + /usr/sco/bin \ + /usr/bin/X11 \ + /usr/local/bin \ + .) + +else if ($os_name == "FreeBSD") then +################# +# FreeBSD +# + +setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/java/bin:/usr/local/bin:/usr/ucb:/usr/ccs/bin:/tools/contrib/bin:/tools/ns/bin:. + +else if ($os_name == "OSF1") then +################# +# DEC OSF1 +# + +limit datasize 300000kb + +set path = ( /tools/ns-arch/alpha_dec_osf4.0/bin \ + /tools/ns-arch/soft/cvs-1.8.3/run/default/alpha_dec_osf2.0/bin \ + /usr/local-alpha-osf/bin \ + /usr3/local/bin \ + /usr/local/bin \ + /usr/sbin \ + /usr/bin \ + /bin \ + /usr/bin/X11 \ + /usr/ucb \ + . ) +endif + +set path = ($path /u/$USER/bin ) + +# for interactive csh only, in which the "prompt" variable is defined +if ($?prompt) then + # For vi, set "autoindent" option + setenv EXINIT "set ai" + +# set history = 999 + # Use ": % " as prompt. + #set prompt="%m:%/ \!% " + set host_name = "`uname -n | sed 's/.mcom.com//'`" +# alias setprompt 'set prompt = "${host_name}:$cwd \\!% "' +# setprompt +# alias cd 'cd \!*; setprompt' +# alias pushd 'pushd \!*; setprompt' +# alias popd 'popd \!*; setprompt' + +# set filec +# set notify + set ignoreeof # prevent ^d from doing logout +# alias h history +# alias so source +# alias f finger +# alias rm rm -i +# alias mv mv -i +# alias ls ls -CFa +endif + +rehash diff --git a/gconfig/AIX.mk b/gconfig/AIX.mk new file mode 100644 index 00000000000..b4fb0e80229 --- /dev/null +++ b/gconfig/AIX.mk @@ -0,0 +1,58 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for AIX. +# +include $(GDEPTH)/gconfig/UNIX.mk + +# +# XXX +# There are two implementation strategies available on AIX: +# pthreads, and pthreads-user. The default is pthreads. +# In both strategies, we need to use pthread_user.c, instead of +# aix.c. The fact that aix.c is never used is somewhat strange. +# +# So we need to do the following: +# - Default (PTHREADS_USER not defined in the environment or on +# the command line): +# Set PTHREADS_USER=1, USE_PTHREADS=1 +# - PTHREADS_USER=1 set in the environment or on the command line: +# Do nothing. +# +ifeq ($(PTHREADS_USER),1) + USE_PTHREADS = # just to be safe + IMPL_STRATEGY = _PTH_USER +else + USE_PTHREADS = 1 + PTHREADS_USER = 1 +endif + +DEFAULT_COMPILER = xlC_r + +CC = xlC_r +CCC = xlC_r + +CPU_ARCH = rs6000 + +RANLIB = ranlib + +OS_CFLAGS = -DAIX -DSYSV +ifeq ($(CC),xlC_r) + OS_CFLAGS += -qarch=com +endif + +AIX_WRAP = $(DIST)/lib/aixwrap.o +AIX_TMP = $(OBJDIR)/_aix_tmp.o diff --git a/gconfig/AIX3.2.mk b/gconfig/AIX3.2.mk new file mode 100644 index 00000000000..d3a9aba20ed --- /dev/null +++ b/gconfig/AIX3.2.mk @@ -0,0 +1,19 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for AIX3.2.5 +# +include $(GDEPTH)/gconfig/AIX.mk diff --git a/gconfig/AIX4.1.mk b/gconfig/AIX4.1.mk new file mode 100644 index 00000000000..be854e7be30 --- /dev/null +++ b/gconfig/AIX4.1.mk @@ -0,0 +1,36 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for AIX4.1 +# + +include $(GDEPTH)/gconfig/AIX.mk + +# +# Special link info for constructing AIX programs. On AIX we have to +# statically link programs that use NSPR into a single .o, rewriting the +# calls to select to call "aix". Once that is done we then can +# link that .o with a .o built in nspr which implements the system call. +# + +AIX_LINK_OPTS += -bnso -berok +#AIX_LINK_OPTS += -bnso -berok -brename:.select,.wrap_select -brename:.poll,.wrap_poll -bI:/usr/lib/syscalls.exp + +# The AIX4.1 linker had a bug which always looked for a dynamic library +# with an extension of .a. AIX4.2 fixed this problem +DLL_SUFFIX = a + +OS_LIBS += -lsvld diff --git a/gconfig/AIX4.2.mk b/gconfig/AIX4.2.mk new file mode 100644 index 00000000000..91a1e8c2b4c --- /dev/null +++ b/gconfig/AIX4.2.mk @@ -0,0 +1,25 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for AIX4.2 +# + +include $(GDEPTH)/gconfig/AIX.mk + +OS_CFLAGS += -DAIX4_2 +DSO_LDOPTS = -brtl -bM:SRE -bnoentry -bexpall +MKSHLIB = $(LD) $(DSO_LDOPTS) + diff --git a/gconfig/AIX4.3.mk b/gconfig/AIX4.3.mk new file mode 100644 index 00000000000..40f15958b96 --- /dev/null +++ b/gconfig/AIX4.3.mk @@ -0,0 +1,25 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for AIX4.3 +# + +include $(GDEPTH)/gconfig/AIX.mk + +OS_CFLAGS += -DAIX4_3 +DSO_LDOPTS = -brtl -bM:SRE -bnoentry -bexpall +MKSHLIB = $(LD) $(DSO_LDOPTS) + diff --git a/gconfig/FreeBSD2.mk b/gconfig/FreeBSD2.mk new file mode 100644 index 00000000000..071003a93b5 --- /dev/null +++ b/gconfig/FreeBSD2.mk @@ -0,0 +1,49 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for FreeBSD2 +# + +include $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = gcc +CC = gcc +CCC = g++ +RANLIB = ranlib + +OS_REL_CFLAGS = -mno-486 -Di386 +CPU_ARCH = x86 + +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -pipe -DFREEBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK + +ifdef USE_PTHREADS + OS_LIBS = -lc_r + DEFINES += -D_PR_NEED_FAKE_POLL +else + OS_LIBS = -lc +endif + +ARCH = freebsd + +DSO_CFLAGS = -fPIC +DSO_LDOPTS = -Bshareable +DSO_LDFLAGS = + +MKSHLIB = $(LD) $(DSO_LDOPTS) + +G++INCLUDES = -I/usr/include/g++ + +INCLUDES += -I/usr/X11R6/include diff --git a/gconfig/HP-UX.mk b/gconfig/HP-UX.mk new file mode 100644 index 00000000000..0c75b4e13ce --- /dev/null +++ b/gconfig/HP-UX.mk @@ -0,0 +1,56 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for HP-UX +# + +include $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = cc + +CPU_ARCH = hppa +DLL_SUFFIX = sl +CCC = CC +OS_CFLAGS += -Ae $(DSO_CFLAGS) -DHPUX -D$(CPU_ARCH) -D_HPUX_SOURCE + +ifeq ($(DEFAULT_IMPL_STRATEGY),_PTH) + USE_PTHREADS = 1 + ifeq ($(CLASSIC_NSPR),1) + USE_PTHREADS = + IMPL_STRATEGY = _CLASSIC + endif + ifeq ($(PTHREADS_USER),1) + USE_PTHREADS = + IMPL_STRATEGY = _PTH_USER + endif +endif + +ifdef USE_PTHREADS + OS_CFLAGS += -D_REENTRANT +endif +ifdef PTHREADS_USER + OS_CFLAGS += -D_REENTRANT +endif + +MKSHLIB = $(LD) $(DSO_LDOPTS) + +DSO_LDOPTS = -b +DSO_LDFLAGS = + +# +Z generates position independent code for use in shared libraries. +DSO_CFLAGS = +Z + +HAVE_PURIFY = 1 diff --git a/gconfig/HP-UXA.09.03.mk b/gconfig/HP-UXA.09.03.mk new file mode 100644 index 00000000000..4ec091dd198 --- /dev/null +++ b/gconfig/HP-UXA.09.03.mk @@ -0,0 +1,27 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# On HP-UX 9, the default (and only) implementation strategy is +# classic nspr. +# +ifeq ($(OS_RELEASE),A.09.03) + DEFAULT_IMPL_STRATEGY = _CLASSIC +endif + +# +# Config stuff for HP-UXA.09.03 +# +include $(GDEPTH)/gconfig/HP-UXA.09.mk diff --git a/gconfig/HP-UXA.09.07.mk b/gconfig/HP-UXA.09.07.mk new file mode 100644 index 00000000000..3ebe4303da2 --- /dev/null +++ b/gconfig/HP-UXA.09.07.mk @@ -0,0 +1,27 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# On HP-UX 9, the default (and only) implementation strategy is +# classic nspr. +# +ifeq ($(OS_RELEASE),A.09.07) + DEFAULT_IMPL_STRATEGY = _CLASSIC +endif + +# +# Config stuff for HP-UXA.09.07 +# +include $(GDEPTH)/gconfig/HP-UXA.09.mk diff --git a/gconfig/HP-UXA.09.mk b/gconfig/HP-UXA.09.mk new file mode 100644 index 00000000000..262d7e74e99 --- /dev/null +++ b/gconfig/HP-UXA.09.mk @@ -0,0 +1,21 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for HP-UXA.09 +# +include $(GDEPTH)/gconfig/HP-UX.mk + +OS_CFLAGS += -DHPUX9 diff --git a/gconfig/HP-UXB.10.01.mk b/gconfig/HP-UXB.10.01.mk new file mode 100644 index 00000000000..2f3a4355f8a --- /dev/null +++ b/gconfig/HP-UXB.10.01.mk @@ -0,0 +1,23 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +ifeq ($(OS_RELEASE),B.10.01) + DEFAULT_IMPL_STRATEGY = _CLASSIC +endif + +# +# Config stuff for HP-UXB.10.01 +# +include $(GDEPTH)/gconfig/HP-UXB.10.mk diff --git a/gconfig/HP-UXB.10.10.mk b/gconfig/HP-UXB.10.10.mk new file mode 100644 index 00000000000..d97bafbf653 --- /dev/null +++ b/gconfig/HP-UXB.10.10.mk @@ -0,0 +1,34 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# On HP-UX 10.10 and 10.20, the default implementation strategy is +# pthreads (actually DCE threads). Classic nspr is also available. +# + +ifeq ($(OS_RELEASE),B.10.10) + DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.10.10 +# +include $(GDEPTH)/gconfig/HP-UXB.10.mk + +OS_CFLAGS += -DHPUX10_10 + +ifeq ($(USE_PTHREADS),1) + OS_CFLAGS += -D_PR_DCETHREADS +endif diff --git a/gconfig/HP-UXB.10.20.mk b/gconfig/HP-UXB.10.20.mk new file mode 100644 index 00000000000..97205d8bcc1 --- /dev/null +++ b/gconfig/HP-UXB.10.20.mk @@ -0,0 +1,34 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# On HP-UX 10.10 and 10.20, the default implementation strategy is +# pthreads (actually DCE threads). Classic nspr is also available. +# + +ifeq ($(OS_RELEASE),B.10.20) + DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.10.20 +# +include $(GDEPTH)/gconfig/HP-UXB.10.mk + +OS_CFLAGS += -DHPUX10_20 + +ifeq ($(USE_PTHREADS),1) + OS_CFLAGS += -D_PR_DCETHREADS +endif diff --git a/gconfig/HP-UXB.10.30.mk b/gconfig/HP-UXB.10.30.mk new file mode 100644 index 00000000000..142f891dc53 --- /dev/null +++ b/gconfig/HP-UXB.10.30.mk @@ -0,0 +1,30 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# On HP-UX 10.30 and 11.00, the default implementation strategy is +# pthreads. Classic nspr and pthreads-user are also available. +# + +ifeq ($(OS_RELEASE),B.10.30) + DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.10.30. +# +include $(GDEPTH)/gconfig/HP-UXB.10.mk + +OS_CFLAGS += -DHPUX10_30 diff --git a/gconfig/HP-UXB.10.mk b/gconfig/HP-UXB.10.mk new file mode 100644 index 00000000000..0ee8e77aac2 --- /dev/null +++ b/gconfig/HP-UXB.10.mk @@ -0,0 +1,21 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for HP-UXB.10 +# +include $(GDEPTH)/gconfig/HP-UX.mk + +OS_CFLAGS += -DHPUX10 diff --git a/gconfig/HP-UXB.11.00.mk b/gconfig/HP-UXB.11.00.mk new file mode 100644 index 00000000000..427cd7c03ed --- /dev/null +++ b/gconfig/HP-UXB.11.00.mk @@ -0,0 +1,29 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# On HP-UX 10.30 and 11.00, the default implementation strategy is +# pthreads. Classic nspr and pthreads-user are also available. +# + +ifeq ($(OS_RELEASE),B.11.00) +OS_CFLAGS += -DHPUX10 +DEFAULT_IMPL_STRATEGY = _PTH +endif + +# +# Config stuff for HP-UXB.11.00. +# +include $(GDEPTH)/gconfig/HP-UXB.11.mk diff --git a/gconfig/HP-UXB.11.mk b/gconfig/HP-UXB.11.mk new file mode 100644 index 00000000000..54a3948ba2b --- /dev/null +++ b/gconfig/HP-UXB.11.mk @@ -0,0 +1,23 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for HP-UXB.11 +# +include $(GDEPTH)/gconfig/HP-UX.mk + +OS_CFLAGS += -DHPUX11 +DAportable +DS1.1 + +CCC = aCC diff --git a/gconfig/IRIX.mk b/gconfig/IRIX.mk new file mode 100644 index 00000000000..42055121a7b --- /dev/null +++ b/gconfig/IRIX.mk @@ -0,0 +1,93 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for IRIX +# + +include $(GDEPTH)/gconfig/UNIX.mk + +# +# The default implementation strategy for Irix is classic nspr. +# +ifeq ($(USE_PTHREADS),1) + IMPL_STRATEGY = _PTH +endif + +DEFAULT_COMPILER = cc + +ifdef NS_USE_GCC + CC = gcc + AS = $(CC) -x assembler-with-cpp + ODD_CFLAGS = -Wall -Wno-format + ifdef BUILD_OPT + OPTIMIZER = -O6 + endif +else + ifeq ($(USE_N32),1) + CC = CC + else + CC = cc + endif + CCC = CC + ODD_CFLAGS = -fullwarn -xansi + 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 -exceptions -woff 1209,1642,3201 -DIRIX_N32 -DXP_CPLUSPLUS + else + ODD_CFLAGS += -32 -multigot + endif + else + ODD_CFLAGS += -xgot + endif +endif + +ODD_CFLAGS += -DSVR4 -DIRIX + +CPU_ARCH = mips + +RANLIB = /bin/true +# For purify +# XXX: should always define _SGI_MP_SOURCE +NOMD_OS_CFLAGS += $(ODD_CFLAGS) -D_SGI_MP_SOURCE + +ifndef NO_MDUPDATE + OS_CFLAGS += $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES) +else + OS_CFLAGS += $(NOMD_OS_CFLAGS) +endif + +ifeq ($(USE_N32),1) + SHLIB_LD_OPTS += -n32 +endif + +MKSHLIB += $(LD) $(SHLIB_LD_OPTS) -shared -soname $(@:$(OBJDIR)/%.so=%.so) + +HAVE_PURIFY = 1 + +DSO_LDOPTS = -elf -shared -all + +ifdef DSO_BACKEND + DSO_LDOPTS += -soname $(DSO_NAME) +endif diff --git a/gconfig/IRIX5.2.mk b/gconfig/IRIX5.2.mk new file mode 100644 index 00000000000..b361531d2d6 --- /dev/null +++ b/gconfig/IRIX5.2.mk @@ -0,0 +1,19 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for IRIX 5.2 +# +include $(GDEPTH)/gconfig/IRIX5.mk diff --git a/gconfig/IRIX5.3.mk b/gconfig/IRIX5.3.mk new file mode 100644 index 00000000000..e4a93b77462 --- /dev/null +++ b/gconfig/IRIX5.3.mk @@ -0,0 +1,21 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for IRIX 5.3 +# +include $(GDEPTH)/gconfig/IRIX5.mk + +OS_CFLAGS += -DIRIX5_3 diff --git a/gconfig/IRIX5.mk b/gconfig/IRIX5.mk new file mode 100644 index 00000000000..0a9a2d7296d --- /dev/null +++ b/gconfig/IRIX5.mk @@ -0,0 +1,24 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for IRIX 5 +# + +include $(GDEPTH)/gconfig/IRIX.mk + +ifndef NS_USE_GCC + ODD_CFLAGS += -xgot +endif diff --git a/gconfig/IRIX6.2.mk b/gconfig/IRIX6.2.mk new file mode 100644 index 00000000000..d752cf25c6e --- /dev/null +++ b/gconfig/IRIX6.2.mk @@ -0,0 +1,27 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for IRIX 6.2 +# + + +# catch unresolved symbols + +SHLIB_LD_OPTS += -no_unresolved + +include $(GDEPTH)/gconfig/IRIX6.mk + +OS_CFLAGS += -DIRIX6_2 diff --git a/gconfig/IRIX6.3.mk b/gconfig/IRIX6.3.mk new file mode 100644 index 00000000000..61bb0a6b4d2 --- /dev/null +++ b/gconfig/IRIX6.3.mk @@ -0,0 +1,26 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for IRIX 6.3 +# + +# catch unresolved symbols + +SHLIB_LD_OPTS += -no_unresolved + +include $(GDEPTH)/gconfig/IRIX6.mk + +OS_CFLAGS += -DIRIX6_3 diff --git a/gconfig/IRIX6.mk b/gconfig/IRIX6.mk new file mode 100644 index 00000000000..5710da17faa --- /dev/null +++ b/gconfig/IRIX6.mk @@ -0,0 +1,27 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for IRIX 6 +# + +include $(GDEPTH)/gconfig/IRIX.mk + +ifndef NS_USE_GCC + ifneq ($(USE_N32),1) + OS_CFLAGS += -32 + endif + ODD_CFLAGS += -multigot +endif diff --git a/gconfig/Linux.mk b/gconfig/Linux.mk new file mode 100644 index 00000000000..4cda84918d7 --- /dev/null +++ b/gconfig/Linux.mk @@ -0,0 +1,69 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for Linux +# + +include $(GDEPTH)/gconfig/UNIX.mk + +# +# The default implementation strategy for Linux is classic nspr. +# +ifeq ($(USE_PTHREADS),1) + IMPL_STRATEGY = _PTH +endif + +CC = gcc +CCC = g++ +RANLIB = ranlib + +DEFAULT_COMPILER = gcc + +ifeq ($(OS_RELEASE),ppc) + OS_REL_CFLAGS = -DMACLINUX -DLINUX1_2 + CPU_ARCH = ppc +else +ifeq ($(OS_TEST),alpha) + OS_REL_CFLAGS = -D_ALPHA_ -DLINUX1_2 + CPU_ARCH = alpha +else + OS_REL_CFLAGS = -mno-486 -DLINUX1_2 -Di386 + CPU_ARCH = x86 +endif +endif + +ifeq ($(OS_RELEASE),2.0) + OS_REL_CFLAGS += -DLINUX2_0 + MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so) + ifdef BUILD_OPT + OPTIMIZER = -O2 + endif +endif + +OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -pipe -DLINUX -Dlinux -D_POSIX_SOURCE -D_BSD_SOURCE -DHAVE_STRERROR +OS_LIBS = -L/lib -ldl -lc + +ifdef USE_PTHREADS + DEFINES += -D_REENTRANT -D_PR_NEED_FAKE_POLL +endif + +ARCH = linux + +DSO_CFLAGS = -fPIC +DSO_LDOPTS = -shared +DSO_LDFLAGS = + +G++INCLUDES = -I/usr/include/g++ diff --git a/gconfig/LinuxELF1.2.mk b/gconfig/LinuxELF1.2.mk new file mode 100644 index 00000000000..117b84e5a1c --- /dev/null +++ b/gconfig/LinuxELF1.2.mk @@ -0,0 +1,20 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for Linux 1.2 (ELF) +# + +include $(GDEPTH)/gconfig/Linux.mk diff --git a/gconfig/LinuxELF2.0.mk b/gconfig/LinuxELF2.0.mk new file mode 100644 index 00000000000..408ff2e1de4 --- /dev/null +++ b/gconfig/LinuxELF2.0.mk @@ -0,0 +1,20 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for Linux 2.0 (ELF) +# + +include $(GDEPTH)/gconfig/Linux.mk diff --git a/gconfig/Makefile b/gconfig/Makefile new file mode 100644 index 00000000000..ef6bf1413cc --- /dev/null +++ b/gconfig/Makefile @@ -0,0 +1,27 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + + +DEPTH = .. +GDEPTH = .. + +MODULE = gconfig + +DIRS = nsinstall mkdepend md + +include $(DEPTH)/gconfig/config.mk +include $(DEPTH)/gconfig/rules.mk + +export:: libs diff --git a/gconfig/NCR3.0.mk b/gconfig/NCR3.0.mk new file mode 100644 index 00000000000..644d739f5df --- /dev/null +++ b/gconfig/NCR3.0.mk @@ -0,0 +1,74 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for NCR SysVr4 v 3.0 +# + +include $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = cc + +### +NS_USE_NATIVE = 1 + +# NS_USE_GCC = 1 + +export PATH:=$(PATH):/opt/ncc/bin +### + +RANLIB = true +GCC_FLAGS_EXTRA += -pipe + +DEFINES += -DSVR4 -DSYSV -DHAVE_STRERROR -DNCR + +OS_CFLAGS += -Hnocopyr -DSVR4 -DSYSV -DHAVE_STRERROR -DNCR -DPRFSTREAMS_BROKEN + +ifdef NS_USE_NATIVE + CC = cc + CCC = ncc + CXX = ncc +# OS_LIBS += -L/opt/ncc/lib +else +# OS_LIBS += +endif + +#OS_LIBS += -lsocket -lnsl -ldl -lc + +MKSHLIB += $(LD) $(DSO_LDOPTS) +#DSO_LDOPTS += -G -z defs +DSO_LDOPTS += -G + +CPU_ARCH = x86 +ARCH = ncr + +NOSUCHFILE = /solaris-rm-f-sucks + +# now take care of default GCC (rus@5/5/97) + +ifdef NS_USE_GCC + # if gcc-settings are redefined already - don't touch it + # + ifeq (,$(findstring gcc, $(CC))) + CC = gcc + CCC = g++ + CXX = g++ + # always use -fPIC - some makefiles are still broken and don't distinguish + # situation when they build shared and static libraries + CFLAGS += -fPIC -Wall $(GCC_FLAGS_EXTRA) +# OS_LIBS += -L/usr/local/lib -lstdc++ -lg++ -lgcc + endif +endif +### diff --git a/gconfig/NEC4.2.mk b/gconfig/NEC4.2.mk new file mode 100644 index 00000000000..f3cdf152ee2 --- /dev/null +++ b/gconfig/NEC4.2.mk @@ -0,0 +1,45 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for NEC Mips SYSV +# + +include $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = $(GDEPTH)/build/hcc + +CPU_ARCH = mips + +ifdef NS_USE_GCC +CC = gcc +CCC = g++ +else +CC = $(GDEPTH)/build/hcc +OS_CFLAGS = -Xa -KGnum=0 -KOlimit=4000 +CCC = g++ +endif + +MKSHLIB = $(LD) $(DSO_LDOPTS) + +RANLIB = /bin/true + +OS_CFLAGS += $(ODD_CFLAGS) -DSVR4 -D__SVR4 -DNEC -Dnec_ews -DHAVE_STRERROR +OS_LIBS = -lsocket -lnsl -ldl $(LDOPTIONS) +LDOPTIONS = -lc -L/usr/ucblib -lucb + +NOSUCHFILE = /nec-rm-f-sucks + +DSO_LDOPTS = -G diff --git a/gconfig/OSF1.mk b/gconfig/OSF1.mk new file mode 100644 index 00000000000..db6c3cead81 --- /dev/null +++ b/gconfig/OSF1.mk @@ -0,0 +1,54 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for DEC OSF/1 +# + +# +# 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 $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = cc + +CC = cc +OS_CFLAGS += $(NON_LD_FLAGS) -std +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 -taso + +ifeq ($(USE_PTHREADS),1) + OS_CFLAGS += -pthread +endif + +ifeq ($(USE_IPV6),1) + OS_CFLAGS += -D_PR_INET6 +endif + +# The command to build a shared library on OSF1. +MKSHLIB += ld -shared -all -expect_unresolved "*" +DSO_LDOPTS += -shared diff --git a/gconfig/OSF1V2.0.mk b/gconfig/OSF1V2.0.mk new file mode 100644 index 00000000000..4574b694cd5 --- /dev/null +++ b/gconfig/OSF1V2.0.mk @@ -0,0 +1,19 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for DEC OSF/1 V2.0 +# +include $(GDEPTH)/gconfig/OSF1.mk diff --git a/gconfig/OSF1V3.0.mk b/gconfig/OSF1V3.0.mk new file mode 100644 index 00000000000..847ab9357d3 --- /dev/null +++ b/gconfig/OSF1V3.0.mk @@ -0,0 +1,20 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +# + +# +# Config stuff for DEC OSF/1 V3.0 +# +include $(GDEPTH)/gconfig/OSF1.mk diff --git a/gconfig/OSF1V3.2.mk b/gconfig/OSF1V3.2.mk new file mode 100644 index 00000000000..f9bb47d5b42 --- /dev/null +++ b/gconfig/OSF1V3.2.mk @@ -0,0 +1,28 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# On OSF1 V3.2, classic nspr is the default (and only) implementation +# strategy. +# + +# +# Config stuff for DEC OSF/1 V3.2 +# +include $(GDEPTH)/gconfig/OSF1.mk + +ifeq ($(OS_RELEASE),V3.2) + OS_CFLAGS += -DOSF1V3 +endif diff --git a/gconfig/OSF1V4.0.mk b/gconfig/OSF1V4.0.mk new file mode 100644 index 00000000000..706b3c70154 --- /dev/null +++ b/gconfig/OSF1V4.0.mk @@ -0,0 +1,35 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# 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 $(GDEPTH)/gconfig/OSF1.mk + +ifeq ($(OS_RELEASE),V4.0) + OS_CFLAGS += -DOSF1V4 +endif diff --git a/gconfig/OSF1V4.0B.mk b/gconfig/OSF1V4.0B.mk new file mode 100644 index 00000000000..34eae0c0f89 --- /dev/null +++ b/gconfig/OSF1V4.0B.mk @@ -0,0 +1,19 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for DEC OSF/1 V4.0B +# +include $(GDEPTH)/gconfig/OSF1V4.0.mk diff --git a/gconfig/OSF1V4.0D.mk b/gconfig/OSF1V4.0D.mk new file mode 100644 index 00000000000..22ee2c08d99 --- /dev/null +++ b/gconfig/OSF1V4.0D.mk @@ -0,0 +1,20 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for DEC OSF/1 V4.0D +# +include $(GDEPTH)/gconfig/OSF1V4.0.mk +DEFINES += -DOSF1V4D diff --git a/gconfig/ReliantUNIX.mk b/gconfig/ReliantUNIX.mk new file mode 100644 index 00000000000..9db2e004297 --- /dev/null +++ b/gconfig/ReliantUNIX.mk @@ -0,0 +1,68 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for ReliantUNIX +# + +include $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = cc + +ifdef NS_USE_GCC + ## gcc-2.7.2 homebrewn + CC = gcc + CCC = g++ + AS = $(CC) + ASFLAGS += -x assembler-with-cpp + LD = gld + ODD_CFLAGS = -pipe -Wall -Wno-format + ifdef BUILD_OPT + OPTIMIZER += -O6 + endif + MKSHLIB = $(LD) + MKSHLIB += -G -h $(@:$(OBJDIR)/%.so=%.so) + DSO_LDOPTS += -G -Xlinker -Blargedynsym +else + ## native compiler (CDS++ 1.0) +# CC = /usr/bin/cc + CC = cc + CCC = /usr/bin/CC + AS = /usr/bin/cc + ODD_CFLAGS = + ifdef BUILD_OPT + OPTIMIZER += -O -F Olimit,4000 + endif + MKSHLIB = $(CC) + MKSHLIB += -G -h $(@:$(OBJDIR)/%.so=%.so) + DSO_LDOPTS += -G -W l,-Blargedynsym +endif + +NOSUCHFILE = /sni-rm-f-sucks +ODD_CFLAGS += -DSVR4 -DSNI -DRELIANTUNIX +CPU_ARCH = mips +RANLIB = /bin/true + +# For purify +NOMD_OS_CFLAGS += $(ODD_CFLAGS) + +# we do not have -MDupdate ... +OS_CFLAGS += $(NOMD_OS_CFLAGS) +OS_LIBS += -lsocket -lnsl -lresolv -lgen -ldl -lc /usr/ucblib/libucb.a +HAVE_PURIFY = 0 + +ifdef DSO_BACKEND + DSO_LDOPTS += -h $(DSO_NAME) +endif diff --git a/gconfig/ReliantUNIX5.4.mk b/gconfig/ReliantUNIX5.4.mk new file mode 100644 index 00000000000..8d61f5b2213 --- /dev/null +++ b/gconfig/ReliantUNIX5.4.mk @@ -0,0 +1,19 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for ReliantUNIX5.4 +# +include $(GDEPTH)/gconfig/ReliantUNIX.mk diff --git a/gconfig/SCOOS5.0.mk b/gconfig/SCOOS5.0.mk new file mode 100644 index 00000000000..65c2ae0b243 --- /dev/null +++ b/gconfig/SCOOS5.0.mk @@ -0,0 +1,20 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for SCO OpenServer 5.0 for x86. +# + +include $(GDEPTH)/gconfig/SCO_SV3.2.mk diff --git a/gconfig/SCO_SV3.2.mk b/gconfig/SCO_SV3.2.mk new file mode 100644 index 00000000000..7a278c6323f --- /dev/null +++ b/gconfig/SCO_SV3.2.mk @@ -0,0 +1,70 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for SCO Unix for x86. +# + +include $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = cc + +CC = cc +OS_CFLAGS += -b elf -KPIC +CCC = g++ +CCC += -b elf -DPRFSTREAMS_BROKEN -I/usr/local/lib/g++-include +# CCC = $(GDEPTH)/build/hcpp +# CCC += +.cpp +w +RANLIB = /bin/true + +# +# -DSCO_PM - Policy Manager AKA: SCO Licensing +# -DSCO - Changes to Netscape source (consistent with AIX, LINUX, etc..) +# -Dsco - Needed for /usr/include/X11/* +# +OS_CFLAGS += -DSCO_SV -DSYSV -D_SVID3 -DHAVE_STRERROR -DSW_THREADS -DSCO_PM -DSCO -Dsco +#OS_LIBS += -lpmapi -lsocket -lc +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) +XINC = /usr/include/X11 +MOTIFLIB += -lXm +INCLUDES += -I$(XINC) +CPU_ARCH = x86 +GFX_ARCH = x +ARCH = sco +LOCALE_MAP = $(GDEPTH)/cmd/xfe/intl/sco.lm +EN_LOCALE = C +DE_LOCALE = de_DE.ISO8859-1 +FR_LOCALE = fr_FR.ISO8859-1 +JP_LOCALE = ja +SJIS_LOCALE = ja_JP.SJIS +KR_LOCALE = ko_KR.EUC +CN_LOCALE = zh +TW_LOCALE = zh +I2_LOCALE = i2 +LOC_LIB_DIR = /usr/lib/X11 +NOSUCHFILE = /solaris-rm-f-sucks +BSDECHO = /bin/echo + +# +# These defines are for building unix plugins +# +BUILD_UNIX_PLUGINS = 1 +#DSO_LDOPTS += -b elf -G -z defs +DSO_LDOPTS += -b elf -G +DSO_LDFLAGS += -nostdlib -L/lib -L/usr/lib -lXm -lXt -lX11 -lgen + +# Used for Java compiler +EXPORT_FLAGS += -W l,-Bexport diff --git a/gconfig/SunOS4.1.3_U1.mk b/gconfig/SunOS4.1.3_U1.mk new file mode 100644 index 00000000000..2c77b242241 --- /dev/null +++ b/gconfig/SunOS4.1.3_U1.mk @@ -0,0 +1,43 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for SunOS4.1 +# + +include $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = cc + +INCLUDES += -I/usr/dt/include -I/usr/openwin/include -I/home/motif/usr/include + +# SunOS 4 _requires_ that shared libs have a version number. +# XXX FIXME: Version number should use NSPR_VERSION_NUMBER? +DLL_SUFFIX = so.1.0 +CC = gcc +RANLIB = ranlib +CPU_ARCH = sparc + +# Purify doesn't like -MDupdate +NOMD_OS_CFLAGS += -Wall -Wno-format -DSUNOS4 +OS_CFLAGS += $(DSO_CFLAGS) $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES) +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) +HAVE_PURIFY = 1 +NOSUCHFILE = /solaris-rm-f-sucks +DSO_LDOPTS = + +# -fPIC generates position-independent code for use in a shared library. +DSO_CFLAGS += -fPIC diff --git a/gconfig/SunOS5.3.mk b/gconfig/SunOS5.3.mk new file mode 100644 index 00000000000..4b18b803839 --- /dev/null +++ b/gconfig/SunOS5.3.mk @@ -0,0 +1,22 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for SunOS5.3 +# + +SOL_CFLAGS = + +include $(GDEPTH)/gconfig/SunOS5.mk diff --git a/gconfig/SunOS5.4.mk b/gconfig/SunOS5.4.mk new file mode 100644 index 00000000000..d67b1523484 --- /dev/null +++ b/gconfig/SunOS5.4.mk @@ -0,0 +1,22 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for SunOS5.4 +# + +SOL_CFLAGS = + +include $(GDEPTH)/gconfig/SunOS5.mk diff --git a/gconfig/SunOS5.4_i86pc.mk b/gconfig/SunOS5.4_i86pc.mk new file mode 100644 index 00000000000..ac35224d315 --- /dev/null +++ b/gconfig/SunOS5.4_i86pc.mk @@ -0,0 +1,52 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for Solaris 2.4 on x86 +# + +include $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = cc + +ifdef NS_USE_GCC + CC = gcc + OS_CFLAGS += -Wall -Wno-format + CCC = g++ + CCC += -Wall -Wno-format + ASFLAGS += -x assembler-with-cpp + ifdef NO_MDUPDATE + OS_CFLAGS += $(NOMD_OS_CFLAGS) + else + OS_CFLAGS += $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES) + endif +else + CC = cc + CCC = CC + ASFLAGS += -Wa,-P + OS_CFLAGS += $(NOMD_OS_CFLAGS) +endif + +CPU_ARCH = x86 + +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) +NOSUCHFILE = /solx86-rm-f-sucks +RANLIB = echo + +# for purify +NOMD_OS_CFLAGS += -DSVR4 -DSYSV -D_REENTRANT -DSOLARIS -D__svr4__ -Di386 + +DSO_LDOPTS += -G diff --git a/gconfig/SunOS5.5.1.mk b/gconfig/SunOS5.5.1.mk new file mode 100644 index 00000000000..45fd66a50a6 --- /dev/null +++ b/gconfig/SunOS5.5.1.mk @@ -0,0 +1,26 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for SunOS5.5.1 +# + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(GDEPTH)/gconfig/SunOS5.mk + +ifeq ($(OS_RELEASE),5.5.1) + OS_DEFINES += -DSOLARIS2_5 +endif diff --git a/gconfig/SunOS5.5.1_i86pc.mk b/gconfig/SunOS5.5.1_i86pc.mk new file mode 100644 index 00000000000..08c8fd8a366 --- /dev/null +++ b/gconfig/SunOS5.5.1_i86pc.mk @@ -0,0 +1,29 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for Solaris 2.5.1 on x86 +# + +SOL_CFLAGS = -D_SVID_GETTOD + +include $(GDEPTH)/gconfig/SunOS5.mk + +CPU_ARCH = x86 +OS_DEFINES += -Di386 + +ifeq ($(OS_RELEASE),5.5.1_i86pc) + OS_DEFINES += -DSOLARIS2_5 +endif diff --git a/gconfig/SunOS5.5.mk b/gconfig/SunOS5.5.mk new file mode 100644 index 00000000000..e5a8424f02d --- /dev/null +++ b/gconfig/SunOS5.5.mk @@ -0,0 +1,26 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for SunOS5.5 +# + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(GDEPTH)/gconfig/SunOS5.mk + +ifeq ($(OS_RELEASE),5.5) + OS_DEFINES += -DSOLARIS2_5 +endif diff --git a/gconfig/SunOS5.6.mk b/gconfig/SunOS5.6.mk new file mode 100644 index 00000000000..8190daeee58 --- /dev/null +++ b/gconfig/SunOS5.6.mk @@ -0,0 +1,27 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + + +# +# Config stuff for SunOS5.6 +# + +SOL_CFLAGS += -D_SVID_GETTOD + +include $(GDEPTH)/gconfig/SunOS5.mk + +ifeq ($(OS_RELEASE),5.6) + OS_DEFINES += -DSOLARIS2_6 +endif diff --git a/gconfig/SunOS5.6_i86pc.mk b/gconfig/SunOS5.6_i86pc.mk new file mode 100644 index 00000000000..62fe727f8c5 --- /dev/null +++ b/gconfig/SunOS5.6_i86pc.mk @@ -0,0 +1,29 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for Solaris 2.6 on x86 +# + +SOL_CFLAGS = -D_SVID_GETTOD + +include $(GDEPTH)/gconfig/SunOS5.mk + +CPU_ARCH = x86 +OS_DEFINES += -Di386 + +ifeq ($(OS_RELEASE),5.6_i86pc) + OS_DEFINES += -DSOLARIS2_6 +endif diff --git a/gconfig/SunOS5.mk b/gconfig/SunOS5.mk new file mode 100644 index 00000000000..594cd53fcfe --- /dev/null +++ b/gconfig/SunOS5.mk @@ -0,0 +1,109 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for SunOS5.x +# + +include $(GDEPTH)/gconfig/UNIX.mk + +# +# XXX +# Temporary define for the Client; to be removed when binary release is used +# +ifdef MOZILLA_CLIENT + LOCAL_THREADS_ONLY = 1 + ifndef NS_USE_NATIVE + NS_USE_GCC = 1 + endif +endif + +# +# The default implementation strategy for Solaris is classic nspr. +# +ifeq ($(USE_PTHREADS),1) + IMPL_STRATEGY = _PTH +else + ifeq ($(LOCAL_THREADS_ONLY),1) + IMPL_STRATEGY = _LOCAL + DEFINES += -D_PR_LOCAL_THREADS_ONLY + else + DEFINES += -D_PR_GLOBAL_THREADS_ONLY + endif +endif + +# +# XXX +# Temporary define for the Client; to be removed when binary release is used +# +ifdef MOZILLA_CLIENT + IMPL_STRATEGY = +endif + +DEFAULT_COMPILER = cc + +ifdef NS_USE_GCC + CC = gcc + OS_CFLAGS += -Wall -Wno-format + CCC = g++ + CCC += -Wall -Wno-format + ASFLAGS += -x assembler-with-cpp + ifdef NO_MDUPDATE + OS_CFLAGS += $(NOMD_OS_CFLAGS) + else + OS_CFLAGS += $(NOMD_OS_CFLAGS) -MDupdate $(DEPENDENCIES) + endif +else + CC = cc + CCC = CC + ASFLAGS += -Wa,-P + OS_CFLAGS += $(NOMD_OS_CFLAGS) + ifndef BUILD_OPT + OS_CFLAGS += -xs + endif + +endif + +INCLUDES += -I/usr/dt/include -I/usr/openwin/include + +RANLIB = echo +CPU_ARCH = sparc +OS_DEFINES += -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS + +ifneq ($(LOCAL_THREADS_ONLY),1) + OS_DEFINES += -D_REENTRANT +endif + +# Purify doesn't like -MDupdate +NOMD_OS_CFLAGS += $(DSO_CFLAGS) $(OS_DEFINES) $(SOL_CFLAGS) + +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) + +# ld options: +# -G: produce a shared object +# -z defs: no unresolved symbols allowed +DSO_LDOPTS += -G + +# -KPIC generates position independent code for use in shared libraries. +# (Similarly for -fPIC in case of gcc.) +ifdef NS_USE_GCC + DSO_CFLAGS += -fPIC +else + DSO_CFLAGS += -KPIC +endif + +HAVE_PURIFY = 1 +NOSUCHFILE = /solaris-rm-f-sucks diff --git a/gconfig/UNIX.mk b/gconfig/UNIX.mk new file mode 100644 index 00000000000..0ac0fb39a7c --- /dev/null +++ b/gconfig/UNIX.mk @@ -0,0 +1,69 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +XP_DEFINE += -DXP_UNIX +LIB_SUFFIX = a +DLL_SUFFIX = so +AR = ar +AR += cr $@ +LDOPTS += -L$(SOURCE_LIB_DIR) + +ifdef BUILD_OPT + OPTIMIZER += -O + DEFINES += -UDEBUG -DNDEBUG +else + OPTIMIZER += -g + DEFINES += -DDEBUG -UNDEBUG -DDEBUG_$(shell whoami) +endif + +NSINSTALL_DIR = $(GDEPTH)/gconfig/nsinstall +NSINSTALL = $(NSINSTALL_DIR)/$(OBJDIR_NAME)/nsinstall + +MKDEPEND_DIR = $(GDEPTH)/gconfig/mkdepend +MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend +MKDEPENDENCIES = $(NSINSTALL_DIR)/$(OBJDIR_NAME)/depend.mk + +#################################################################### +# +# One can define the makefile variable NSDISTMODE to control +# how files are published to the 'dist' directory. If not +# defined, the default is "install using relative symbolic +# links". The two possible values are "copy", which copies files +# but preserves source mtime, and "absolute_symlink", which +# installs using absolute symbolic links. The "absolute_symlink" +# option requires NFSPWD. +# - THIS IS NOT PART OF THE NEW BINARY RELEASE PLAN for 9/30/97 +# - WE'RE KEEPING IT ONLY FOR BACKWARDS COMPATIBILITY +#################################################################### + +ifeq ($(NSDISTMODE),copy) + # copy files, but preserve source mtime + INSTALL = $(NSINSTALL) + INSTALL += -t +else + ifeq ($(NSDISTMODE),absolute_symlink) + # install using absolute symbolic links + INSTALL = $(NSINSTALL) + INSTALL += -L `$(NFSPWD)` + else + # install using relative symbolic links + INSTALL = $(NSINSTALL) + INSTALL += -R + endif +endif + +define MAKE_OBJDIR +if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi +endef diff --git a/gconfig/UNIXWARE2.1.mk b/gconfig/UNIXWARE2.1.mk new file mode 100644 index 00000000000..7b219004c6b --- /dev/null +++ b/gconfig/UNIXWARE2.1.mk @@ -0,0 +1,33 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Config stuff for SCO Unixware 2.1 +# + +include $(GDEPTH)/gconfig/UNIX.mk + +DEFAULT_COMPILER = $(GDEPTH)/build/hcc + +CC = $(GDEPTH)/build/hcc +CCC = $(GDEPTH)/build/hcpp +RANLIB = true +OS_CFLAGS = -KPIC -DSVR4 -DSYSV -DUNIXWARE +MKSHLIB = $(LD) +MKSHLIB += $(DSO_LDOPTS) +DSO_LDOPTS += -G +CPU_ARCH = x86 +ARCH = sco +NOSUCHFILE = /solaris-rm-f-sucks diff --git a/gconfig/WIN16.mk b/gconfig/WIN16.mk new file mode 100644 index 00000000000..64347b2feab --- /dev/null +++ b/gconfig/WIN16.mk @@ -0,0 +1,109 @@ +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +# + +# +# win16_3.11.mk -- Make configuration for Win16 +# +# This file configures gmake to build the Win16 variant of +# NSPR 2.0. This file has the function of two files commonly +# used on other platforms, for example: winnt.mk and +# winnt4.0.mk. ... The packaging is easier and there is only +# one variant of the Win16 target. +# +# Win16 is built using the Watcom C/C++ version 11.0 +# compiler. You gotta set up the compiler first. Follow the +# directions in the manual (Ha! ... really, its not a +# problem). The Watcom compiler depends on a few environment +# variables; these environment variables define where the +# compiler components are installed; they must be set before +# running the make. +# +# Notes: +# OS_CFLAGS is the command line options for the compiler when +# building the .DLL object files. +# OS_EXE_CFLAGS is the command line options for the compiler +# when building the .EXE object files; this is for the test +# programs. +# the macro OS_CFLAGS is set to OS_EXE_CFLAGS inside of the +# makefile for the pr/tests directory. ... Hack. +# +# +# +# + +# -- configuration ----------------------------------------- + +DEFAULT_COMPILER = wcc + +CC = wcc +CCC = wcl +LINK = wlink +AR = wlib +AR += -q $@ +RC = wrc.exe +RC += /r /dWIN16=1 /bt=windows +RANLIB = echo +BSDECHO = echo +NSINSTALL_DIR = $(GDEPTH)/gconfig/nsinstall +NSINSTALL = nsinstall +INSTALL = $(NSINSTALL) +MAKE_OBJDIR = mkdir +MAKE_OBJDIR += $(OBJDIR) +XP_DEFINE += -DXP_PC +LIB_SUFFIX = lib +DLL_SUFFIX = dll + +ifdef BUILD_OPT + OPTIMIZER = -oneatx -oh -oi -ei -3 -fpi87 -fp3 +else + OPTIMIZER += -d2 -hc -DDEBUG +# OPTIMIZER += -d2 -hw -DDEBUG +# LDFLAGS += -DEBUG -DEBUGTYPE:CV +endif + +# XXX FIXME: I doubt we use this. It is redundant with +# SHARED_LIBRARY. +ifdef DLL + DLL := $(addprefix $(OBJDIR)/, $(DLL)) +endif + + +# +# $(CPU_ARCH) has been commented out so that its contents +# are not added to the WIN16_?.OBJ names thus expanding +# them beyond the 8.3 character limit for this platform. +# +#CPU_ARCH = x386 +# +# added "-s" to avoid dependency on watcom's libs (e.g. on _STK) +# added "-zt3" for compatibility with MSVC's "/Gt3" option +# +OS_CFLAGS += -ml -3 -bd -zc -zu -bt=windows -s -zt3 -d_X86_ -dWIN16 -d_WINDLL +#OS_EXE_CFLAGS += -ml -3 -bt=windows -d_X86_ -dWIN16 +OS_LIB_FLAGS = -c -iro + +# Name of the binary code directories +OS_DLL_OPTION = CASEEXACT +OS_DLLFLAGS = +OS_LIBS = +W16_EXPORTS = # + +# +# The following is NOT needed for the NSPR 2.0 library. +# + +OS_CFLAGS += -d_WINDOWS -d_MSC_VER=700 diff --git a/gconfig/WIN32.mk b/gconfig/WIN32.mk new file mode 100644 index 00000000000..1c84d53b730 --- /dev/null +++ b/gconfig/WIN32.mk @@ -0,0 +1,86 @@ +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +# + +# +# Configuration common to all versions of Windows NT +# and Windows 95 +# + +DEFAULT_COMPILER = cl + +CC = cl +CCC = cl +LINK = link +AR = lib +AR += -NOLOGO -OUT:"$@" +RANLIB = echo +BSDECHO = echo +NSINSTALL_DIR = $(GDEPTH)/gconfig/nsinstall +NSINSTALL = nsinstall +INSTALL = $(NSINSTALL) +MAKE_OBJDIR = mkdir +MAKE_OBJDIR += $(OBJDIR) +RC = rc.exe +GARBAGE += $(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb +MAPFILE = $(PROGRAM:.exe=.map) +MAP = /MAP:$(MAPFILE) +PDBFILE = $(PROGRAM:.exe=.pdb) +PDB = /PDB:$(PDBFILE) +IMPFILE = $(PROGRAM:.exe=.lib) +IMP = /IMPLIB:$(IMPFILE) +XP_DEFINE += -DXP_PC +LIB_SUFFIX = lib +DLL_SUFFIX = dll +OUT_NAME = -out: + +OS_LIBS = gdi32.lib kernel32.lib advapi32.lib user32.lib + +ifdef BUILD_OPT + OS_CFLAGS += -MD + OPTIMIZER += -O2 + DEFINES += -UDEBUG -U_DEBUG -DNDEBUG + DLLFLAGS += -OUT:"$@" +else + # + # Define USE_DEBUG_RTL if you want to use the debug runtime library + # (RTL) in the debug build + # + ifdef USE_DEBUG_RTL + OS_CFLAGS += -MDd + else + OS_CFLAGS += -MD + endif + OPTIMIZER += -Od -Z7 + #OPTIMIZER += -Zi -Fd$(OBJDIR)/ -Od + DEFINES += -DDEBUG -D_DEBUG -UNDEBUG + DLLFLAGS += -DEBUG -DEBUGTYPE:CV -OUT:"$@" + LDFLAGS += -DEBUG -DEBUGTYPE:BOTH /SUBSYSTEM:CONSOLE /NOLOGO +endif + +# XXX FIXME: I doubt we use this. It is redundant with +# SHARED_LIBRARY. +ifdef DLL + DLL := $(addprefix $(OBJDIR)/, $(DLL)) +endif + +DEFINES += -DWIN32 + +# +# The following is NOT needed for the NSPR 2.0 library. +# + +DEFINES += -D_WINDOWS diff --git a/gconfig/WIN954.0.mk b/gconfig/WIN954.0.mk new file mode 100644 index 00000000000..a33daf6102a --- /dev/null +++ b/gconfig/WIN954.0.mk @@ -0,0 +1,47 @@ +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +# + +# +# Config stuff for WIN95 +# +# This makefile defines the following variables: +# CPU_ARCH, OS_CFLAGS, and OS_DLLFLAGS. +# PROCESSOR is an internal variable. + +include $(GDEPTH)/gconfig/WIN32.mk + +PROCESSOR := $(shell uname -p) +ifeq ($(PROCESSOR), I386) + CPU_ARCH = x386 + OS_CFLAGS += -W3 -nologo -D_X86_ +else + ifeq ($(PROCESSOR), MIPS) + CPU_ARCH = MIPS + #OS_CFLAGS += -W3 -nologo -D_MIPS_ + OS_CFLAGS += -W3 -nologo + else + ifeq ($(PROCESSOR), ALPHA) + CPU_ARCH = ALPHA + OS_CFLAGS += -W3 -nologo -D_ALPHA_=1 + else + CPU_ARCH = processor_is_undefined + endif + endif +endif + +OS_DLLFLAGS += -nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE +DEFINES += -DWIN95 diff --git a/gconfig/WINNT3.51.mk b/gconfig/WINNT3.51.mk new file mode 100644 index 00000000000..c0a89908ed4 --- /dev/null +++ b/gconfig/WINNT3.51.mk @@ -0,0 +1,54 @@ +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +# + +# +# Config stuff for WINNT 3.51 +# +# This makefile defines the following variables: +# CPU_ARCH, OS_CFLAGS, and OS_DLLFLAGS. +# It has the following internal variables: +# OS_PROC_CFLAGS and OS_WIN_CFLAGS. + +include $(GDEPTH)/gconfig/WIN32.mk + +PROCESSOR := $(shell uname -p) +ifeq ($(PROCESSOR), I386) + CPU_ARCH = x386 + OS_PROC_CFLAGS += -D_X86_ +else + ifeq ($(PROCESSOR), MIPS) + CPU_ARCH = MIPS + OS_PROC_CFLAGS += -D_MIPS_ + else + ifeq ($(PROCESSOR), ALPHA) + CPU_ARCH = ALPHA + OS_PROC_CFLAGS += -D_ALPHA_ + else + CPU_ARCH = processor_is_undefined + endif + endif +endif + +OS_WIN_CFLAGS += -W3 +OS_CFLAGS += -nologo $(OS_WIN_CFLAGS) $(OS_PROC_CFLAGS) +#OS_DLLFLAGS += -nologo -DLL -PDB:NONE -SUBSYSTEM:WINDOWS +OS_DLLFLAGS += -nologo -DLL -PDB:NONE -SUBSYSTEM:WINDOWS +# +# Win NT needs -GT so that fibers can work +# +OS_CFLAGS += -GT +OS_CFLAGS += -DWINNT diff --git a/gconfig/WINNT4.0.mk b/gconfig/WINNT4.0.mk new file mode 100644 index 00000000000..dff24bf980d --- /dev/null +++ b/gconfig/WINNT4.0.mk @@ -0,0 +1,51 @@ +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +# + +# +# Config stuff for WINNT 4.0 +# +# This makefile defines the following variables: +# CPU_ARCH, OS_CFLAGS, and OS_DLLFLAGS. +# PROCESSOR is an internal variable. + +include $(GDEPTH)/gconfig/WIN32.mk + +PROCESSOR := $(shell uname -p) +ifeq ($(PROCESSOR), I386) + CPU_ARCH = x386 + OS_CFLAGS += -W3 -nologo -D_X86_ +else + ifeq ($(PROCESSOR), MIPS) + CPU_ARCH = MIPS + #OS_CFLAGS += -W3 -nologo -D_MIPS_ + OS_CFLAGS += -W3 -nologo + else + ifeq ($(PROCESSOR), ALPHA) + CPU_ARCH = ALPHA + OS_CFLAGS += -W3 -nologo -D_ALPHA_=1 + else + CPU_ARCH = processor_is_undefined + endif + endif +endif + +OS_DLLFLAGS += -nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE +# +# Win NT needs -GT so that fibers can work +# +OS_CFLAGS += -GT +OS_CFLAGS += -DWINNT diff --git a/gconfig/arch.mk b/gconfig/arch.mk new file mode 100644 index 00000000000..d8eaddb8651 --- /dev/null +++ b/gconfig/arch.mk @@ -0,0 +1,286 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Master "Core Components" macros for getting the OS architecture # +####################################################################### + +# +# Macros for getting the OS architecture +# + +OS_ARCH := $(subst /,_,$(shell uname -s)) + +# +# Attempt to differentiate between sparc and x86 Solaris +# + +OS_TEST := $(shell uname -m) +ifeq ($(OS_TEST),i86pc) + OS_RELEASE := $(shell uname -r)_$(OS_TEST) +else + OS_RELEASE := $(shell uname -r) +endif + +# +# Force the IRIX64 machines to use IRIX. +# + +ifeq ($(OS_ARCH),IRIX64) + OS_ARCH = IRIX +endif + +# +# Force the newer BSDI versions to use the old arch name. +# + +ifeq ($(OS_ARCH),BSD_OS) + OS_ARCH = BSD_386 +endif + +# +# Drop all but the major revision for FreeBSD releases. +# +# Handle one dot (2.2-STABLE) and two dot (2.2.5-RELEASE) forms. +# + +ifeq ($(OS_ARCH),FreeBSD) + OS_RELEASE := $(basename $(shell uname -r)) + NEW_OS_RELEASE := $(basename $(OS_RELEASE)) + ifneq ($(NEW_OS_RELEASE),"") + OS_RELEASE := $(NEW_OS_RELEASE) + endif +endif + +# +# Catch NCR butchering of SVR4 +# + +ifeq ($(OS_ARCH),UNIX_SV) + ifneq ($(findstring NCR, $(shell grep NCR /etc/bcheckrc | head -1 )),) + OS_ARCH = NCR + else + # Make UnixWare something human readable + OS_ARCH = UNIXWARE + endif + + # Get the OS release number, not 4.2 + OS_RELEASE := $(shell uname -v) +endif + +ifeq ($(OS_ARCH),UNIX_System_V) + OS_ARCH = NEC +endif + +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 + +ifeq (osfmach3,$(findstring osfmach3,$(OS_RELEASE))) + OS_RELEASE = ppc +endif + +# +# SINIX changes name to ReliantUNIX with 5.43 +# + +ifeq ($(OS_ARCH),ReliantUNIX-N) + OS_ARCH = ReliantUNIX + OS_RELEASE = 5.4 +endif + +ifeq ($(OS_ARCH),SINIX-N) + OS_ARCH = ReliantUNIX + OS_RELEASE = 5.4 +endif + +# +# OS_OBJTYPE is used only by Linux +# + +ifeq ($(OS_ARCH),Linux) + OS_OBJTYPE = ELF + OS_RELEASE := $(basename $(OS_RELEASE)) +endif + +####################################################################### +# Master "Core Components" macros for getting the OS target # +####################################################################### + +# +# Note: OS_TARGET should be specified on the command line for gmake. +# When OS_TARGET=WIN95 is specified, then a Windows 95 target is built. +# The difference between the Win95 target and the WinNT target is that +# the WinNT target uses Windows NT specific features not available +# in Windows 95. The Win95 target will run on Windows NT, but (supposedly) +# at lesser performance (the Win95 target uses threads; the WinNT target +# uses fibers). +# +# When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target +# is built. See: win16_3.11.mk for lots more about the Win16 target. +# +# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no +# cross-compilation. +# + +# +# The following hack allows one to build on a WIN95 machine (as if +# s/he were cross-compiling on a WINNT host for a WIN95 target). +# It also accomodates for MKS's uname.exe. If you never intend +# to do development on a WIN95 machine, you don't need this hack. +# +ifeq ($(OS_ARCH),WIN95) + OS_ARCH = WINNT + OS_TARGET = WIN95 +endif +ifeq ($(OS_ARCH),Windows_95) + OS_ARCH = Windows_NT + OS_TARGET = WIN95 +endif + +# +# On WIN32, we also define the variable CPU_ARCH. +# + +ifeq ($(OS_ARCH), WINNT) + CPU_ARCH := $(shell uname -p) + ifeq ($(CPU_ARCH),I386) + CPU_ARCH = x386 + endif +else +# +# If uname -s returns "Windows_NT", we assume that we are using +# the uname.exe in MKS toolkit. +# +# The -r option of MKS uname only returns the major version number. +# So we need to use its -v option to get the minor version number. +# Moreover, it doesn't have the -p option, so we need to use uname -m. +# +ifeq ($(OS_ARCH), Windows_NT) + OS_ARCH = WINNT + OS_MINOR_RELEASE := $(shell uname -v) + ifeq ($(OS_MINOR_RELEASE),00) + OS_MINOR_RELEASE = 0 + endif + OS_RELEASE = $(OS_RELEASE).$(OS_MINOR_RELEASE) + CPU_ARCH := $(shell uname -m) + # + # MKS's uname -m returns "586" on a Pentium machine. + # + ifneq (,$(findstring 86,$(CPU_ARCH))) + CPU_ARCH = x386 + endif +endif +endif + +ifndef OS_TARGET + OS_TARGET = $(OS_ARCH) +endif + +ifeq ($(OS_TARGET), WIN95) + OS_RELEASE = 4.0 +endif + +ifeq ($(OS_TARGET), WIN16) + OS_RELEASE = +# OS_RELEASE = _3.11 +endif + +# +# This variable is used to get OS_CONFIG.mk. +# + +OS_CONFIG = $(OS_TARGET)$(OS_OBJTYPE)$(OS_RELEASE) + +# +# OBJDIR_TAG depends on the predefined variable BUILD_OPT, +# to distinguish between debug and release builds. +# + +ifdef BUILD_OPT + ifeq ($(OS_TARGET),WIN16) + OBJDIR_TAG = _O + else + OBJDIR_TAG = _OPT + endif + CONFIG_OBJDIR_TAG = _O +else + ifeq ($(OS_TARGET),WIN16) + OBJDIR_TAG = _D + else + OBJDIR_TAG = _DBG + endif + CONFIG_OBJDIR_TAG = _D +endif + +# +# The following flags are defined in the individual $(OS_CONFIG).mk +# files. +# +# CPU_TAG is defined if the CPU is not the most common CPU. +# COMPILER_TAG is defined if the compiler is not the native compiler. +# IMPL_STRATEGY may be defined too. +# + +# Name of the binary code directories +ifeq ($(OS_ARCH), WINNT) + ifeq ($(CPU_ARCH),x386) + OBJDIR_NAME = $(OS_CONFIG)$(OBJDIR_TAG).OBJ + else + OBJDIR_NAME = $(OS_CONFIG)$(CPU_ARCH)$(OBJDIR_TAG).OBJ + endif +else +endif + +OBJDIR_NAME = $(OS_CONFIG)$(CPU_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ + +ifeq ($(OS_ARCH), WINNT) +ifneq ($(OS_TARGET),WIN16) +ifndef BUILD_OPT +# +# Define USE_DEBUG_RTL if you want to use the debug runtime library +# (RTL) in the debug build +# +ifdef USE_DEBUG_RTL + OBJDIR_NAME = $(OS_CONFIG)$(CPU_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJD +endif +endif +endif +endif + +# XXX - Need this for compatibility with old 'config' build system +# when your module needs them + +ifeq ($(OS_ARCH), WINNT) +CONFIG_OBJDIR_NAME = Win32$(CONFIG_OBJDIR_TAG).OBJ +# XXX - Since Julian depends on raptor, mind as well share +OBJDIR_NAME = Win32$(CONFIG_OBJDIR_TAG).OBJ +else +CONFIG_OBJDIR_NAME = $(OBJDIR_NAME) +endif \ No newline at end of file diff --git a/gconfig/command.mk b/gconfig/command.mk new file mode 100644 index 00000000000..d6950730bea --- /dev/null +++ b/gconfig/command.mk @@ -0,0 +1,38 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Master "Core Components" default command macros; # +# can be overridden in .mk # +####################################################################### + +AS = $(CC) +ASFLAGS += $(CFLAGS) +CCF = $(CC) $(CFLAGS) +PURIFY = purify $(PURIFYOPTIONS) +LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS) +LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS) +NFSPWD = $(NSINSTALL_DIR)/nfspwd +CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \ + $(XCFLAGS) +RANLIB = echo +JAR = /bin/jar +TAR = /bin/tar +# +# For purify +# +NOMD_CFLAGS += $(OPTIMIZER) $(NOMD_OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \ + $(XCFLAGS) + diff --git a/gconfig/config.mk b/gconfig/config.mk new file mode 100644 index 00000000000..7e9de0e9b95 --- /dev/null +++ b/gconfig/config.mk @@ -0,0 +1,117 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# Configuration information for building in the "Core Components" source module +# + +####################################################################### +# [1.0] Master "Core Components" source and release # +# tags # +####################################################################### + +include $(GDEPTH)/gconfig/arch.mk + +####################################################################### +# [2.0] Master "Core Components" default command macros # +# (NOTE: may be overridden in $(OS_CONFIG).mk) # +####################################################################### + +include $(GDEPTH)/gconfig/command.mk + +####################################################################### +# [3.0] Master "Core Components" -specific macros # +# (dependent upon tags) # +####################################################################### + +include $(GDEPTH)/gconfig/$(OS_CONFIG).mk + +####################################################################### +# [4.0] Master "Core Components" source and release tags # +# (dependent upon tags) # +####################################################################### + +include $(GDEPTH)/gconfig/platform.mk + +####################################################################### +# [5.0] Master "Core Components" release tags # +# (dependent upon tags) # +####################################################################### + +include $(GDEPTH)/gconfig/tree.mk + +####################################################################### +# [6.0] Master "Core Components" source and release tags # +# NOTE: A component is also called a module or a subsystem. # +# (dependent upon $(MODULE) being defined on the # +# command line, as an environment variable, or in individual # +# makefiles, or more appropriately, manifest.mn) # +####################################################################### + +include $(GDEPTH)/gconfig/module.mk + +####################################################################### +# [7.0] Master "Core Components" release tags # +# (dependent upon $(MODULE) being defined on the # +# command line, as an environment variable, or in individual # +# makefiles, or more appropriately, manifest.mn) # +####################################################################### + +include $(GDEPTH)/gconfig/version.mk + +####################################################################### +# [8.0] Master "Core Components" macros to figure out # +# binary code location # +# (dependent upon tags) # +####################################################################### + +include $(GDEPTH)/gconfig/location.mk + +####################################################################### +# [9.0] Master "Core Components" -specific source path # +# (dependent upon , , # +# , and tags) # +####################################################################### + +include $(GDEPTH)/gconfig/source.mk + +####################################################################### +# [10.0] Master "Core Components" include switch for support header # +# files # +# (dependent upon , , , # +# and tags) # +####################################################################### + +include $(GDEPTH)/gconfig/headers.mk + +####################################################################### +# [11.0] Master "Core Components" for computing program prefixes # +####################################################################### + +include $(GDEPTH)/gconfig/prefix.mk + +####################################################################### +# [12.0] Master "Core Components" for computing program suffixes # +# (dependent upon tags) # +####################################################################### + +include $(GDEPTH)/gconfig/suffix.mk + +####################################################################### +# [13.0] Master "Core Components" rule set # +# (should always be the last file included by config.mk) # +####################################################################### + +include $(GDEPTH)/gconfig/ruleset.mk diff --git a/gconfig/coreconf.pl b/gconfig/coreconf.pl new file mode 100644 index 00000000000..6f7cac4ba55 --- /dev/null +++ b/gconfig/coreconf.pl @@ -0,0 +1,139 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +sub recursive_copy { + local($fromdir); + local($todir); + local(@dirlist); + $fromdir = shift; + $todir = shift; + + print STDERR "recursive copy called with $fromdir, $todir\n"; + +#remove any trailing slashes. + $fromdir =~ s/\/$//; + $todir =~ s/\/$//; + + opendir(DIR, $fromdir); + @dirlist = readdir DIR; + close DIR; + + + foreach $file (@dirlist) { + if (! (($file eq "." ) || ($file eq "..") )) { + + if (-d "$fromdir/$file") { + print STDERR "handling directory $todir/$file\n"; + &rec_mkdir("$todir/$file"); + &recursive_copy("$fromdir/$file","$todir/$file"); + } + else { + print STDERR "handling file $fromdir/$file\n"; + &my_copy("$fromdir/$file","$todir/$file"); + } + } + } +} + +sub parse_argv { + +# print STDERR "Parsing Variables\n"; + + foreach $q ( @ARGV ) { + if (! ($q =~ /=/)) { + $var{$lastassigned} .= " $q"; + } + else { + $q =~ /^([^=]*)=(.*)/; + $left = $1; + $right = $2; + + $right =~ s/ *$//; + $var{$left} = $right; + + $lastassigned = $left; + + } + print STDERR "Assigned $lastassigned = $var{$lastassigned}\n"; + } +} + + +# usage: &my_copy("dir/fromfile","dir2/tofile"); +# do a 'copy' - files only, 'to' MUST be a filename, not a directory. + +# fix this to be able to use copy on win nt. + +sub my_copy { + local($from); + local($to); + local($cpcmd); + + $from = shift; + $to = shift; + + if ( ! defined $var{OS_ARCH}) { + die "OS_ARCH not defined!"; + } + else { + if ($var{OS_ARCH} eq 'WINNT') { + $cpcmd = 'cp'; + } + else { + $cpcmd = 'cp'; + } + print STDERR "COPYING: $cpcmd $from $to\n"; + system("$cpcmd $from $to"); + } +} + + +sub old_my_copy { + local($from); + local($to); + + $from = shift; + $to = shift; + open(FIN, "<$from") || die("Can't read from file $from\n"); + if ( ! open(FOUT,">$to")) { + close FIN; + die "Can't write to file $to\n"; + } + while (read(FIN, $buf, 100000)) { + print FOUT $buf; + } + close (FIN); + close (FOUT); +} + +sub rec_mkdir { + local($arg); + local($t); + local($q); + + $arg = shift; + $t = ""; + foreach $q (split(/\//,$arg)) { + $t .= $q; + if (! ($t =~ /\.\.$/)) { + if ($t =~ /./) { + mkdir($t,0775); + } + } + $t.= '/'; + } +} + +1; diff --git a/gconfig/cpdist.pl b/gconfig/cpdist.pl new file mode 100644 index 00000000000..56d1ec7153b --- /dev/null +++ b/gconfig/cpdist.pl @@ -0,0 +1,179 @@ +#! /usr/local/bin/perl +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +require('gconfig.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"); + + } + + } + diff --git a/gconfig/headers.mk b/gconfig/headers.mk new file mode 100644 index 00000000000..b6909ca2958 --- /dev/null +++ b/gconfig/headers.mk @@ -0,0 +1,38 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Master "Core Components" include switch for support header files # +####################################################################### + +# +# Always append source-side machine-dependent (md) and cross-platform +# (xp) include paths +# + +INCLUDES += -I$(SOURCE_MDHEADERS_DIR) + +ifneq ($(OS_TARGET),WIN16) +INCLUDES += -I$(SOURCE_XPHEADERS_DIR) +endif + +# +# Only append source-side private cross-platform include paths for +# sectools +# + +ifeq ($(MODULE), sectools) + INCLUDES += -I$(SOURCE_XPPRIVATE_DIR) +endif diff --git a/gconfig/import.pl b/gconfig/import.pl new file mode 100644 index 00000000000..67b2819a370 --- /dev/null +++ b/gconfig/import.pl @@ -0,0 +1,190 @@ +#! /usr/local/bin/perl +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +print STDERR "import.pl\n"; + +require('gconfig.pl'); + + +$returncode =0; + + +#######-- read in variables on command line into %var + +$var{ZIP} = "zip"; +$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 = ; + $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 (-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 = ; + 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); + + + + + diff --git a/gconfig/location.mk b/gconfig/location.mk new file mode 100644 index 00000000000..cfd83cc2c39 --- /dev/null +++ b/gconfig/location.mk @@ -0,0 +1,38 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Master "Core Components" macros to figure out binary code location # +####################################################################### + +# +# Figure out where the binary code lives. +# + +BUILD = $(PLATFORM) +OBJDIR = $(PLATFORM) +DIST = $(GDEPTH)/dist/$(PLATFORM) +VPATH = $(NSINSTALL_DIR)/$(PLATFORM) +DEPENDENCIES = $(PLATFORM)/.md + +# XXX - Need this for compatibility with 'old' config style +# when your component requires something in the 'other' world +CONFIG_DIST = $(GDEPTH)/dist/$(CONFIG_PLATFORM) + +ifdef BUILD_DEBUG_GC + DEFINES += -DDEBUG_GC +endif + +GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) diff --git a/gconfig/makefile.win b/gconfig/makefile.win new file mode 100644 index 00000000000..68d42bfc5f0 --- /dev/null +++ b/gconfig/makefile.win @@ -0,0 +1,82 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# +# An NMAKE file to set up and adjust gconfig's build system for +# Client build. Client build should invoke NMAKE on this file +# instead of invoking gmake directly. +# + +DEPTH = .. +include <$(DEPTH)\config\config.mak> +#include <$(DEPTH)\config\rules.mak> + +# +# Backslashes are escape characters to gmake, so flip all backslashes +# in $(MOZ_TOOLS) to forward slashes and pass that to gmake. +# + +GMAKE = $(MOZ_TOOLS)\bin\gmake.exe MOZ_TOOLS_FLIPPED=$(MOZ_TOOLS:\=/) + +GMAKE = $(GMAKE) PR_CLIENT_BUILD=1 PR_CLIENT_BUILD_WINDOWS=1 + +# +# The Client's debug build uses MSVC's debug runtime library (/MDd). +# + +!ifdef MOZ_DEBUG +GMAKE = $(GMAKE) USE_DEBUG_RTL=1 +!else +GMAKE = $(GMAKE) BUILD_OPT=1 +!endif + +!if "$(MOZ_BITS)" == "16" +GMAKE = $(GMAKE) OS_TARGET=WIN16 +!else + +GMAKE = $(GMAKE) OS_TARGET=WIN95 +!ifdef MOZ_DEBUG +PR_OBJDIR = WIN954.0_DBG.OBJD +!else +PR_OBJDIR = WIN954.0_OPT.OBJ +!endif + +!endif + +# +# The rules. Simply invoke gmake with the same target +# for Win16, use the watcom compiler with the MSVC headers and libs +# + +# this rule is needed so that nmake with no explicit target will only build +# all, and not build all the targets named below in succession! +default:: all + +# a rule like this one must only be used for explicitly named targets! +all depend export libs install clobber clobber_all clean:: +!if "$(MOZ_BITS)" == "16" + set PATH=%WATCPATH% + set INCLUDE=%MSVC_INC% + set LIB=%MSVC_LIB% +!endif + $(GMAKE) $@ +!if "$(MOZ_BITS)" == "16" + set PATH=%MSVCPATH% + set INCLUDE=%MSVC_INC% + set LIB=%MSVC_LIB% +!endif + +show: + @echo "MAKEFLAGS = $(MAKEFLAGS)" diff --git a/gconfig/md/Makefile b/gconfig/md/Makefile new file mode 100644 index 00000000000..38e64ecfd5b --- /dev/null +++ b/gconfig/md/Makefile @@ -0,0 +1,65 @@ +#! gmake +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + + + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(GDEPTH)/gconfig/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### + +ifeq ($(OS_TARGET), WIN16) +BINREL_DIST = $(DIST) + +# must do this in the libs phase because DLLs get built there. +libs:: + $(INSTALL) watcomfx.lib $(DIST)/lib +endif + diff --git a/gconfig/md/manifest.mn b/gconfig/md/manifest.mn new file mode 100644 index 00000000000..1da4ba20760 --- /dev/null +++ b/gconfig/md/manifest.mn @@ -0,0 +1,19 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +GDEPTH = ../.. + +MODULE = gconfig + diff --git a/gconfig/md/watcomfx.lib b/gconfig/md/watcomfx.lib new file mode 100644 index 00000000000..be51e7a64cb Binary files /dev/null and b/gconfig/md/watcomfx.lib differ diff --git a/gconfig/mkdepend/Makefile b/gconfig/mkdepend/Makefile new file mode 100644 index 00000000000..8265864af57 --- /dev/null +++ b/gconfig/mkdepend/Makefile @@ -0,0 +1,42 @@ +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +# + +DEPTH = ../.. +GDEPTH = ../.. + +MODULE = gconfig + +CSRCS = cppsetup.c \ + ifparser.c \ + include.c \ + main.c \ + parse.c \ + pr.c \ + $(NULL) + +PROGRAM = mkdepend + +include $(GDEPTH)/gconfig/config.mk + +ifeq ($(OS_ARCH),WINNT) +PROGRAM = +endif + +DEFINES += -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\" -DNeedVarargsPrototypes + +include $(GDEPTH)/gconfig/rules.mk + diff --git a/gconfig/mkdepend/cppsetup.c b/gconfig/mkdepend/cppsetup.c new file mode 100644 index 00000000000..64c62110e2b --- /dev/null +++ b/gconfig/mkdepend/cppsetup.c @@ -0,0 +1,243 @@ +/* $XConsortium: cppsetup.c,v 1.13 94/04/17 20:10:32 gildea 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. + +*/ + +#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 pdp11 | vax | ns16000 | mc68000 | 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; + +boolean +cppsetup( + register char *line, + register struct filepointer *filep, + register struct inclist *inc) +{ + register 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( + 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); +} + +void +pperror(int tag, int x0,int x1,int x2,int x3, int x4) + +{ + warning("\"%s\", line %d: ", currentinc->i_file, currentfile->f_line); + warning(x0,x1,x2,x3,x4); +} + +void +yyerror(register char *s) +{ + fatalerr("Fatal error: %s\n", s); +} +#else /* not CPP */ + +#include "ifparser.h" +struct _parse_data { + struct filepointer *filep; + struct inclist *inc; + 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->inc->i_file; + 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 int +_my_eval_variable ( + IfParser *ip, + const char *var, + int len) +{ + struct symtab *s; + + s = _lookup_variable (ip, var, len); + if (!s) + return 0; + do { + var = s->s_value; + if (!isvarfirstletter(*var)) + break; + s = _lookup_variable (ip, var, strlen(var)); + } while (s); + + return atoi(var); +} + +int +cppsetup( + register char *line, + register struct filepointer *filep, + register struct inclist *inc) +{ + IfParser ip; + struct _parse_data pd; + int val = 0; + + pd.filep = filep; + pd.inc = inc; + pd.line = line; + 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 */ + diff --git a/gconfig/mkdepend/def.h b/gconfig/mkdepend/def.h new file mode 100644 index 00000000000..b1ef72b1d41 --- /dev/null +++ b/gconfig/mkdepend/def.h @@ -0,0 +1,148 @@ +/* $XConsortium: def.h,v 1.25 94/04/17 20:10:33 gildea 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. + +*/ + +#include +#ifdef WIN32 +#include +#endif +#include +#include +#include +#ifndef X_NOT_POSIX +#ifndef _POSIX_SOURCE +#define _POSIX_SOURCE +#endif +#endif +#include +#include +#include +#include + +#define MAXDEFINES 512 +#define MAXFILES 1024 /* Increased from 512. -mcafee */ +#define MAXDIRS 64 +#define SYMTABINC 10 /* must be > 1 for define() to work right */ +#define TRUE 1 +#define FALSE 0 + +/* the following must match the directives table in main.c */ +#define IF 0 +#define IFDEF 1 +#define IFNDEF 2 +#define ELSE 3 +#define ENDIF 4 +#define DEFINE 5 +#define UNDEF 6 +#define INCLUDE 7 +#define LINE 8 +#define PRAGMA 9 +#define ERROR 10 +#define IDENT 11 +#define SCCS 12 +#define ELIF 13 +#define EJECT 14 +#define IFFALSE 15 /* pseudo value --- never matched */ +#define ELIFFALSE 16 /* pseudo value --- never matched */ +#define INCLUDEDOT 17 /* pseudo value --- never matched */ +#define IFGUESSFALSE 18 /* pseudo value --- never matched */ +#define ELIFGUESSFALSE 19 /* 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; +}; + +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 */ + int i_ndefs; /* current # defines */ + int i_deflen; /* amount of space in table */ + boolean i_defchecked; /* whether defines have been checked */ + boolean i_notified; /* whether we have revealed includes */ + boolean i_marked; /* whether it's in the makefile */ + boolean i_searched; /* whether we have read this */ + boolean i_included_sym; /* whether #include SYMBOL was found */ + /* Can't use i_list if TRUE */ +}; + +struct filepointer { + char *f_p; + char *f_base; + char *f_end; + long f_len; + long f_line; +}; + +#ifndef X_NOT_STDC_ENV +#include +#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */ +char *malloc(), *realloc(); +#endif /* macII */ +#else +char *malloc(); +char *realloc(); +#endif + +char *copy(register char *str); +char *base_name(register char *file); +char *getline(register struct filepointer *filep); +struct symtab *slookup(register char *symbol, register struct inclist *file); +struct symtab *isdefined(register char *symbol, struct inclist *file, + struct inclist **srcfile); +struct symtab *fdefined(register char *symbol, struct inclist *file, + struct inclist **srcfile); +struct filepointer *getfile(char *file); +struct inclist *newinclude(register char *newfile, register char * incstring); +struct inclist *inc_path(register char *file, register char *include, boolean dot); + +#if NeedVarargsPrototypes +extern int fatalerr(char *, ...); +extern void warning(char *, ...); +extern void warning1(char *, ...); +#endif diff --git a/gconfig/mkdepend/ifparser.c b/gconfig/mkdepend/ifparser.c new file mode 100644 index 00000000000..05afa140648 --- /dev/null +++ b/gconfig/mkdepend/ifparser.c @@ -0,0 +1,462 @@ +/* + * $XConsortium: ifparser.c,v 1.8 95/06/03 00:01:41 gildea 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 ')' + * | '!' VALUE + * | '-' VALUE + * | 'defined' '(' variable ')' + * | 'defined' variable + * | # variable '(' variable-list ')' + * | variable + * | number + * + * BINOP := '*' | '/' | '%' + * | '+' | '-' + * | '<<' | '>>' + * | '<' | '>' | '<=' | '>=' + * | '==' | '!=' + * | '&' | '|' + * | '&&' | '||' + * + * The normal C order of precidence is supported. + * + * + * External Entry Points: + * + * ParseIfExpression parse a string for #if + */ + +#include "ifparser.h" +#include +/**************************************************************************** + 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) == '_') + +#ifdef IRIX_N32 +/* + * Stupid new compiler on IRIX CC requires everything to be ANSI compliant + * and for some reason when I include stdlib.h some symbols get multiply defined. + * Why can't they just use the stupid C compiler instead of C++ on C. + */ +extern "C" int atoi(const char *str); +extern "C" int strncmp (const char *s1, const char *s2, size_t n); +#endif + +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, + int *valp) +{ + SKIPSPACE (cp); + + if (!isdigit(*cp)) + return CALLFUNC(g, handle_error) (g, cp, "number"); + +#ifdef WIN32 + *valp = strtol(cp, &cp, 0); +#else + *valp = atoi (cp); + /* EMPTY */ + for (cp++; isdigit(*cp); cp++) ; +#endif + return cp; +} + + +static const char * +parse_value ( + IfParser *g, + const char *cp, + int *valp) +{ + const char *var; + + *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_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 '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)); + *valp = (*(g->funcs.eval_variable)) (g, var, cp - var); + } + + return cp; +} + + + +static const char * +parse_product ( + IfParser *g, + const char *cp, + int *valp) +{ + int 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)); + *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, + int *valp) +{ + int 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, + int *valp) +{ + int 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, + int *valp) +{ + int 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, + int *valp) +{ + int 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, + int *valp) +{ + int 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_bor ( + IfParser *g, + const char *cp, + int *valp) +{ + int rightval; + + DO (cp = parse_band (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, + int *valp) +{ + int 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, + int *valp) +{ + int 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; +} + + +/**************************************************************************** + External Entry Points + ****************************************************************************/ + +const char * +ParseIfExpression ( + IfParser *g, + const char *cp, + int *valp) +{ + return parse_lor (g, cp, valp); +} + + diff --git a/gconfig/mkdepend/ifparser.h b/gconfig/mkdepend/ifparser.h new file mode 100644 index 00000000000..a036240ad8c --- /dev/null +++ b/gconfig/mkdepend/ifparser.h @@ -0,0 +1,76 @@ +/* + * $XConsortium: ifparser.h,v 1.1 92/08/22 13:05:39 rws 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 ')' + * | '!' VALUE + * | '-' VALUE + * | 'defined' '(' variable ')' + * | variable + * | number + * + * BINOP := '*' | '/' | '%' + * | '+' | '-' + * | '<<' | '>>' + * | '<' | '>' | '<=' | '>=' + * | '==' | '!=' + * | '&' | '|' + * | '&&' | '||' + * + * The normal C order of precidence is supported. + * + * + * External Entry Points: + * + * ParseIfExpression parse a string for #if + */ + +#include + +#define const /**/ +typedef int Bool; +#define False 0 +#define True 1 + +typedef struct _if_parser { + struct { /* functions */ + char *(*handle_error) ( struct _if_parser *, const char *, + const char * ); + int (*eval_variable) ( struct _if_parser *, const char *, int ); + int (*eval_defined) ( struct _if_parser *, const char *, int ); + } funcs; + char *data; +} IfParser; + +char *ParseIfExpression (IfParser *, const char *, int *); + diff --git a/gconfig/mkdepend/imakemdep.h b/gconfig/mkdepend/imakemdep.h new file mode 100644 index 00000000000..3487c3c7ab0 --- /dev/null +++ b/gconfig/mkdepend/imakemdep.h @@ -0,0 +1,727 @@ + +/* $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 +#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__) +#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 + * .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(MACH) +# ifdef __i386__ + "-D__i386__", +# 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. + */ +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 __EMX__ + {"__EMX__", "1"}, +#endif + /* add any additional symbols before this line */ + {NULL, NULL} +}; + +#endif /* MAKEDEPEND */ +#endif /* CCIMAKE */ diff --git a/gconfig/mkdepend/include.c b/gconfig/mkdepend/include.c new file mode 100644 index 00000000000..2f13a160f8b --- /dev/null +++ b/gconfig/mkdepend/include.c @@ -0,0 +1,328 @@ +/* $XConsortium: include.c,v 1.17 94/12/05 19:33:08 gildea 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. + +*/ + + +#include "def.h" +#include +#include + +extern struct inclist inclist[ MAXFILES ], + *inclistp; +extern char *includedirs[ ]; +extern char *notdotdot[ ]; +extern boolean show_where_not; +extern boolean warn_multiple; + +void remove_dotdot (char *path); +int isdot(register char *ptr); +int isdotdot(register char *ptr); +int issymbolic(register char *, register char *); + +#ifdef IRIX_N32 +extern "C" int lstat(const char *path, struct stat *buf); +#endif + +struct inclist *inc_path( + register char *file, + register char *include, + boolean dot) +{ + static char path[ BUFSIZ ]; + register char **pp, *p; + register struct inclist *ip; + struct stat st; + boolean found = FALSE; + + /* + * Check all previously found include files for a path that + * has already been expanded. + */ + for (ip = inclist; ip->i_file; ip++) + if ((strcmp(ip->i_incstring, include) == 0) && !ip->i_included_sym) + { + found = TRUE; + break; + } + + /* + * If the path was surrounded by "" or is an absolute path, + * then check the exact path provided. + */ + if (!found && (dot || *include == '/')) { + if (stat(include, &st) == 0) { + ip = newinclude(include, include); + found = TRUE; + } + else if (show_where_not) + warning1("\tnot in %s\n", include); + } + + /* + * See if this include file is in the directory of the + * file being compiled. + */ + if (!found) { + for (p=file+strlen(file); p>file; p--) + if (*p == '/') + break; + if (p == file) + strcpy(path, include); + else { + strncpy(path, file, (p-file) + 1); + path[ (p-file) + 1 ] = '\0'; + strcpy(path + (p-file) + 1, include); + } + remove_dotdot(path); + if (stat(path, &st) == 0) { + ip = newinclude(path, include); + found = TRUE; + } + else if (show_where_not) + warning1("\tnot in %s\n", path); + } + + /* + * Check the include directories specified. (standard include dir + * should be at the end.) + */ + if (!found) + for (pp = includedirs; *pp; pp++) { + sprintf(path, "%s/%s", *pp, include); + remove_dotdot(path); + if (stat(path, &st) == 0) { + ip = newinclude(path, include); + found = TRUE; + break; + } + else if (show_where_not) + warning1("\tnot in %s\n", path); + } + + if (!found) + ip = NULL; + return(ip); +} + +/* + * 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!!) + */ +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); +} + +int +isdot( + register char *p) +{ + if(p && *p++ == '.' && *p++ == '\0') + return(TRUE); + return(FALSE); +} + +int +isdotdot( + register char *p) +{ + if(p && *p++ == '.' && *p++ == '.' && *p++ == '\0') + return(TRUE); + return(FALSE); +} + +int +issymbolic( + register char *dir, + register 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); +} + +/* + * Add an include file to the list of those included by 'file'. + */ +struct inclist *newinclude( + register char *newfile, + register 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); + ip->i_included_sym = FALSE; + if (incstring == NULL) + ip->i_incstring = ip->i_file; + else + ip->i_incstring = copy(incstring); + + return(ip); +} + +void +included_by( + register struct inclist *ip, + register struct inclist *newfile) +{ + register 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); + else { + for (i=0; ii_listlen; i++) + if (ip->i_list[ i ] == newfile) { + i = strlen(newfile->i_file); + if (!ip->i_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; ii_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_list[ ip->i_listlen-1 ] = newfile; +} + +void +inc_clean (void) +{ + register struct inclist *ip; + + for (ip = inclist; ip < inclistp; ip++) { + ip->i_marked = FALSE; + } +} diff --git a/gconfig/mkdepend/main.c b/gconfig/mkdepend/main.c new file mode 100644 index 00000000000..a0975fb536a --- /dev/null +++ b/gconfig/mkdepend/main.c @@ -0,0 +1,736 @@ +/* $XConsortium: main.c,v 1.84 94/11/30 16:10:44 kaleb Exp $ */ +/* $XFree86: xc/config/makedepend/main.c,v 3.4 1995/07/15 14:53:49 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. + +*/ + +#include "def.h" +#include +#include +#include + +#ifdef hpux +#define sigvec sigvector +#endif /* hpux */ + +#ifdef X_POSIX_C_SOURCE +#define _POSIX_C_SOURCE X_POSIX_C_SOURCE +#include +#undef _POSIX_C_SOURCE +#else +#if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) +#include +#else +#define _POSIX_SOURCE +#include +#undef _POSIX_SOURCE +#endif +#endif + +#if NeedVarargsPrototypes +#include +#endif + +#ifdef MINIX +#define USE_CHMOD 1 +#endif + +#ifdef DEBUG +int _debugmask; +#endif + +char *ProgramName; + +char *directives[] = { + "if", + "ifdef", + "ifndef", + "else", + "endif", + "define", + "undef", + "include", + "line", + "pragma", + "error", + "ident", + "sccs", + "elif", + "eject", + NULL +}; + +#define MAKEDEPEND +#include "imakemdep.h" /* from config sources */ +#undef MAKEDEPEND + +struct inclist inclist[ MAXFILES ]; +struct inclist *inclistp = inclist; +struct inclist maininclist; + +char *filelist[ MAXFILES ]; +char *includedirs[ MAXDIRS + 1 ]; +char *notdotdot[ MAXDIRS ]; +char *objprefix = ""; +char *objsuffix = OBJSUFFIX; +char *startat = "# DO NOT DELETE"; +int width = 78; +boolean append = FALSE; +boolean printed = FALSE; +boolean verbose = FALSE; +boolean show_where_not = FALSE; +boolean warn_multiple = FALSE; /* Warn on multiple includes of same file */ + +void define (char *, struct inclist *); +void define2(char *, char *, struct inclist *); +void freefile(struct filepointer *fp); +void redirect(char*, char*); +int find_includes(struct filepointer*, struct inclist*,struct inclist*, + int, boolean); +void recursive_pr_include(register struct inclist*,register char*, + register char*); +void inc_clean(void); + +#ifdef IRIX_N32 +extern "C" int fchmod(int fildes, mode_t mode); +#endif + +static +#ifdef SIGNALRETURNSINT +int +#else +void +#endif +sig_catch ( + int sig) +{ + fflush (stdout); + fatalerr ("got signal %d\n", sig); +} + +#if defined(USG) || (defined(i386) && defined(SYSV)) || defined(WIN32) || defined(__EMX__) || defined(Lynx_22) +#define USGISH +#endif + +#ifndef USGISH +#ifndef _POSIX_SOURCE +#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) +{ + register char **fp = filelist; + register char **incp = includedirs; + register char *p; + register struct inclist *ip; + char *makefile = NULL; + struct filepointer *filecontent; + struct symtab *psymp = predefs; + char *endmarker = NULL; + char *defincdir = NULL; + + 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': + if (argv[0][2] == '\0') { + argv++; + argc--; + } + for (p=argv[0] + 2; *p ; p++) + if (*p == '=') { + *p = ' '; + break; + } + define(argv[0] + 2, &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 '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; + default: + if (endmarker) break; + /* fatalerr("unknown opt = %s\n", argv[0]); */ + warning("ignoring option %s\n", argv[0]); + } + } + if (!defincdir) { +#ifdef PREINCDIR + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = PREINCDIR; +#endif + if (incp >= includedirs + MAXDIRS) + fatalerr("Too many -I flags.\n"); + *incp++ = INCLUDEDIR; +#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); + + /* + * sig_catch signals. + */ +#ifdef USGISH +/* should really reset SIGINT to SIG_IGN if it was. */ +#ifdef SIGHUP + signal (SIGHUP, sig_catch); +#endif + signal (SIGINT, sig_catch); +#ifdef SIGQUIT + signal (SIGQUIT, sig_catch); +#endif + signal (SIGILL, sig_catch); +#ifdef SIGBUS + signal (SIGBUS, sig_catch); +#endif + signal (SIGSEGV, sig_catch); +#ifdef SIGSYS + signal (SIGSYS, sig_catch); +#endif +#else + sig_act.sa_handler = sig_catch; +#ifdef _POSIX_SOURCE + 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++) { + filecontent = getfile(*fp); + 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"); + exit(0); +} + +struct filepointer *getfile( + char *file) +{ + register int fd; + struct filepointer *content; + struct stat st; + + content = (struct filepointer *)malloc(sizeof(struct filepointer)); + 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); + 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; + return(content); +} + +void +freefile( + struct filepointer *fp) +{ + free(fp->f_base); + free(fp); +} + +char *copy( + register char *str) +{ + register char *p = (char *)malloc(strlen(str) + 1); + + strcpy(p, str); + return(p); +} + +int +match( + register char *str, + register char **list) +{ + register 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 *getline( + register struct filepointer *filep) +{ + register char *p, /* walking pointer */ + *eof, /* end of file pointer */ + *bol; /* beginning of line pointer */ + register lineno; /* line number */ + + p = filep->f_p; + eof = filep->f_end; + if (p >= eof) + return((char *)NULL); + lineno = filep->f_line; + + for(bol = p--; ++p < eof; ) { + if (*p == '/' && *(p+1) == '*') { /* consume comments */ + *p++ = ' ', *p++ = ' '; + while (*p) { + if (*p == '*' && *(p+1) == '/') { + *p++ = ' ', *p = ' '; + break; + } + else if (*p == '\n') + lineno++; + *p++ = ' '; + } + continue; + } +#ifdef WIN32 + else if (*p == '/' && *(p+1) == '/') { /* consume comments */ + *p++ = ' ', *p++ = ' '; + while (*p && *p != '\n') + *p++ = ' '; + lineno++; + continue; + } +#endif + else if (*p == '\\') { + if (*(p+1) == '\n') { + *p = ' '; + *(p+1) = ' '; + lineno++; + } + } + else if (*p == '\n') { + lineno++; + if (*bol == '#') { + register char *cp; + + *p++ = '\0'; + /* punt lines with just # (yacc generated) */ + for (cp = bol+1; + *cp && (*cp == ' ' || *cp == '\t'); cp++); + if (*cp) goto done; + } + bol = p+1; + } + } + if (*bol != '#') + bol = NULL; +done: + filep->f_p = p; + filep->f_line = lineno; + 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( + register char *file) +{ + register 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(__EMX__) +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') + 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(__EMX__) + fclose(fdin); +#endif + if (rename(makefile, backup) < 0) + fatalerr("cannot rename %s to %s\n", makefile, backup); +#if defined(WIN32) || defined(__EMX__) + 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 */ +} + +int +#if NeedVarargsPrototypes +fatalerr(char *msg, ...) +#else +/*VARARGS*/ +fatalerr(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9) + char *msg; +#endif +{ +#if NeedVarargsPrototypes + va_list args; +#endif + fprintf(stderr, "%s: error: ", ProgramName); +#if NeedVarargsPrototypes + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); +#else + fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9); +#endif + exit (1); +} + +/* This doesn't actually return an int, but telling the compiler it + * returns an int is a lot easier than figuring out what the hell + * these macros are actually trying to accomplish. + */ +void +#if NeedVarargsPrototypes +warning(char *msg, ...) +#else +/*VARARGS0*/ +warning(char *msg,x1,x2,x3,x4,x5,x6,x7,x8,x9) + +#endif +{ +#if NeedVarargsPrototypes + va_list args; +#endif + fprintf(stderr, "%s: warning: ", ProgramName); +#if NeedVarargsPrototypes + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); +#else + fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9); +#endif +} + +void +#if NeedVarargsPrototypes +warning1(char *msg, ...) +#else +/*VARARGS0*/ +warning1(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9) + char *msg; +#endif +{ +#if NeedVarargsPrototypes + va_list args; + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); +#else + fprintf(stderr, msg,x1,x2,x3,x4,x5,x6,x7,x8,x9); +#endif +} diff --git a/gconfig/mkdepend/mkdepend.man b/gconfig/mkdepend/mkdepend.man new file mode 100644 index 00000000000..055727acfcc --- /dev/null +++ b/gconfig/mkdepend/mkdepend.man @@ -0,0 +1,365 @@ +.\" $XConsortium: mkdepend.man,v 1.15 94/04/17 20:10:37 gildea 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 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. +.\" + +.TH MAKEDEPEND 1 "Release 6" "X Version 11" +.UC 4 +.SH NAME +makedepend \- create dependencies in makefiles +.SH SYNOPSIS +.B makedepend +[ +.B \-Dname=def +] [ +.B \-Dname +] [ +.B \-Iincludedir +] [ +.B \-Yincludedir +] [ +.B \-a +] [ +.B \-fmakefile +] [ +.B \-oobjsuffix +] [ +.B \-pobjprefix +] [ +.B \-sstring +] [ +.B \-wwidth +] [ +.B \-v +] [ +.B \-m +] [ +\-\^\- +.B otheroptions +\-\^\- +] +sourcefile .\|.\|. +.br +.SH DESCRIPTION +.B Makedepend +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 +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 "dependency". +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 "sourcefile.o" is the name from the command +line with its suffix replaced with ".o", +and "dfile" 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 +.B Makedepend +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 \-Dname=def or \-Dname +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 \-Iincludedir +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 \-Yincludedir +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 \-fmakefile +Filename. +This allows you to specify an alternate makefile in which +.B makedepend +can place its output. +.TP 5 +.B \-oobjsuffix +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 \-pobjprefix +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 \-sstring +Starting string delimiter. +This option permits you to specify +a different string for +.B makedepend +to look for in the makefile. +.TP 5 +.B \-wwidth +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 on standard output. +.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 "\-\^\- options \-\^\-" +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 encounter's 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 diff --git a/gconfig/mkdepend/parse.c b/gconfig/mkdepend/parse.c new file mode 100644 index 00000000000..57e2d5036f1 --- /dev/null +++ b/gconfig/mkdepend/parse.c @@ -0,0 +1,592 @@ +/* $XConsortium: parse.c,v 1.30 94/04/17 20:10:38 gildea 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. + +*/ + +#include "def.h" + +extern char *directives[]; +extern struct inclist maininclist; + +void define(char*,struct inclist*); +void define2(char*,char *,struct inclist*); +void undefine(char*,register struct inclist *); +int deftype (register char*,register struct filepointer *, + register struct inclist *, register struct inclist *file, + int parse_it); +int gobble(register struct filepointer *, struct inclist*,struct inclist*); +void add_include(struct filepointer*,struct inclist*,struct inclist*,char*, + boolean,boolean); +int match(register char *,register char **); +int zero_value(register char*,register struct filepointer*, + register struct inclist *); +boolean cppsetup(register char *,register struct filepointer *, + register struct inclist*); + +int +find_includes( + struct filepointer *filep, + struct inclist *file, + struct inclist *file_red, + int recursion, + boolean failOK) +{ + register char *line; + register int type; + boolean recfailOK; + + while (line = getline(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, line %d: incomplete undef == \"%s\"\n", + file_red->i_file, filep->f_line, line); + break; + } + undefine(line, file_red); + break; + case INCLUDE: + add_include(filep, file, file_red, line, FALSE, failOK); + break; + case INCLUDEDOT: + add_include(filep, file, file_red, line, TRUE, failOK); + break; + case ERROR: + warning("%s: %d: %s\n", file_red->i_file, + 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; + } + } + return(-1); +} + +int +gobble( + register struct filepointer *filep, + struct inclist *file, + struct inclist *file_red) +{ + register char *line; + register int type; + + while (line = getline(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: + break; + case ELIF: + case ELIFFALSE: + case ELIFGUESSFALSE: + return(type); + case -1: + warning("%s, line %d: unknown directive == \"%s\"\n", + file_red->i_file, filep->f_line, line); + break; + } + } + return(-1); +} + +/* + * Decide what type of # directive this line is. + */ +int deftype ( + register char *line, + register struct filepointer *filep, + register struct inclist *file_red, + register struct inclist *file, + int parse_it) +{ + register char *p; + char *directive, savechar; + register int ret; + + /* + * Parse the directive... + */ + directive=line+1; + while (*directive == ' ' || *directive == '\t') + directive++; + + p = directive; + while (*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(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++; + switch (ret) { + case IF: + /* + * parse an expression. + */ + ret = zero_value(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: + debug(2,("%s, line %d: #include %s\n", + file->i_file, filep->f_line, p)); + + /* Support ANSI macro substitution */ + { + struct symtab *sym = isdefined(p, file_red, NULL); + while (sym) { + 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_included_sym = TRUE; + sym = isdefined(p, file_red, NULL); + } + } + + /* + * Separate the name of the include file. + */ + while (*p && *p != '"' && *p != '<') + p++; + if (! *p) + return(-2); + if (*p++ == '"') { + ret = INCLUDEDOT; + 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: + debug(0,("%s, line %d: #%s\n", + file->i_file, filep->f_line, directives[ret])); + /* + * nothing to do. + */ + break; + } + return(ret); +} + +struct symtab *isdefined( + register char *symbol, + struct inclist *file, + struct inclist **srcfile) +{ + register 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); +} + +struct symtab *fdefined( + register char *symbol, + struct inclist *file, + struct inclist **srcfile) +{ + register struct inclist **ip; + register struct symtab *val; + register int i; + static int recurse_lvl = 0; + + if (file->i_defchecked) + return(NULL); + file->i_defchecked = TRUE; + 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 (val = fdefined(symbol, *ip, srcfile)) { + break; + } + } + else if (val != NULL && srcfile != NULL) *srcfile = file; + recurse_lvl--; + file->i_defchecked = FALSE; + + return(val); +} + +/* + * Return type based on if the #if expression evaluates to 0 + */ +int +zero_value( + register char *exp, + register struct filepointer *filep, + register struct inclist *file_red) +{ + if (cppsetup(exp, filep, file_red)) + return(IFFALSE); + else + return(IF); +} + +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); +} + +void +define2( + char *name, + char *val, + struct inclist *file) +{ + int first, last, below; + register struct symtab *sp = NULL, *dest; + + /* Make space if it's needed */ + if (file->i_defs == NULL) + { + file->i_defs = (struct symtab *) + malloc(sizeof (struct symtab) * SYMTABINC); + file->i_deflen = SYMTABINC; + file->i_ndefs = 0; + } + else if (file->i_ndefs == file->i_deflen) + file->i_defs = (struct symtab *) + realloc(file->i_defs, + sizeof(struct symtab)*(file->i_deflen+=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) / 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) + { + 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--; + } + sp->s_name = copy(name); + sp->s_value = copy(val); +} + +struct symtab *slookup( + register char *symbol, + register struct inclist *file) +{ + register int first = 0; + register int last = file->i_ndefs - 1; + + if (file) while (last >= first) + { + /* Fast inline binary search */ + register char *s1; + register char *s2; + register int middle = (first + last) / 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); +} + +void +undefine( + char *symbol, + register 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]; + } +} diff --git a/gconfig/mkdepend/pr.c b/gconfig/mkdepend/pr.c new file mode 100644 index 00000000000..53500d541e6 --- /dev/null +++ b/gconfig/mkdepend/pr.c @@ -0,0 +1,140 @@ +/* $XConsortium: pr.c,v 1.17 94/04/17 20:10:38 gildea 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. + +*/ + +#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 pr(register struct inclist *,char *,char *); +void included_by(register struct inclist *, register struct inclist *); +int find_includes(struct filepointer*, struct inclist*, struct inclist*, + int,boolean); +void freefile(struct filepointer *fp); + +void +add_include( + struct filepointer *filep, + struct inclist *file, + struct inclist *file_red, + char *include, + boolean dot, + 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, dot); + 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, dot); + show_where_not = FALSE; + } + + if (newfile) { + included_by(file, newfile); + if (!newfile->i_searched) { + newfile->i_searched = TRUE; + content = getfile(newfile->i_file); + find_includes(content, newfile, file_red, 0, failOK); + freefile(content); + } + } +} + +void +recursive_pr_include( + register struct inclist *head, + register char *file, + register char *base) +{ + register int i; + + if (head->i_marked) + return; + head->i_marked = TRUE; + if (head->i_file != file) + pr(head, file, base); + for (i=0; ii_listlen; i++) + recursive_pr_include(head->i_list[ i ], file, base); +} + +void +pr( + register 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_notified) + return; + ip->i_notified = TRUE; + lastfile = NULL; + printf("\n# %s includes:", ip->i_file); + for (i=0; ii_listlen; i++) + printf("\n#\t%s", ip->i_list[ i ]->i_incstring); +} diff --git a/gconfig/module.mk b/gconfig/module.mk new file mode 100644 index 00000000000..d39b884185c --- /dev/null +++ b/gconfig/module.mk @@ -0,0 +1,46 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# The master "Core Components" source and release component directory # +# names are ALWAYS identical and are the value of $(MODULE). # +# NOTE: A component is also called a module or a subsystem. # +####################################################################### + +# +# All "Core Components" -specific source-side tags must +# 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 + +ifndef NSPR_SOURCE_COMPONENT + NSPR_SOURCE_COMPONENT = nspr20 +endif + +ifndef SECTOOLS_SOURCE_COMPONENT + SECTOOLS_SOURCE_COMPONENT = sectools +endif + +ifndef SECURITY_SOURCE_COMPONENT + SECURITY_SOURCE_COMPONENT = security +endif + diff --git a/gconfig/nsinstall/Makefile b/gconfig/nsinstall/Makefile new file mode 100644 index 00000000000..cc3442b99c0 --- /dev/null +++ b/gconfig/nsinstall/Makefile @@ -0,0 +1,43 @@ +#! gmake +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +DEPTH = ../.. +GDEPTH = ../.. + +MODULE = gconfig + +CSRCS = nsinstall.c pathsub.c + +PLSRCS = nfspwd.pl + +PROGRAM = nsinstall + +include $(DEPTH)/gconfig/config.mk + +ifeq ($(OS_ARCH),WINNT) +PROGRAM = +else +TARGETS = $(PROGRAM) $(PLSRCS:.pl=) +endif + +include $(DEPTH)/gconfig/rules.mk + +# Redefine MAKE_OBJDIR for just this directory +define MAKE_OBJDIR +if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi +endef + diff --git a/gconfig/nsinstall/nfspwd b/gconfig/nsinstall/nfspwd new file mode 100644 index 00000000000..fdc32495860 --- /dev/null +++ b/gconfig/nsinstall/nfspwd @@ -0,0 +1,30 @@ +#! perl +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + + +require "fastcwd.pl"; + +$_ = &fastcwd; +if (m@^/[uh]/@o || s@^/tmp_mnt/@/@o) { + print("$_\n"); +} elsif ((($user, $rest) = m@^/usr/people/(\w+)/(.*)@o) + && readlink("/u/$user") eq "/usr/people/$user") { + print("/u/$user/$rest\n"); +} else { + chop($host = `hostname`); + print("/h/$host$_\n"); +} diff --git a/gconfig/nsinstall/nfspwd.pl b/gconfig/nsinstall/nfspwd.pl new file mode 100644 index 00000000000..fdc32495860 --- /dev/null +++ b/gconfig/nsinstall/nfspwd.pl @@ -0,0 +1,30 @@ +#! perl +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + + +require "fastcwd.pl"; + +$_ = &fastcwd; +if (m@^/[uh]/@o || s@^/tmp_mnt/@/@o) { + print("$_\n"); +} elsif ((($user, $rest) = m@^/usr/people/(\w+)/(.*)@o) + && readlink("/u/$user") eq "/usr/people/$user") { + print("/u/$user/$rest\n"); +} else { + chop($host = `hostname`); + print("/h/$host$_\n"); +} diff --git a/gconfig/nsinstall/nsinstall.c b/gconfig/nsinstall/nsinstall.c new file mode 100644 index 00000000000..889eb1e11d0 --- /dev/null +++ b/gconfig/nsinstall/nsinstall.c @@ -0,0 +1,317 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/* +** Netscape portable install command. +** +** Brendan Eich, 7/20/95 +*/ +#include /* OSF/1 requires this before grp.h, so put it first */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pathsub.h" + +#define HAVE_LCHOWN + +#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) +#undef HAVE_LCHOWN +#endif + +#ifdef LINUX +#include +#endif + +#if defined(SCO) || defined(UNIXWARE) || defined(SNI) || defined(NCR) || defined(NEC) +#if !defined(S_ISLNK) && defined(S_IFLNK) +#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK) +#endif +#endif + +#if defined(SNI) +extern int fchmod(int fildes, mode_t mode); +#endif + +static void +usage(void) +{ + fprintf(stderr, + "usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n" + " %*s [-DdltR] file [file ...] directory\n", + program, strlen(program), ""); + exit(2); +} + +static int +mkdirs(char *path, mode_t mode) +{ + char *cp; + struct stat sb; + + while (*path == '/' && path[1] == '/') + path++; + while ((cp = strrchr(path, '/')) && cp[1] == '\0') + *cp = '\0'; + if (cp && cp != path) { + *cp = '\0'; + if ((lstat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) && + mkdirs(path, mode) < 0) { + return -1; + } + *cp = '/'; + } + return mkdir(path, mode); +} + +static uid_t +touid(char *owner) +{ + struct passwd *pw; + uid_t uid; + char *cp; + + pw = getpwnam(owner); + if (pw) + return pw->pw_uid; + uid = strtol(owner, &cp, 0); + if (uid == 0 && cp == owner) + fail("cannot find uid for %s", owner); + return uid; +} + +static gid_t +togid(char *group) +{ + struct group *gr; + gid_t gid; + char *cp; + + gr = getgrnam(group); + if (gr) + return gr->gr_gid; + gid = strtol(group, &cp, 0); + if (gid == 0 && cp == group) + fail("cannot find gid for %s", group); + return gid; +} + +int +main(int argc, char **argv) +{ + int onlydir, dodir, dolink, dorelsymlink, dotimes, opt, len, lplen, tdlen, bnlen, exists, fromfd, tofd, cc, wc; + mode_t mode = 0755; + char *linkprefix, *owner, *group, *cp, *cwd, *todir, *toname, *name, *base, *linkname, *bp, buf[BUFSIZ]; + uid_t uid; + gid_t gid; + struct stat sb, tosb; + struct utimbuf utb; + + program = argv[0]; + cwd = linkname = linkprefix = owner = group = 0; + onlydir = dodir = dolink = dorelsymlink = dotimes = lplen = 0; + + while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) { + switch (opt) { + case 'C': + cwd = optarg; + break; + case 'D': + onlydir = 1; + break; + case 'd': + dodir = 1; + break; + case 'l': + dolink = 1; + break; + case 'L': + linkprefix = optarg; + lplen = strlen(linkprefix); + dolink = 1; + break; + case 'R': + dolink = dorelsymlink = 1; + break; + case 'm': + mode = strtoul(optarg, &cp, 8); + if (mode == 0 && cp == optarg) + usage(); + break; + case 'o': + owner = optarg; + break; + case 'g': + group = optarg; + break; + case 't': + dotimes = 1; + break; + default: + usage(); + } + } + + argc -= optind; + argv += optind; + if (argc < 2 - onlydir) + usage(); + + todir = argv[argc-1]; + if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) && + mkdirs(todir, 0777) < 0) { + fail("cannot make directory %s", todir); + } + if (onlydir) + return 0; + + if (!cwd) + cwd = getcwd(0, PATH_MAX); + xchdir(todir); + todir = getcwd(0, PATH_MAX); + tdlen = strlen(todir); + xchdir(cwd); + tdlen = strlen(todir); + + uid = owner ? touid(owner) : -1; + gid = group ? togid(group) : -1; + + while (--argc > 0) { + name = *argv++; + len = strlen(name); + base = xbasename(name); + bnlen = strlen(base); + toname = (char*)xmalloc(tdlen + 1 + bnlen + 1); + sprintf(toname, "%s/%s", todir, base); + exists = (lstat(toname, &tosb) == 0); + + if (dodir) { + /* -d means create a directory, always */ + if (exists && !S_ISDIR(tosb.st_mode)) { + (void) unlink(toname); + exists = 0; + } + if (!exists && mkdir(toname, mode) < 0) + fail("cannot make directory %s", toname); + if ((owner || group) && chown(toname, uid, gid) < 0) + fail("cannot change owner of %s", toname); + } else if (dolink) { + if (*name == '/') { + /* source is absolute pathname, link to it directly */ + linkname = 0; + } else { + if (linkprefix) { + /* -L implies -l and prefixes names with a $cwd arg. */ + len += lplen + 1; + linkname = (char*)xmalloc(len + 1); + sprintf(linkname, "%s/%s", linkprefix, name); + } else if (dorelsymlink) { + /* Symlink the relative path from todir to source name. */ + linkname = (char*)xmalloc(PATH_MAX); + + if (*todir == '/') { + /* todir is absolute: skip over common prefix. */ + lplen = relatepaths(todir, cwd, linkname); + strcpy(linkname + lplen, name); + } else { + /* todir is named by a relative path: reverse it. */ + reversepath(todir, name, len, linkname); + xchdir(cwd); + } + + len = strlen(linkname); + } + name = linkname; + } + + /* Check for a pre-existing symlink with identical content. */ + if (exists && + (!S_ISLNK(tosb.st_mode) || + readlink(toname, buf, sizeof buf) != len || + strncmp(buf, name, len) != 0)) { + (void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname); + exists = 0; + } + if (!exists && symlink(name, toname) < 0) + fail("cannot make symbolic link %s", toname); +#ifdef HAVE_LCHOWN + if ((owner || group) && lchown(toname, uid, gid) < 0) + fail("cannot change owner of %s", toname); +#endif + + if (linkname) { + free(linkname); + linkname = 0; + } + } else { + /* Copy from name to toname, which might be the same file. */ + fromfd = open(name, O_RDONLY); + if (fromfd < 0 || fstat(fromfd, &sb) < 0) + fail("cannot access %s", name); + if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0)) + (void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname); + tofd = open(toname, O_CREAT | O_WRONLY, 0666); + if (tofd < 0) + fail("cannot create %s", toname); + + bp = buf; + while ((cc = read(fromfd, bp, sizeof buf)) > 0) { + while ((wc = write(tofd, bp, cc)) > 0) { + if ((cc -= wc) == 0) + break; + bp += wc; + } + if (wc < 0) + fail("cannot write to %s", toname); + } + if (cc < 0) + fail("cannot read from %s", name); + + if (ftruncate(tofd, sb.st_size) < 0) + fail("cannot truncate %s", toname); + if (dotimes) { + utb.actime = sb.st_atime; + utb.modtime = sb.st_mtime; + if (utime(toname, &utb) < 0) + fail("cannot set times of %s", toname); + } + if (fchmod(tofd, mode) < 0) + fail("cannot change mode of %s", toname); + if ((owner || group) && fchown(tofd, uid, gid) < 0) + fail("cannot change owner of %s", toname); + + /* Must check for delayed (NFS) write errors on close. */ + if (close(tofd) < 0) + fail("cannot write to %s", toname); + close(fromfd); + } + + free(toname); + } + + free(cwd); + free(todir); + return 0; +} diff --git a/gconfig/nsinstall/pathsub.c b/gconfig/nsinstall/pathsub.c new file mode 100644 index 00000000000..13c012daee8 --- /dev/null +++ b/gconfig/nsinstall/pathsub.c @@ -0,0 +1,222 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/* +** Pathname subroutines. +** +** Brendan Eich, 8/29/95 +*/ +#include +#ifdef FREEBSD +#include +#endif /* FREEBSD */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pathsub.h" +#ifdef USE_REENTRANT_LIBC +#include "libc_r.h" +#endif /* USE_REENTRANT_LIBC */ + +char *program; + +void +fail(char *format, ...) +{ + int error; + va_list ap; + +#ifdef USE_REENTRANT_LIBC + R_STRERROR_INIT_R(); +#endif + + error = errno; + fprintf(stderr, "%s: ", program); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + if (error) + +#ifdef USE_REENTRANT_LIBC + R_STRERROR_R(errno); + fprintf(stderr, ": %s", r_strerror_r); +#else + fprintf(stderr, ": %s", strerror(errno)); +#endif + + putc('\n', stderr); + exit(1); +} + +char * +getcomponent(char *path, char *name) +{ + if (*path == '\0') + return 0; + if (*path == '/') { + *name++ = '/'; + } else { + do { + *name++ = *path++; + } while (*path != '/' && *path != '\0'); + } + *name = '\0'; + while (*path == '/') + path++; + return path; +} + +#ifdef UNIXWARE +/* Sigh. The static buffer in Unixware's readdir is too small. */ +struct dirent * readdir(DIR *d) +{ + static struct dirent *buf = NULL; +#define MAX_PATH_LEN 1024 + + + if(buf == NULL) + buf = (struct dirent *) malloc(sizeof(struct dirent) + MAX_PATH_LEN) +; + return(readdir_r(d, buf)); +} +#endif + +char * +ino2name(ino_t ino, char *dir) +{ + DIR *dp; + struct dirent *ep; + char *name; + + dp = opendir(".."); + if (!dp) + fail("cannot read parent directory"); + for (;;) { + if (!(ep = readdir(dp))) + fail("cannot find current directory"); + if (ep->d_ino == ino) + break; + } + name = xstrdup(ep->d_name); + closedir(dp); + return name; +} + +void * +xmalloc(size_t size) +{ + void *p = malloc(size); + if (!p) + fail("cannot allocate %u bytes", size); + return p; +} + +char * +xstrdup(char *s) +{ + return strcpy((char*)xmalloc(strlen(s) + 1), s); +} + +char * +xbasename(char *path) +{ + char *cp; + + while ((cp = strrchr(path, '/')) && cp[1] == '\0') + *cp = '\0'; + if (!cp) return path; + return cp + 1; +} + +void +xchdir(char *dir) +{ + if (chdir(dir) < 0) + fail("cannot change directory to %s", dir); +} + +int +relatepaths(char *from, char *to, char *outpath) +{ + char *cp, *cp2; + int len; + char buf[NAME_MAX]; + + assert(*from == '/' && *to == '/'); + for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++) + if (*cp == '\0') + break; + while (cp[-1] != '/') + cp--, cp2--; + if (cp - 1 == to) { + /* closest common ancestor is /, so use full pathname */ + len = strlen(strcpy(outpath, to)); + if (outpath[len] != '/') { + outpath[len++] = '/'; + outpath[len] = '\0'; + } + } else { + len = 0; + while ((cp2 = getcomponent(cp2, buf)) != 0) { + strcpy(outpath + len, "../"); + len += 3; + } + while ((cp = getcomponent(cp, buf)) != 0) { + sprintf(outpath + len, "%s/", buf); + len += strlen(outpath + len); + } + } + return len; +} + +void +reversepath(char *inpath, char *name, int len, char *outpath) +{ + char *cp, *cp2; + char buf[NAME_MAX]; + struct stat sb; + + cp = strcpy(outpath + PATH_MAX - (len + 1), name); + cp2 = inpath; + while ((cp2 = getcomponent(cp2, buf)) != 0) { + if (strcmp(buf, ".") == 0) + continue; + if (strcmp(buf, "..") == 0) { + if (stat(".", &sb) < 0) + fail("cannot stat current directory"); + name = ino2name(sb.st_ino, ".."); + len = strlen(name); + cp -= len + 1; + strcpy(cp, name); + cp[len] = '/'; + free(name); + xchdir(".."); + } else { + cp -= 3; + strncpy(cp, "../", 3); + xchdir(buf); + } + } + strcpy(outpath, cp); +} diff --git a/gconfig/nsinstall/pathsub.h b/gconfig/nsinstall/pathsub.h new file mode 100644 index 00000000000..a757e54bddd --- /dev/null +++ b/gconfig/nsinstall/pathsub.h @@ -0,0 +1,58 @@ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef pathsub_h___ +#define pathsub_h___ +/* +** Pathname subroutines. +** +** Brendan Eich, 8/29/95 +*/ +#include +#include + +#if SUNOS4 +#include "sunos4.h" +#endif + +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + +/* + * Just prevent stupidity + */ +#undef NAME_MAX +#define NAME_MAX 256 + +extern char *program; + +extern void fail(char *format, ...); +extern char *getcomponent(char *path, char *name); +extern char *ino2name(ino_t ino, char *dir); +extern void *xmalloc(size_t size); +extern char *xstrdup(char *s); +extern char *xbasename(char *path); +extern void xchdir(char *dir); + +/* Relate absolute pathnames from and to returning the result in outpath. */ +extern int relatepaths(char *from, char *to, char *outpath); + +/* XXX changes current working directory -- caveat emptor */ +extern void reversepath(char *inpath, char *name, int len, char *outpath); + +#endif /* pathsub_h___ */ diff --git a/gconfig/nsinstall/sunos4.h b/gconfig/nsinstall/sunos4.h new file mode 100644 index 00000000000..7efcfe5f4e2 --- /dev/null +++ b/gconfig/nsinstall/sunos4.h @@ -0,0 +1,147 @@ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef pr_sunos4_h___ +#define pr_sunos4_h___ + +#ifndef SVR4 + +/* +** Hodge podge of random missing prototypes for the Sunos4 system +*/ +#include +#include +#include +#include +#include + +#define PATH_MAX _POSIX_PATH_MAX + +struct timeval; +struct timezone; +struct itimerval; +struct sockaddr; +struct stat; +struct tm; + +/* ctype.h */ +extern int tolower(int); +extern int toupper(int); + +/* errno.h */ +extern char *sys_errlist[]; +extern int sys_nerr; + +#define strerror(e) sys_errlist[((unsigned)(e) < sys_nerr) ? e : 0] + +extern void perror(const char *); + +/* getopt */ +extern char *optarg; +extern int optind; +extern int getopt(int argc, char **argv, char *spec); + +/* math.h */ +extern int srandom(long val); +extern long random(void); + +/* memory.h */ +#define memmove(to,from,len) bcopy((char*)(from),(char*)(to),len) + +extern void bcopy(const char *, char *, int); + +/* signal.h */ +/* +** SunOS4 sigaction hides interrupts by default, so we can safely define +** SA_RESTART to 0 (HP-UX is a counter-example -- its sigaction does not +** hide interrupts but lacks an SA_RESTART option; you must use sigvector +** and tweak the sigcontext from within each signal handler!). +*/ +#define SA_RESTART 0 +#define SA_SIGINFO 0 + +/* stdio.h */ +extern int printf(const char *, ...); +extern int fprintf(FILE *, const char *, ...); +extern int vprintf(const char *, va_list); +extern int vfprintf(FILE *, const char *, va_list); +extern char *vsprintf(char *, const char *, va_list); +extern int scanf(const char *, ...); +extern int sscanf(const char *, const char *, ...); +extern int fscanf(FILE *, const char *, ...); +extern int fgetc(FILE *); +extern int fputc(int, FILE *); +extern int fputs(const char *, FILE *); +extern int puts(const char *); +extern int fread(void *, size_t, size_t, FILE *); +extern int fwrite(const char *, int, int, FILE *); +extern int fseek(FILE *, long, int); +extern long ftell(FILE *); +extern int rewind(FILE *); +extern int fflush(FILE *); +extern int _flsbuf(unsigned char, FILE *); +extern int fclose(FILE *); +extern int remove(const char *); +extern int setvbuf(FILE *, char *, int, size_t); +extern int system(const char *); +extern FILE *popen(const char *, const char *); +extern int pclose(FILE *); + +/* stdlib.h */ +#define strtoul strtol + +extern int isatty(int fildes); +extern long strtol(const char *, char **, int); +extern int putenv(const char *); +extern void srand48(long); +extern long lrand48(void); +extern double drand48(void); + +/* string.h */ +extern int strcasecmp(const char *, const char *); +extern int strncasecmp(const char *, const char *, size_t); +extern int strcoll(const char *, const char *); + +/* time.h */ +extern time_t mktime(struct tm *); +extern size_t strftime(char *, size_t, const char *, const struct tm *); +extern int gettimeofday(struct timeval *, struct timezone *); +extern int setitimer(int, struct itimerval *, struct itimerval *); +extern time_t time(time_t *); +extern time_t timegm(struct tm *); +extern struct tm *localtime(const time_t *); +extern struct tm *gmtime(const time_t *); + +/* unistd.h */ +extern int rename(const char *, const char *); +extern int ioctl(int, int, int *arg); +extern int connect(int, struct sockaddr *, int); +extern int readlink(const char *, char *, int); +extern int symlink(const char *, const char *); +extern int ftruncate(int, off_t); +extern int fchmod(int, mode_t); +extern int fchown(int, uid_t, gid_t); +extern int lstat(const char *, struct stat *); +extern int fstat(int, struct stat *); +extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +extern int gethostname(char *, int); +extern char *getwd(char *); +extern int getpagesize(void); + +#endif /* SVR4 */ + +#endif /* pr_sunos4_h___ */ diff --git a/gconfig/platform.mk b/gconfig/platform.mk new file mode 100644 index 00000000000..607a04f5bcb --- /dev/null +++ b/gconfig/platform.mk @@ -0,0 +1,21 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Master "Core Components" tag # +####################################################################### + +PLATFORM = $(OBJDIR_NAME) +CONFIG_PLATFORM = $(CONFIG_OBJDIR_NAME) diff --git a/gconfig/prefix.mk b/gconfig/prefix.mk new file mode 100644 index 00000000000..a46ad60f73f --- /dev/null +++ b/gconfig/prefix.mk @@ -0,0 +1,70 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Master "Core Components" for computing program prefixes # +####################################################################### + +# +# Object prefixes +# + +ifndef OBJ_PREFIX + OBJ_PREFIX = +endif + +# +# Library suffixes +# + +ifndef LIB_PREFIX + ifeq ($(OS_ARCH), WINNT) + LIB_PREFIX = + else + LIB_PREFIX = lib + endif +endif + + +ifndef DLL_PREFIX + ifeq ($(OS_ARCH), WINNT) + DLL_PREFIX = + else + DLL_PREFIX = lib + endif +endif + + +ifndef IMPORT_LIB_PREFIX + IMPORT_LIB_PREFIX = +endif + + +ifndef PURE_LIB_PREFIX + ifeq ($(OS_ARCH), WINNT) + PURE_LIB_PREFIX = + else + PURE_LIB_PREFIX = purelib + endif +endif + +# +# Program prefixes +# + +ifndef PROG_PREFIX + PROG_PREFIX = +endif + diff --git a/gconfig/release.pl b/gconfig/release.pl new file mode 100644 index 00000000000..a364e951b75 --- /dev/null +++ b/gconfig/release.pl @@ -0,0 +1,113 @@ +#! /usr/local/bin/perl +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + + +require('gconfig.pl'); + +#######-- read in variables on command line into %var + +$var{ZIP} = "zip"; + +&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); + + $zipoptions = ""; + 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 -r $jarfile $filelist\n"; + system("zip $zipoptions -r $jarfile $filelist"); + rmdir("META-INF"); + for $i (1 .. $dirdepth) { + chdir(".."); + print STDERR "chdir ..\n"; + } + } + else { + print STDERR "Directory $jardir doesn't exist\n"; + } + +} + diff --git a/gconfig/rules.mk b/gconfig/rules.mk new file mode 100644 index 00000000000..81908d1dcee --- /dev/null +++ b/gconfig/rules.mk @@ -0,0 +1,790 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +### ### +### R U L E S O F E N G A G E M E N T ### +### ### +####################################################################### + +####################################################################### +# Double-Colon rules for utilizing the binary release model. # +####################################################################### + +all:: export libs program install + +ifeq ($(AUTOCLEAN),1) +autobuild:: clean export private_export libs program install +else +autobuild:: export private_export libs program install +endif + +platform:: + @echo $(OBJDIR_NAME) + + +# +# 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$(GDEPTH)/gconfig $(GDEPTH)/gconfig/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=$(XPCLASS_JAR) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \ + "$(XPCLASS_JAR)=$(RELEASE_XP_DIR)|$(SOURCE_CLASSES_DIR)|" \ + "$(XPHEADER_JAR)=$(RELEASE_XP_DIR)|$(SOURCE_XP_DIR)/public/|v" \ + "$(MDHEADER_JAR)=$(RELEASE_MD_DIR)|$(SOURCE_MD_DIR)/include|" \ + "$(MDBINARY_JAR)=$(RELEASE_MD_DIR)|$(SOURCE_MD_DIR)|" + +# perl -I$(GDEPTH)/gconfig $(GDEPTH)/gconfig/import.pl \ +# "IMPORTS=$(IMPORTS)" \ +# "RELEASE_TREE=$(RELEASE_TREE)" \ +# "VERSION=$(VERSION)" \ +# "PLATFORM=$(PLATFORM)" \ +# "SOURCE_MD_DIR=$(SOURCE_MD_DIR)" \ +# "SOURCE_XP_DIR=$(SOURCE_XP_DIR)" \ +# "OS_ARCH=$(OS_ARCH)" ; + + +export:: + +$(LOOP_OVER_DIRS) + +private_export:: + +$(LOOP_OVER_DIRS) + +release_export:: + +$(LOOP_OVER_DIRS) + +libs program install:: $(TARGETS) +ifdef LIBRARY + $(INSTALL) -m 664 $(LIBRARY) $(SOURCE_LIB_DIR) +endif +ifdef SHARED_LIBRARY + $(INSTALL) -m 775 $(SHARED_LIBRARY) $(SOURCE_LIB_DIR) +endif +ifdef IMPORT_LIBRARY + $(INSTALL) -m 775 $(IMPORT_LIBRARY) $(SOURCE_LIB_DIR) +endif +ifdef PROGRAM + $(INSTALL) -m 775 $(PROGRAM) $(SOURCE_BIN_DIR) +endif +ifdef PROGRAMS + $(INSTALL) -m 775 $(PROGRAMS) $(SOURCE_BIN_DIR) +endif + +$(LOOP_OVER_DIRS) + +tests:: + +$(LOOP_OVER_DIRS) + +clean clobber:: + rm -rf $(ALL_TRASH) + +$(LOOP_OVER_DIRS) + +realclean clobber_all:: + rm -rf $(wildcard *.OBJ) dist $(ALL_TRASH) + +$(LOOP_OVER_DIRS) + +#ifdef ALL_PLATFORMS +#all_platforms:: $(NFSPWD) +# @d=`$(NFSPWD)`; \ +# if test ! -d LOGS; then rm -rf LOGS; mkdir LOGS; fi; \ +# for h in $(PLATFORM_HOSTS); do \ +# echo "On $$h: $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log";\ +# rsh $$h -n "(chdir $$d; \ +# $(MAKE) $(ALL_PLATFORMS) >& LOGS/$$h.log; \ +# echo DONE) &" 2>&1 > LOGS/$$h.pid & \ +# sleep 1; \ +# done +# +#$(NFSPWD): +# cd $(@D); $(MAKE) $(@F) +#endif + +####################################################################### +# Double-Colon rules for populating the binary release model. # +####################################################################### + + +release_clean:: + rm -rf $(SOURCE_XP_DIR)/release + +release:: release_clean release_export release_md release_jars release_cpdistdir + +release_cpdistdir:: + @echo "== cpdist.pl ==" + @perl -I$(GDEPTH)/gconfig $(GDEPTH)/gconfig/cpdist.pl \ + "RELEASE_TREE=$(RELEASE_TREE)" \ + "GDEPTH=$(GDEPTH)" \ + "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) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR) XP_FILES MD_FILES" \ + "$(XPCLASS_JAR)=$(SOURCE_RELEASE_CLASSES_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" + + +# Add $(SOURCE_RELEASE_XPSOURCE_JAR) to FILES line when ready + +# $(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$(GDEPTH)/gconfig $(GDEPTH)/gconfig/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) $(XPHEADER_JAR) $(MDHEADER_JAR) $(MDBINARY_JAR)" \ + "$(XPCLASS_JAR)=$(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_CLASSES_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" +# "$(XPSOURCE_JAR)=$(SOURCE_RELEASE_PREFIX)|a" + + + +release_md:: +ifdef LIBRARY + $(INSTALL) -m 444 $(LIBRARY) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR) +endif +ifdef SHARED_LIBRARY + $(INSTALL) -m 555 $(SHARED_LIBRARY) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR) +endif +ifdef IMPORT_LIBRARY + $(INSTALL) -m 555 $(IMPORT_LIBRARY) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_LIB_DIR) +endif +ifdef PROGRAM + $(INSTALL) -m 555 $(PROGRAM) $(SOURCE_RELEASE_PREFIX)/$(SOURCE_RELEASE_BIN_DIR) +endif +ifdef PROGRAMS + $(INSTALL) -m 555 $(PROGRAMS) $(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) + @$(MAKE_OBJDIR) +ifeq ($(OS_ARCH),WINNT) +ifeq ($(OS_TARGET),WIN16) + echo system windows >w16link + echo option map >>w16link + echo option oneautodata >>w16link + echo option heapsize=32K >>w16link + echo debug watcom all >>w16link + echo name $@ >>w16link + echo file >>w16link + echo $(W16OBJS) , >>w16link + echo $(W16LDFLAGS) >> w16link + echo library >>w16link + echo winsock.lib >>w16link + $(LINK) @w16link. + rm w16link +else + $(LINK_EXE) $(MAP) $(PDB) $(IMP) $(OBJS) $(OUT_NAME)$(PROGRAM) $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) +endif +else + $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) $(OS_LIBS) +endif + +$(LIBRARY): $(OBJS) + @$(MAKE_OBJDIR) + rm -f $@ + $(AR) $(OBJS) + $(RANLIB) $@ + +ifeq ($(OS_TARGET), WIN16) +$(IMPORT_LIBRARY): $(SHARED_LIBRARY) + wlib +$(SHARED_LIBRARY) +endif + +$(SHARED_LIBRARY): $(OBJS) + @$(MAKE_OBJDIR) + rm -f $@ +ifeq ($(OS_ARCH), AIX) + echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms + nm -B -C -g $(OBJS) \ + | awk '/ [T,D] / {print $$3}' \ + | sed -e 's/^\.//' \ + | sort -u >> $(OBJDIR)/lib$(LIBRARY_NAME)_syms + $(LD) $(XCFLAGS) -o $@ $(OBJS) -bE:$(OBJDIR)/lib$(LIBRARY_NAME)_syms \ + -bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS) +else +ifeq ($(OS_ARCH), WINNT) +ifeq ($(OS_TARGET), WIN16) + echo system windows dll initinstance >w16link + echo option map >>w16link + echo option oneautodata >>w16link + echo option heapsize=32K >>w16link + echo debug watcom all >>w16link + echo name $@ >>w16link + echo file >>w16link + echo $(W16OBJS) >>w16link + echo $(W16LIBS) >>w16link + echo libfile libentry >>w16link + $(LINK) @w16link. + rm w16link +else + $(LINK_DLL) -MAP $(DLLBASE) $(OS_LIBS) $(EXTRA_LIBS) $(OBJS) $(LDFLAGS) +endif +else + $(MKSHLIB) -o $@ $(OBJS) $(LD_LIBS) $(OS_LIBS) $(EXTRA_LIBS) + chmod +x $@ +endif +endif + +$(PURE_LIBRARY): + rm -f $@ +ifneq ($(OS_ARCH), WINNT) + $(AR) $(OBJS) +endif + $(RANLIB) $@ + +ifeq ($(OS_ARCH), WINNT) +$(RES): $(RESNAME) + @$(MAKE_OBJDIR) + $(RC) -Fo$(RES) $(RESNAME) + @echo $(RES) finished + +$(DLL): $(OBJS) $(EXTRA_LIBS) + @$(MAKE_OBJDIR) + rm -f $@ + $(LINK_DLL) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) +endif + +$(OBJDIR)/$(PROG_PREFIX)%$(PROG_SUFFIX): $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX) + @$(MAKE_OBJDIR) +ifeq ($(OS_ARCH),WINNT) + $(CC) $(OBJDIR)/$(PROG_PREFIX)$*$(OBJ_SUFFIX) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) +else + $(CC) -o $@ $(OBJDIR)/$(PROG_PREFIX)$*$(OBJ_SUFFIX) $(LDFLAGS) +endif + +ifdef HAVE_PURIFY +$(OBJDIR)/$(PROG_PREFIX)%.pure: $(OBJDIR)/%$(OBJ_SUFFIX) + @$(MAKE_OBJDIR) +ifeq ($(OS_ARCH),WINNT) + $(PURIFY) $(CC) -Fo$@ -c $(CFLAGS) $(OBJDIR)/$(PROG_PREFIX)$*$(OBJ_SUFFIX) $(PURELDFLAGS) +else + $(PURIFY) $(CC) -o $@ $(CFLAGS) $(OBJDIR)/$(PROG_PREFIX)$*$(OBJ_SUFFIX) $(PURELDFLAGS) +endif +endif + +WCCFLAGS1 := $(subst /,\\,$(CFLAGS)) +WCCFLAGS2 := $(subst -I,-i=,$(WCCFLAGS1)) +WCCFLAGS3 := $(subst -D,-d,$(WCCFLAGS2)) + +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c + @$(MAKE_OBJDIR) +ifeq ($(OS_ARCH), WINNT) +ifeq ($(OS_TARGET), WIN16) + echo $(WCCFLAGS3) >w16wccf + $(CC) -zq -fo$(OBJDIR)\\$(PROG_PREFIX)$*$(OBJ_SUFFIX) @w16wccf $*.c + rm w16wccf +else + $(CC) -Fo$@ -c $(CFLAGS) $*.c +endif +else + $(CC) -o $@ -c $(CFLAGS) $*.c +endif + +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.s + @$(MAKE_OBJDIR) + $(AS) -o $@ $(ASFLAGS) -c $*.s + +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.S + @$(MAKE_OBJDIR) + $(AS) -o $@ $(ASFLAGS) -c $*.S + +$(OBJDIR)/$(PROG_PREFIX)%: %.cpp + @$(MAKE_OBJDIR) +ifeq ($(OS_ARCH), WINNT) + $(CCC) -Fo$@ -c $(CFLAGS) $< +else + $(CCC) -o $@ -c $(CFLAGS) $< +endif + +# +# Please keep the next two rules in sync. +# +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cc + @$(MAKE_OBJDIR) + $(CCC) -o $@ -c $(CFLAGS) $*.cc + +$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cpp + @$(MAKE_OBJDIR) +ifdef STRICT_CPLUSPLUS_SUFFIX + echo "#line 1 \"$*.cpp\"" | cat - $*.cpp > $(OBJDIR)/t_$*.cc + $(CCC) -o $@ -c $(CFLAGS) $(OBJDIR)/t_$*.cc + rm -f $(OBJDIR)/t_$*.cc +else +ifeq ($(OS_ARCH),WINNT) + $(CCC) -Fo$@ -c $(CFLAGS) $*.cpp +else + $(CCC) -o $@ -c $(CFLAGS) $*.cpp +endif +endif #STRICT_CPLUSPLUS_SUFFIX + +%.i: %.cpp +ifeq ($(OS_TARGET), WIN16) + echo $(WCCFLAGS3) >w16wccf + $(CCC) -pl -fo=$* @w16wccf $*.cpp + rm w16wccf +else + $(CCC) -C -E $(CFLAGS) $< > $*.i +endif + +%.i: %.c +ifeq ($(OS_TARGET), WIN16) + echo $(WCCFLAGS3) >w16wccf + $(CC) -pl -fo=$* @w16wccf $*.c + rm w16wccf +else + $(CC) -C -E $(CFLAGS) $< > $*.i +endif + +%: %.pl + rm -f $@; cp $*.pl $@; chmod +x $@ + +%: %.sh + rm -f $@; cp $*.sh $@; chmod +x $@ + +ifdef DIRS +$(DIRS):: + @if test -d $@; then \ + set $(EXIT_ON_ERROR); \ + echo "cd $@; $(MAKE)"; \ + cd $@; $(MAKE); \ + set +e; \ + else \ + echo "Skipping non-directory $@..."; \ + fi; \ + $(CLICK_STOPWATCH) +endif + +################################################################################ +# Bunch of things that extend the 'export' rule (in order): +################################################################################ + +$(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! + +endif + +################################################################################ +### JSRCS -- for compiling java files + +ifneq ($(JSRCS),) +export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) + @list=`perl $(NETLIBDEPTH)/gconfig/outofdate.pl $(PERLARG) \ + -d $(JAVA_DESTPATH)/$(PACKAGE) $(JSRCS)`; \ + if test "$$list"x != "x"; then \ + echo $(JAVAC) $$list; \ + $(JAVAC) $$list; \ + fi + +all:: export + +clobber:: + rm -f $(SOURCE_XP_DIR)/classes/$(PACKAGE)/*.class + +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 +# +ifdef JDIRS +export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE) + @for d in $(JDIRS); do \ + if test -d $$d; then \ + set $(EXIT_ON_ERROR); \ + files=`echo $$d/*.java`; \ + list=`perl $(NETLIBDEPTH)/gconfig/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 + +# +# JDK_GEN -- for generating "old style" native methods +# +# Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory +# +ifneq ($(JDK_GEN),) +ifdef NSBUILDROOT + INCLUDES += -I$(JDK_GEN_DIR) -I$(SOURCE_XP_DIR) +else + INCLUDES += -I$(JDK_GEN_DIR) +endif +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 $(NETLIBDEPTH)/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 $(NETLIBDEPTH)/lib/mac/Java/_gen $(JDK_PACKAGE_CLASSES) + @echo Generating/Updating JDK stubs for the Mac + $(JAVAH) -mac -stubs -d $(NETLIBDEPTH)/lib/mac/Java/_stubs $(JDK_PACKAGE_CLASSES) +endif +endif + +# +# JRI_GEN -- for generating JRI native methods +# +# Generate JRI Headers and Stubs into the 'jri' directory +# +ifneq ($(JRI_GEN),) +ifdef NSBUILDROOT + INCLUDES += -I$(JRI_GEN_DIR) -I$(SOURCE_XP_DIR) +else + INCLUDES += -I$(JRI_GEN_DIR) +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 $(NETLIBDEPTH)/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 $(NETLIBDEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES) + @echo Generating/Updating JRI stubs for the Mac + $(JAVAH) -jri -mac -stubs -d $(NETLIBDEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES) +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),) + 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%.h $(JMC_GEN_DIR)/M%.c + @$(MAKE_OBJDIR) + $(CC) -o $@ -c $(CFLAGS) $(JMC_GEN_DIR)/M$*.c + +export:: $(JMC_HEADERS) $(JMC_STUBS) +endif + +# +# Copy each element of EXPORTS to $(SOURCE_XP_DIR)/public/$(MODULE)/ +# +PUBLIC_EXPORT_DIR = $(SOURCE_XP_DIR)/public/$(MODULE) +ifeq ($(OS_ARCH),WINNT) +ifeq ($(OS_TARGET),WIN16) +PUBLIC_EXPORT_DIR = $(SOURCE_XP_DIR)/public/win16 +endif +endif + +ifneq ($(EXPORTS),) +$(PUBLIC_EXPORT_DIR):: + @if test ! -d $@; then \ + echo Creating $@; \ + $(NSINSTALL) -D $@; \ + fi + +export:: $(EXPORTS) $(PUBLIC_EXPORT_DIR) + $(INSTALL) -m 444 $(EXPORTS) $(PUBLIC_EXPORT_DIR) +endif + +# Duplicate export rule for private exports, with different directories + +PRIVATE_EXPORT_DIR = $(SOURCE_XP_DIR)/private/$(MODULE) +ifeq ($(OS_ARCH),WINNT) +ifeq ($(OS_TARGET),WIN16) +PRIVATE_EXPORT_DIR = $(SOURCE_XP_DIR)/public/win16 +endif +endif + +ifneq ($(PRIVATE_EXPORTS),) +$(PRIVATE_EXPORT_DIR):: + @if test ! -d $@; then \ + echo Creating $@; \ + $(NSINSTALL) -D $@; \ + fi + +private_export:: $(PRIVATE_EXPORTS) $(PRIVATE_EXPORT_DIR) + $(INSTALL) -m 444 $(PRIVATE_EXPORTS) $(PRIVATE_EXPORT_DIR) +else +private_export:: + @echo There are no private exports.; +endif + +# Duplicate export rule for tests, with different directories + + +TESTS_DIR = $(RESULTS_DIR)/$(RESULTS_SUBDIR)/$(OS_CONFIG)$(CPU_TAG)$(COMPILER_TAG)$(IMPL_STRATEGY) + +ifneq ($(REGRESSION_SPEC),) +ifneq ($(OS_ARCH),WINNT) +tests:: $(REGRESSION_SPEC) $(GDEPTH)/$(MODULE)/scripts/regress.pl $(SOURCE_MD_DIR)/bin/reporter$(PROG_SUFFIX) + cd $(PLATFORM); \ + perl5 -I ../$(GDEPTH)/$(MODULE)/scripts \ + ../$(GDEPTH)/$(MODULE)/scripts/regress.pl \ + specfile=../$(REGRESSION_SPEC) platform=$(PLATFORM) progress; \ + if test ! -d $(TESTS_DIR); then \ + echo Creating $(TESTS_DIR); \ + ../$(NSINSTALL) -D $(TESTS_DIR); \ + fi +ifneq ($(BUILD_OPT),) + cd $(PLATFORM); \ + ../$(NSINSTALL) -m 664 $(REGDATE).sum $(TESTS_DIR); \ + ../$(NSINSTALL) -m 664 $(REGDATE).htm $(TESTS_DIR); \ + ../$(SOURCE_MD_DIR)/bin/reporter$(PROG_SUFFIX) rptdir=$(RELEASE_TREE)/$(MODULE)/results specfile=$(RESULTS_DIR)/rptspec +endif +else +tests:: $(REGRESSION_SPEC) $(SOURCE_MD_DIR)/bin/regress$(PROG_SUFFIX) $(SOURCE_MD_DIR)/bin/reporter$(PROG_SUFFIX) + cd $(PLATFORM); \ + ../$(SOURCE_MD_DIR)/bin/regress$(PROG_SUFFIX) specfile=../$(REGRESSION_SPEC) progress; \ + if test ! -d $(TESTS_DIR); then \ + echo Creating $(TESTS_DIR); \ + $(NSINSTALL) -D $(TESTS_DIR); \ + fi +ifneq ($(BUILD_OPT),) + cd $(PLATFORM); \ + $(NSINSTALL) -m 664 $(REGDATE).sum $(TESTS_DIR); \ + $(NSINSTALL) -m 664 $(REGDATE).htm $(TESTS_DIR); \ + echo "Please now make sure your results files are copied to $(TESTS_DIR), "; \ + echo "then run 'reporter specfile=$(RESULTS_DIR)/rptspec'" +endif +endif +else +tests:: + @echo There are no regression suites. Define REGRESSION_SPEC in your manifest.mn file!; +endif + +# Duplicate export rule for releases, with different directories + +ifneq ($(EXPORTS),) +$(SOURCE_XP_DIR)/release/include:: + @if test ! -d $@; then \ + echo Creating $@; \ + $(NSINSTALL) -D $@; \ + fi + +release_export:: $(EXPORTS) $(SOURCE_XP_DIR)/release/include + $(INSTALL) -m 444 $(EXPORTS) $(SOURCE_XP_DIR)/release/include +endif + + + + +################################################################################ + +-include $(DEPENDENCIES) + +ifneq ($(OS_ARCH),WINNT) +# Can't use sed because of its 4000-char line length limit, so resort to perl +.DEFAULT: + @perl -e ' \ + open(MD, "< $(DEPENDENCIES)"); \ + while () { \ + 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 () { \ + 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); \ + }' +endif + +############################################################################# +# X dependency system +############################################################################# + +ifneq ($(OS_ARCH),WINNT) + +$(MKDEPENDENCIES):: + @$(MAKE_OBJDIR) + touch $(MKDEPENDENCIES) + $(MKDEPEND) -p$(OBJDIR_NAME)/ -o'$(OBJ_SUFFIX)' -f$(MKDEPENDENCIES) $(INCLUDES) $(CSRCS) $(CPPSRCS) $(ASFILES) + +$(MKDEPEND):: + cd $(MKDEPEND_DIR); $(MAKE) + +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 + +################################################################################ +# Special gmake rules. +################################################################################ + +# +# Re-define the list of default suffixes, so gmake won't have to churn through +# 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 + +# +# Don't delete these files if we get killed. +# +.PRECIOUS: .java $(JDK_HEADERS) $(JDK_STUBS) $(JRI_HEADERS) $(JRI_STUBS) $(JMC_HEADERS) $(JMC_STUBS) + +# +# 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 realclean release $(OBJDIR) $(DIRS) + diff --git a/gconfig/ruleset.mk b/gconfig/ruleset.mk new file mode 100644 index 00000000000..9efea4916e4 --- /dev/null +++ b/gconfig/ruleset.mk @@ -0,0 +1,293 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# # +# Parameters to this makefile (set these in this file): # +# # +# a) # +# TARGETS -- the target to create # +# (defaults to $LIBRARY $PROGRAM) # +# b) # +# DIRS -- subdirectories for make to recurse on # +# (the 'all' rule builds $TARGETS $DIRS) # +# c) # +# CSRCS, CPPSRCS -- .c and .cpp files to compile # +# (used to define $OBJS) # +# d) # +# PROGRAM -- the target program name to create from $OBJS # +# ($OBJDIR automatically prepended to it) # +# 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) # +# 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) # +# # +####################################################################### + +# +# At this time, the CPU_TAG value is actually assigned. +# + +CPU_TAG = + +# +# When the processor is NOT 386-based on Windows NT, override the +# value of $(CPU_TAG). +# +ifeq ($(OS_ARCH), WINNT) + ifneq ($(CPU_ARCH),x386) + CPU_TAG = _$(CPU_ARCH) + endif +endif + +# +# At this time, the COMPILER_TAG value is actually assigned. +# + +ifneq ($(DEFAULT_COMPILER), $(CC)) +# +# XXX +# Temporary define for the Client; to be removed when binary release is used +# + ifdef MOZILLA_CLIENT + COMPILER_TAG = + else + COMPILER_TAG = _$(CC) + endif +else + COMPILER_TAG = +endif + +# +# This makefile contains rules for building the following kinds of +# objects: +# - (1) LIBRARY: a static (archival) library +# - (2) SHARED_LIBRARY: a shared (dynamic link) library +# - (3) IMPORT_LIBRARY: an import library, used only on Windows +# - (4) PURE_LIBRARY: a library for Purify +# - (5) PROGRAM: an executable binary +# +# NOTE: The names of libraries can be generated by simply specifying +# LIBRARY_NAME and LIBRARY_VERSION. +# + +ifdef LIBRARY_NAME + ifeq ($(OS_ARCH), WINNT) + # + # Win16 requires library names conforming to the 8.3 rule. + # other platforms do not. + # + LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).lib + SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).dll + IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).lib + else + LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME).$(LIB_SUFFIX) + ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) + SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME)_shr.a + else + SHARED_LIBRARY = $(OBJDIR)/lib$(LIBRARY_NAME).$(DLL_SUFFIX) + endif + + ifdef HAVE_PURIFY + ifdef DSO_BACKEND + PURE_LIBRARY = $(OBJDIR)/purelib$(LIBRARY_NAME).$(DLL_SUFFIX) + else + PURE_LIBRARY = $(OBJDIR)/purelib$(LIBRARY_NAME).$(LIB_SUFFIX) + endif + endif + endif +endif + +# +# Common rules used by lots of makefiles... +# + +ifdef PROGRAM + PROGRAM := $(addprefix $(OBJDIR)/, $(PROGRAM)$(PROG_SUFFIX)) +endif + +ifndef LIBRARY + ifdef LIBRARY_NAME + LIBRARY = lib$(LIBRARY_NAME).$(LIB_SUFFIX) + endif +endif + +ifdef LIBRARY +# LIBRARY := $(addprefix $(OBJDIR)/, $(LIBRARY)) + ifdef MKSHLIB + ifeq ($(OS_ARCH),WINNT) + SHARED_LIBRARY = $(LIBRARY:.lib=.dll) + else + ifeq ($(OS_ARCH),HP-UX) + SHARED_LIBRARY = $(LIBRARY:.a=.sl) + else + # SunOS 4 _requires_ that shared libs have a version number. + ifeq ($(OS_RELEASE),4.1.3_U1) + SHARED_LIBRARY = $(LIBRARY:.a=.so.1.0) + else + SHARED_LIBRARY = $(LIBRARY:.a=.so) + endif + endif + endif + endif +endif + +ifdef PROGRAMS + PROGRAMS := $(addprefix $(OBJDIR)/, $(PROGRAMS:%=%$(PROG_SUFFIX))) +endif + +ifndef TARGETS + ifeq ($(OS_ARCH), WINNT) + TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(PROGRAM) + else + TARGETS = $(LIBRARY) $(SHARED_LIBRARY) + ifdef HAVE_PURIFY + TARGETS += $(PURE_LIBRARY) + endif + TARGETS += $(PROGRAM) + endif +endif + +ifndef OBJS + OBJS := $(JRI_STUB_CFILES) $(addsuffix $(OBJ_SUFFIX), $(JMC_GEN)) $(CSRCS:.c=$(OBJ_SUFFIX)) \ + $(CPPSRCS:.cpp=$(OBJ_SUFFIX)) $(ASFILES:.s=$(OBJ_SUFFIX)) + OBJS := $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(OBJS)) +endif + +ifeq ($(OS_TARGET), WIN16) + comma := , + empty := + space := $(empty) $(empty) + W16OBJS := $(subst $(space),$(comma)$(space),$(strip $(OBJS))) + W16TEMP = $(OS_LIBS) $(EXTRA_LIBS) + ifeq ($(strip $(W16TEMP)),) + W16LIBS = + else + W16LIBS := library $(subst $(space),$(comma)$(space),$(strip $(W16TEMP))) + endif +endif + +ifeq ($(OS_ARCH),WINNT) + ifneq ($(OS_TARGET), WIN16) + OBJS += $(RES) + endif + ifdef DLL + DLL := $(addprefix $(OBJDIR)/, $(DLL)) + LIB := $(addprefix $(OBJDIR)/, $(LIB)) + endif + MAKE_OBJDIR = mkdir $(OBJDIR) +else + define MAKE_OBJDIR + if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi + endef +endif + +ifndef PACKAGE + PACKAGE = . +endif + +ALL_TRASH := $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \ + $(NOSUCHFILE) $(JDK_HEADER_CFILES) $(JDK_STUB_CFILES) \ + $(JRI_HEADER_CFILES) $(JRI_STUB_CFILES) $(JMC_STUBS) \ + $(JMC_HEADERS) $(JMC_EXPORT_FILES) so_locations \ + _gen _jmc _jri _stubs \ + $(wildcard $(JAVA_DESTPATH)/$(PACKAGE)/*.class) + +ifdef JDIRS + ALL_TRASH += $(addprefix $(JAVA_DESTPATH)/,$(JDIRS)) +endif + +ifdef NSBUILDROOT + JDK_GEN_DIR = $(SOURCE_XP_DIR)/_gen + JMC_GEN_DIR = $(SOURCE_XP_DIR)/_jmc + JRI_GEN_DIR = $(SOURCE_XP_DIR)/_jri + JDK_STUB_DIR = $(SOURCE_XP_DIR)/_stubs +else + JDK_GEN_DIR = _gen + JMC_GEN_DIR = _jmc + JRI_GEN_DIR = _jri + JDK_STUB_DIR = _stubs +endif + +# +# If this is an "official" build, try to build everything. +# I.e., don't exit on errors. +# + +ifdef BUILD_OFFICIAL + EXIT_ON_ERROR = +e + CLICK_STOPWATCH = date +else + EXIT_ON_ERROR = -e + CLICK_STOPWATCH = true +endif + +ifdef REQUIRES +ifeq ($(OS_TARGET),WIN16) + INCLUDES += -I$(SOURCE_XP_DIR)/public/win16 +else + MODULE_INCLUDES := $(addprefix -I$(SOURCE_XP_DIR)/public/, $(REQUIRES)) + INCLUDES += $(MODULE_INCLUDES) + ifeq ($(MODULE), sectools) + PRIVATE_INCLUDES := $(addprefix -I$(SOURCE_XP_DIR)/private/, $(REQUIRES)) + INCLUDES += $(PRIVATE_INCLUDES) + endif +endif +endif + +ifdef DIRS + LOOP_OVER_DIRS = \ + @for directory in $(DIRS); do \ + if test -d $$directory; then \ + set $(EXIT_ON_ERROR); \ + echo "cd $$directory; $(MAKE) $@"; \ + $(MAKE) -C $$directory $@; \ + set +e; \ + else \ + echo "Skipping non-directory $$directory..."; \ + fi; \ + $(CLICK_STOPWATCH); \ + done +endif + + + +# special stuff for tests rule in rules.mk + +ifneq ($(OS_ARCH),WINNT) + REGDATE = $(subst \ ,, $(shell perl $(GDEPTH)/$(MODULE)/scripts/now)) +else + REGCOREDEPTH = $(subst \\,/,$(GDEPTH)) + REGDATE = $(subst \ ,, $(shell perl $(GDEPTH)/$(MODULE)/scripts/now)) +endif + + diff --git a/gconfig/source.mk b/gconfig/source.mk new file mode 100644 index 00000000000..e715c0fb33c --- /dev/null +++ b/gconfig/source.mk @@ -0,0 +1,111 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Master -specific source import/export directories # +####################################################################### + +# +# master import/export directory prefix +# + +SOURCE_PREFIX = $(GDEPTH)/dist + +# +# cross-platform (xp) master import/export directory +# + +SOURCE_XP_DIR = $(SOURCE_PREFIX) + +# +# cross-platform (xp) import/export directories +# + +SOURCE_CLASSES_DIR = $(SOURCE_XP_DIR)/classes +SOURCE_XPHEADERS_DIR = $(SOURCE_XP_DIR)/public/$(MODULE) +ifeq ($(MODULE), sectools) + SOURCE_XPPRIVATE_DIR = $(SOURCE_XP_DIR)/private/$(MODULE) +endif + +# +# machine-dependent (md) master import/export directory +# + +SOURCE_MD_DIR = $(SOURCE_PREFIX)/$(PLATFORM) + +# +# machine-dependent (md) import/export directories +# + +SOURCE_BIN_DIR = $(SOURCE_MD_DIR)/bin +SOURCE_LIB_DIR = $(SOURCE_MD_DIR)/lib +SOURCE_MDHEADERS_DIR = $(SOURCE_MD_DIR)/include + +####################################################################### +# Master -specific source release directories and files # +####################################################################### + +# +# source-side master release directory prefix +# + +SOURCE_RELEASE_PREFIX = $(SOURCE_PREFIX)/release + +# +# cross-platform (xp) source-side master release directory +# + +SOURCE_RELEASE_XP_DIR = $(SOURCE_RELEASE_PREFIX) + +# +# cross-platform (xp) source-side release directories +# + +SOURCE_RELEASE_CLASSES_DIR = classes +SOURCE_RELEASE_XPHEADERS_DIR = include + +# +# cross-platform (xp) JAR source-side release files +# + +XPCLASS_JAR = xpclass.jar +XPHEADER_JAR = xpheader.jar + +# +# machine-dependent (md) source-side master release directory +# + +SOURCE_RELEASE_MD_DIR = $(PLATFORM) +# +# machine-dependent (md) source-side release directories +# + +SOURCE_RELEASE_BIN_DIR = $(PLATFORM)/bin +SOURCE_RELEASE_LIB_DIR = $(PLATFORM)/lib +SOURCE_RELEASE_MDHEADERS_DIR = $(PLATFORM)/include +SOURCE_RELEASE_SPEC_DIR = $(SOURCE_RELEASE_MD_DIR) + +# +# machine-dependent (md) JAR/tar source-side release files +# + +MDBINARY_JAR = mdbinary.jar +MDHEADER_JAR = mdheader.jar + + +# Where to put the results + +RESULTS_DIR = $(RELEASE_TREE)/sectools/results + diff --git a/gconfig/suffix.mk b/gconfig/suffix.mk new file mode 100644 index 00000000000..bb1ee9c11f0 --- /dev/null +++ b/gconfig/suffix.mk @@ -0,0 +1,102 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Master "Core Components" suffixes # +####################################################################### + +# +# Object suffixes +# + +ifndef OBJ_SUFFIX + ifeq ($(OS_ARCH), WINNT) + OBJ_SUFFIX = .obj + else + OBJ_SUFFIX = .o + endif +endif + +# +# Library suffixes +# + +STATIC_LIB_EXTENSION = + +ifndef DYNAMIC_LIB_EXTENSION + ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) + DYNAMIC_LIB_EXTENSION = _shr + else + DYNAMIC_LIB_EXTENSION = + endif +endif + + +ifndef STATIC_LIB_SUFFIX + STATIC_LIB_SUFFIX = .$(LIB_SUFFIX) +endif + + +ifndef DYNAMIC_LIB_SUFFIX + DYNAMIC_LIB_SUFFIX = .$(DLL_SUFFIX) +endif + + +ifndef IMPORT_LIB_SUFFIX + ifeq ($(OS_ARCH), WINNT) + IMPORT_LIB_SUFFIX = .$(LIB_SUFFIX) + else + IMPORT_LIB_SUFFIX = + endif +endif + + +ifndef PURE_LIB_SUFFIX + ifeq ($(OS_ARCH), WINNT) + PURE_LIB_SUFFIX = + else + ifdef DSO_BACKEND + PURE_LIB_SUFFIX = .$(DLL_SUFFIX) + else + PURE_LIB_SUFFIX = .$(LIB_SUFFIX) + endif + endif +endif + + +ifndef STATIC_LIB_SUFFIX_FOR_LINKING + STATIC_LIB_SUFFIX_FOR_LINKING = $(STATIC_LIB_SUFFIX) +endif + + +ifndef DYNAMIC_LIB_SUFFIX_FOR_LINKING + ifeq ($(OS_ARCH), WINNT) + DYNAMIC_LIB_SUFFIX_FOR_LINKING = $(IMPORT_LIB_SUFFIX) + else + DYNAMIC_LIB_SUFFIX_FOR_LINKING = $(DYNAMIC_LIB_SUFFIX) + endif +endif + +# +# Program suffixes +# + +ifndef PROG_SUFFIX + ifeq ($(OS_ARCH), WINNT) + PROG_SUFFIX = .exe + else + PROG_SUFFIX = + endif +endif diff --git a/gconfig/tree.mk b/gconfig/tree.mk new file mode 100644 index 00000000000..e9b27445c2e --- /dev/null +++ b/gconfig/tree.mk @@ -0,0 +1,44 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Master "Core Components" file system "release" prefixes # +####################################################################### + +# RELEASE_TREE = $(GDEPTH)/../coredist + + +ifndef RELEASE_TREE + RELEASE_TREE = /m/dist + + ifeq ($(OS_TARGET), WINNT) + RELEASE_TREE = \\helium\dist + endif + + ifeq ($(OS_TARGET), WIN95) + RELEASE_TREE = \\helium\dist + endif + + ifeq ($(OS_TARGET), WIN16) + RELEASE_TREE = \\helium\dist + endif +endif + +RELEASE_XP_DIR = +RELEASE_MD_DIR = $(PLATFORM) + + +REPORTER_TREE = $(subst \,\\,$(RELEASE_TREE)) + diff --git a/gconfig/version.mk b/gconfig/version.mk new file mode 100644 index 00000000000..aeccc4aacd3 --- /dev/null +++ b/gconfig/version.mk @@ -0,0 +1,85 @@ +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +####################################################################### +# Build master "Core Components" release version directory name # +####################################################################### + +# +# Always set CURRENT_VERSION_SYMLINK to the symbolic link. +# + +CURRENT_VERSION_SYMLINK = current + + +# +# For the sake of backwards compatibility (*sigh*) ... +# + +ifndef VERSION + ifdef BUILD_NUM + VERSION = $(BUILD_NUM) + endif +endif + +ifndef RELEASE_VERSION + ifdef BUILD_NUM + RELEASE_VERSION = $(BUILD_NUM) + endif +endif + +# +# If VERSION has still NOT been set on the command line, +# as an environment variable, by the individual Makefile, or +# by the -specific "version.mk" file, set VERSION equal +# to $(CURRENT_VERSION_SYMLINK). + +ifndef VERSION + VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +# If RELEASE_VERSION has still NOT been set on the command line, +# as an environment variable, by the individual Makefile, or +# by the -specific "version.mk" file, automatically +# generate the next available version number via a perl script. +# + +ifndef RELEASE_VERSION + RELEASE_VERSION = +endif + +# +# Set -specific versions for compiliation and linkage. +# + +ifndef JAVA_VERSION + JAVA_VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +ifndef NETLIB_VERSION + NETLIB_VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +ifndef NSPR_VERSION + NSPR_VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +ifndef SECTOOLS_VERSION + SECTOOLS_VERSION = $(CURRENT_VERSION_SYMLINK) +endif + +ifndef SECURITY_VERSION + SECURITY_VERSION = $(CURRENT_VERSION_SYMLINK) +endif diff --git a/gconfig/version.pl b/gconfig/version.pl new file mode 100644 index 00000000000..24cbbb5621c --- /dev/null +++ b/gconfig/version.pl @@ -0,0 +1,59 @@ +#!/usr/sbin/perl +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +# Compose lowercase alphabet +@alphabet = ( "a", "b", "c", "d", "e", "f", "g", "h", + "i", "j", "k", "l", "m", "n", "o", "p", + "q", "r", "s", "t", "u", "v", "w", "x", + "y", "z" ); + +# Compute year +$year = (localtime)[5] + 1900; + +# Compute month +$month = (localtime)[4] + 1; + +# Compute day +$day = (localtime)[3]; + +# Compute base build number +$version = sprintf( "%d%02d%02d", $year, $month, $day ); +$directory = sprintf( "%s\/%s\/%d%02d%02d", $ARGV[0], $ARGV[1], $year, $month, $day ); + +# Print out the name of the first version directory which does not exist +#if( ! -e $directory ) +#{ + print $version; +#} +#else +#{ +# # Loop through combinations +# foreach $ch1 (@alphabet) +# { +# foreach $ch2 (@alphabet) +# { +# $version = sprintf( "%d%02d%02d%s%s", $year, $month, $day, $ch1, $ch2 ); +# $directory = sprintf( "%s\/%s\/%d%02d%02d%s%s", $ARGV[0], $ARGV[1], $year, $month, $day, $ch1, $ch2 ); +# if( ! -e $directory ) +# { +# print STDOUT $version; +# exit; +# } +# } +# } +#} +