Compare commits

..

10 Commits

Author SHA1 Message Date
(no author)
711d3e7e52 This commit was manufactured by cvs2svn to create tag 'Warpzilla'.
git-svn-id: svn://10.0.0.236/tags/Warpzilla@140 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-09 20:33:24 +00:00
law
15e2581318 Warpzilla April09 patches
git-svn-id: svn://10.0.0.236/branches/OS2_BRANCH@139 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-09 20:33:23 +00:00
law
f719e4a426 April 08 patches
git-svn-id: svn://10.0.0.236/branches/OS2_BRANCH@135 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-09 17:53:31 +00:00
law
ec5ef5b969 Remove ramsem.o and sem_x86.o
git-svn-id: svn://10.0.0.236/branches/OS2_BRANCH@93 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 04:37:12 +00:00
law
83b9febfcd Add _MD_EXIT
git-svn-id: svn://10.0.0.236/branches/OS2_BRANCH@92 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 04:36:12 +00:00
law
686490c150 Fix MAKE_OBJDIR and use ar under emx
git-svn-id: svn://10.0.0.236/branches/OS2_BRANCH@91 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 04:35:18 +00:00
law
b518852906 Warpzilla patches
git-svn-id: svn://10.0.0.236/branches/OS2_BRANCH@78 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 01:53:17 +00:00
law
c6ae1a5bee Warpzilla patches
git-svn-id: svn://10.0.0.236/branches/OS2_BRANCH@76 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-08 01:39:25 +00:00
law
b67c87805b Warpzilla patches
git-svn-id: svn://10.0.0.236/branches/OS2_BRANCH@63 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-07 21:26:52 +00:00
(no author)
05ceb49b94 This commit was manufactured by cvs2svn to create branch 'OS2_BRANCH'.
git-svn-id: svn://10.0.0.236/branches/OS2_BRANCH@55 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-07 00:00:42 +00:00
606 changed files with 153709 additions and 8942 deletions

37
mozilla/LEGAL Normal file
View File

@@ -0,0 +1,37 @@
Please be apprised of the following Legal Notices:
A) Wang contends that its U.S. Patent No. 4, 751,669 ("the '669
Patent") disclosing a "video text" system, is infringed by the following
functionality in the Netscape Navigator code: 1) the animated logo and
status line indicators --See Claims 1,8 and 9; 2) the "File Save As"
function --See Claims 23-27; 3) Bookmarks and Rename Bookmarks in the
Properties window --See Claims 20-22; 4) storing HTML, GIF, and JPEG
files and adding filename extensions based on mime types (performed in
Windows OS) --See Claim 38. Netscape believes the '669 Patent is
invalid and non-infringed. Netscape is vigorously defending against
Wang's claims.
B) Intermind owns pending U.S. patent applications on communications
systems which employ metadata ("channel objects") to define a control
structure for information transfer. The Netscape code does not infringe
as released; however, modifications which utilize channel objects as
described by Intermind should be considered carefully. The following is
a statement from Intermind: "Intermind's claims fundamentally involve
the use of a control structure to automate communications. ...The
essence of Intermind's top claim is that two devices sender and
receiver have persistent storage, communicate over a network,
and exchange a control structure including metadata which describes: 1)
what information is to be updated, 2) when to update this information,
and 3) how to transfer the updated information. In addition, at least
the receiving device must be able to process the metadata in order to
perform the update determination and transfer. Any digital
communications system which incorporates all of these elements will be
covered by Intermind's patents." See Intermind.com.
C) Stac, Inc., and its licensing agent Hi/fn, own several patents which
disclose data compression methods implementing an LZS compression
algorithm, including U.S. Patent Nos. 4,701,745 and 5,016, 009 ("the
Stac Patents"). The Netscape Communicator code does not perform
compression. If you modify the Netscape source code to perform
compression, please take notice of the Stac Patents.

421
mozilla/LICENSE Normal file
View File

@@ -0,0 +1,421 @@
NETSCAPE PUBLIC LICENSE
Version 1.0
----------------
1. Definitions.
1.1. ``Contributor'' means each entity that creates or contributes to
the creation of Modifications.
1.2. ``Contributor Version'' means the combination of the Original
Code, prior Modifications used by a Contributor, and the Modifications
made by that particular Contributor.
1.3. ``Covered Code'' means the Original Code or Modifications or the
combination of the Original Code and Modifications, in each case
including portions thereof.
1.4. ``Electronic Distribution Mechanism'' means a mechanism generally
accepted in the software development community for the electronic
transfer of data.
1.5. ``Executable'' means Covered Code in any form other than Source
Code.
1.6. ``Initial Developer'' means the individual or entity identified as
the Initial Developer in the Source Code notice required by Exhibit A.
1.7. ``Larger Work'' means a work which combines Covered Code or
portions thereof with code not governed by the terms of this License.
1.8. ``License'' means this document.
1.9. ``Modifications'' means any addition to or deletion from the
substance or structure of either the Original Code or any previous
Modifications. When Covered Code is released as a series of files, a
Modification is:
A. Any addition to or deletion from the contents of a file
containing Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or
previous Modifications.
1.10. ``Original Code'' means Source Code of computer software code
which is described in the Source Code notice required by Exhibit A as
Original Code, and which, at the time of its release under this License
is not already Covered Code governed by this License.
1.11. ``Source Code'' means the preferred form of the Covered Code for
making modifications to it, including all modules it contains, plus any
associated interface definition files, scripts used to control
compilation and installation of an Executable, or a list of source code
differential comparisons against either the Original Code or another
well known, available Covered Code of the Contributor's choice. The
Source Code can be in a compressed or archival form, provided the
appropriate decompression or de-archiving software is widely available
for no charge.
1.12. ``You'' means an individual or a legal entity exercising rights
under, and complying with all of the terms of, this License or a future
version of this License issued under Section 6.1. For legal entities,
``You'' includes any entity which controls, is controlled by, or is
under common control with You. For purposes of this definition,
``control'' means (a) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (b) ownership of fifty percent (50%) or more of the
outstanding shares or beneficial ownership of such entity.
2. Source Code License.
2.1. The Initial Developer Grant.
The Initial Developer hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) to use, reproduce, modify, display, perform, sublicense and
distribute the Original Code (or portions thereof) with or without
Modifications, or as part of a Larger Work; and
(b) under patents now or hereafter owned or controlled by Initial
Developer, to make, have made, use and sell (``Utilize'') the
Original Code (or portions thereof), but solely to the extent that
any such patent is reasonably necessary to enable You to Utilize
the Original Code (or portions thereof) and not to any greater
extent that may be necessary to Utilize further Modifications or
combinations.
2.2. Contributor Grant.
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) to use, reproduce, modify, display, perform, sublicense and
distribute the Modifications created by such Contributor (or
portions thereof) either on an unmodified basis, with other
Modifications, as Covered Code or as part of a Larger Work; and
(b) under patents now or hereafter owned or controlled by
Contributor, to Utilize the Contributor Version (or portions
thereof), but solely to the extent that any such patent is
reasonably necessary to enable You to Utilize the Contributor
Version (or portions thereof), and not to any greater extent that
may be necessary to Utilize further Modifications or combinations.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are
governed by the terms of this License, including without limitation
Section 2.2. The Source Code version of Covered Code may be distributed
only under the terms of this License or a future version of this
License released under Section 6.1, and You must include a copy of this
License with every copy of the Source Code You distribute. You may not
offer or impose any terms on any Source Code version that alters or
restricts the applicable version of this License or the recipients'
rights hereunder. However, You may include an additional document
offering the additional rights described in Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be
made available in Source Code form under the terms of this License
either on the same media as an Executable version or via an accepted
Electronic Distribution Mechanism to anyone to whom you made an
Executable version available; and if made available via Electronic
Distribution Mechanism, must remain available for at least twelve (12)
months after the date it initially became available, or at least six
(6) months after a subsequent version of that particular Modification
has been made available to such recipients. You are responsible for
ensuring that the Source Code version remains available even if the
Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which you contribute to contain a
file documenting the changes You made to create that Covered Code and
the date of any change. You must include a prominent statement that the
Modification is derived, directly or indirectly, from Original Code
provided by the Initial Developer and including the name of the Initial
Developer in (a) the Source Code, and (b) in any notice in an
Executable version or related documentation in which You describe the
origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If You have knowledge that a party claims an intellectual property
right in particular functionality or code (or its utilization
under this License), you must include a text file with the source
code distribution titled ``LEGAL'' which describes the claim and
the party making the claim in sufficient detail that a recipient
will know whom to contact. If you obtain such knowledge after You
make Your Modification available as described in Section 3.2, You
shall promptly modify the LEGAL file in all copies You make
available thereafter and shall take other steps (such as notifying
appropriate mailing lists or newsgroups) reasonably calculated to
inform those who received the Covered Code that new knowledge has
been obtained.
(b) Contributor APIs.
If Your Modification is an application programming interface and
You own or control patents which are reasonably necessary to
implement that API, you must also include this information in the
LEGAL file.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source
Code, and this License in any documentation for the Source Code, where
You describe recipients' rights relating to Covered Code. If You
created one or more Modification(s), You may add your name as a
Contributor to the notice described in Exhibit A. If it is not possible
to put such notice in a particular Source Code file due to its
structure, then you must include such notice in a location (such as a
relevant directory file) where a user would be likely to look for such
a notice. You may choose to offer, and to charge a fee for, warranty,
support, indemnity or liability obligations to one or more recipients
of Covered Code. However, You may do so only on Your own behalf, and
not on behalf of the Initial Developer or any Contributor. You must
make it absolutely clear than any such warranty, support, indemnity or
liability obligation is offered by You alone, and You hereby agree to
indemnify the Initial Developer and every Contributor for any liability
incurred by the Initial Developer or such Contributor as a result of
warranty, support, indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the
requirements of Section 3.1-3.5 have been met for that Covered Code,
and if You include a notice stating that the Source Code version of the
Covered Code is available under the terms of this License, including a
description of how and where You have fulfilled the obligations of
Section 3.2. The notice must be conspicuously included in any notice in
an Executable version, related documentation or collateral in which You
describe recipients' rights relating to the Covered Code. You may
distribute the Executable version of Covered Code under a license of
Your choice, which may contain terms different from this License,
provided that You are in compliance with the terms of this License and
that the license for the Executable version does not attempt to limit
or alter the recipient's rights in the Source Code version from the
rights set forth in this License. If You distribute the Executable
version under a different license You must make it absolutely clear
that any terms which differ from this License are offered by You alone,
not by the Initial Developer or any Contributor. You hereby agree to
indemnify the Initial Developer and every Contributor for any liability
incurred by the Initial Developer or such Contributor as a result of
any such terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code
not governed by the terms of this License and distribute the Larger
Work as a single product. In such a case, You must make sure the
requirements of this License are fulfilled for the Covered Code.
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Code due to statute
or regulation then You must: (a) comply with the terms of this License
to the maximum extent possible; and (b) describe the limitations and
the code they affect. Such description must be included in the LEGAL
file described in Section 3.4 and must be included with all
distributions of the Source Code. Except to the extent prohibited by
statute or regulation, such description must be sufficiently detailed
for a recipient of ordinary skill to be able to understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has
attached the notice in Exhibit A, and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Netscape Communications Corporation (``Netscape'') may publish revised
and/or new versions of the License from time to time. Each version will
be given a distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the
License, You may always continue to use it under the terms of that
version. You may also choose to use such Covered Code under the terms
of any subsequent version of the License published by Netscape. No one
other than Netscape has the right to modify the terms applicable to
Covered Code created under this License.
6.3. Derivative Works.
If you create or use a modified version of this License (which you may
only do in order to apply it to code which is not already Covered Code
governed by this License), you must (a) rename Your license so that the
phrases ``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL'' or
any confusingly similar phrase do not appear anywhere in your license
and (b) otherwise make it clear that your version of the license
contains terms which differ from the Mozilla Public License and
Netscape Public License. (Filling in the name of the Initial Developer,
Original Code or Contributor in the notice described in Exhibit A shall
not of themselves be deemed to be modifications of this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS,
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
8. TERMINATION.
This License and the rights granted hereunder will terminate
automatically if You fail to comply with terms herein and fail to cure
such breach within 30 days of becoming aware of the breach. All
sublicenses to the Covered Code which are properly granted shall
survive any termination of this License. Provisions which, by their
nature, must remain in effect beyond the termination of this License
shall survive.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER
PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND
ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE
BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT
EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a ``commercial item,'' as that term is defined in
48 C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer
software'' and ``commercial computer software documentation,'' as such
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
all U.S. Government End Users acquire Covered Code with only those
rights set forth herein.
11. MISCELLANEOUS.
This License represents the complete agreement concerning subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. This License shall be governed by
California law provisions (except to the extent applicable law, if any,
provides otherwise), excluding its conflict-of-law provisions. With
respect to disputes in which at least one party is a citizen of, or an
entity chartered or registered to do business in, the United States of
America: (a) unless otherwise agreed in writing, all disputes relating
to this License (excepting any dispute relating to intellectual
property rights) shall be subject to final and binding arbitration,
with the losing party paying all costs of arbitration; (b) any
arbitration relating to this Agreement shall be held in Santa Clara
County, California, under the auspices of JAMS/EndDispute; and (c) any
litigation relating to this Agreement shall be subject to the
jurisdiction of the Federal Courts of the Northern District of
California, with venue lying in Santa Clara County, California, with
the losing party responsible for costs, including without limitation,
court costs and reasonable attorneys fees and expenses. The application
of the United Nations Convention on Contracts for the International
Sale of Goods is expressly excluded. Any law or regulation which
provides that the language of a contract shall be construed against the
drafter shall not apply to this License.
12. RESPONSIBILITY FOR CLAIMS.
Except in cases where another Contributor has failed to comply with
Section 3.4, You are responsible for damages arising, directly or
indirectly, out of Your utilization of rights under this License, based
on the number of copies of Covered Code you made available, the
revenues you received from utilizing such rights, and other relevant
factors. You agree to work with affected parties to distribute
responsibility on an equitable basis.
AMENDMENTS
Additional Terms applicable to the Netscape Public License.
I. Effect.
These additional terms described in this Netscape Public License --
Amendments shall apply to the Mozilla Communicator client code and to
all Covered Code under this License.
II. ``Netscape's Branded Code'' means Covered Code that Netscape
distributes and/or permits others to distribute under one or more
trademark(s) which are controlled by Netscape but which are not
licensed for use under this License.
III. Netscape and logo.
This License does not grant any rights to use the trademark
``Netscape'', the ``Netscape N and horizon'' logo or the Netscape
lighthouse logo, even if such marks are included in the Original Code.
IV. Inability to Comply Due to Contractual Obligation.
Prior to licensing the Original Code under this License, Netscape has
licensed third party code for use in Netscape's Branded Code. To the
extent that Netscape is limited contractually from making such third
party code available under this License, Netscape may choose to
reintegrate such code into Covered Code without being required to
distribute such code in Source Code form, even if such code would
otherwise be considered ``Modifications'' under this License.
V. Use of Modifications and Covered Code by Initial Developer.
V.1. In General.
The obligations of Section 3 apply to Netscape, except to the
extent specified in this Amendment, Section V.2 and V.3.
V.2. Other Products.
Netscape may include Covered Code in products other than the
Netscape's Branded Code which are released by Netscape during the
two (2) years following the release date of the Original Code,
without such additional products becoming subject to the terms of
this License, and may license such additional products on
different terms from those contained in this License.
V.3. Alternative Licensing.
Netscape may license the Source Code of Netscape's Branded Code,
including Modifications incorporated therein, without such
additional products becoming subject to the terms of this License,
and may license such additional products on different terms from
those contained in this License.
VI. Arbitration and Litigation.
Notwithstanding the limitations of Section 11 above, the provisions
regarding arbitration and litigation in Section 11(a), (b) and (c) of
the License shall apply to all disputes relating to this License.
EXHIBIT A.
``The contents of this file are subject to the Netscape Public License
Version 1.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is Mozilla Communicator client code, released March
31, 1998.
The Initial Developer of the Original Code is Netscape Communications
Corporation. Portions created by Netscape are Copyright (C) 1998
Netscape Communications Corporation. All Rights Reserved.
Contributor(s): ______________________________________.''
[NOTE: The text of this Exhibit A may differ slightly from the text of
the notices in the Source Code files of the Original Code. This is due
to time constraints encountered in simultaneously finalizing the
License and in preparing the Original Code for release. You should use
the text of this Exhibit A rather than the text found in the Original
Code Source Code for Your Modifications.]

83
mozilla/Makefile Normal file
View File

@@ -0,0 +1,83 @@
#
# 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 = .
NSPRDIR = nsprpub
NSPR20 = 1
MOZILLA_CLIENT = 1
ifndef NO_MOCHA
DIRS_JS = js
endif
DIRS = config coreconf $(NSPRDIR) jpeg dbm xpcom
ifdef MOZ_NETCAST
DIRS += netcast
endif
ifdef MOZ_JAVA
DIRS += sun-java ldap ifc $(DIRS_JS) nav-java ifc/tools js/jsd
else
DIRS += sun-java nav-java $(DIRS_JS)
endif
ifndef NO_SECURITY
DIRS += security
endif
DIRS += modules lib l10n cmd
ifeq ($(STAND_ALONE_JAVA),1)
DIRS = config lib/xp $(NSPRDIR) jpeg modules/zlib sun-java ifc js ifc/tools sun-java/java
endif
include $(DEPTH)/config/rules.mk
export:: $(OBJS)
# Running this rule assembles all the SDK source pieces into dist/sdk.
# You'll need to run this rule on every platform to get all the
# binaries (e.g. javah) copied there. You'll also have to do special
# magic on a Mac.
sdk-src::
$(SDKINSTALL) include/npapi.h $(SDK)/include/
$(SDKINSTALL) include/jri_md.h $(SDK)/include/
$(SDKINSTALL) include/jritypes.h $(SDK)/include/
$(SDKINSTALL) include/jri.h $(SDK)/include/
$(SDKINSTALL) lib/plugin/npupp.h $(SDK)/include/
$(SDKINSTALL) sdk/common/*.c* $(SDK)/common/
$(SDKINSTALL) sun-java/classsrc/$(ZIP_NAME).x $(SDK)/classes/$(ZIP_NAME)
$(SDKINSTALL) sdk/examples/simple/Source/*.c $(SDK)/examples/simple/Source/
$(SDKINSTALL) sdk/examples/simple/Source/*.java $(SDK)/examples/simple/Source/
$(SDKINSTALL) sdk/examples/simple/Source/*.class $(SDK)/examples/simple/Source/
$(SDKINSTALL) sdk/examples/simple/Source/_gen/*.h $(SDK)/examples/simple/Source/_gen/
$(SDKINSTALL) sdk/examples/simple/Source/_stubs/*.c $(SDK)/examples/simple/Source/_stubs/
$(SDKINSTALL) sdk/examples/simple/Unix/makefile.* $(SDK)/examples/simple/Unix/
$(SDKINSTALL) sdk/examples/simple/Testing/SimpleExample.html $(SDK)/examples/simple/Testing/
$(SDKINSTALL) sdk/examples/simple/readme.html $(SDK)/examples/simple/
$(SDKINSTALL) sdk/examples/UnixTemplate/Source/*.c $(SDK)/examples/UnixTemplate/Source/
$(SDKINSTALL) sdk/examples/UnixTemplate/Testing/Test.html $(SDK)/examples/UnixTemplate/Testing/
$(SDKINSTALL) sdk/examples/UnixTemplate/Unix/makefile.* $(SDK)/examples/UnixTemplate/Unix/
$(SDKINSTALL) sdk/examples/UnixTemplate/readme.html $(SDK)/examples/UnixTemplate/
sdk-bin::
cd sdk; $(MAKE); cd ..
$(SDKINSTALL) $(DIST)/bin/javah$(BIN_SUFFIX) $(SDK)/bin/$(OS_CONFIG)/
$(SDKINSTALL) sdk/examples/simple/Source/$(OBJDIR)/npsimple.$(DLL_SUFFIX) $(SDK)/bin/$(OS_CONFIG)/
$(SDKINSTALL) sdk/examples/UnixTemplate/Source/$(OBJDIR)/nptemplate.$(DLL_SUFFIX) $(SDK)/bin/$(OS_CONFIG)/

246
mozilla/client.mak Normal file
View File

@@ -0,0 +1,246 @@
# 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.
#//------------------------------------------------------------------------
#// Figure out how to do the pull.
#//------------------------------------------------------------------------
!if "$(MOZ_BRANCH)" != ""
CVS_BRANCH=-r $(MOZ_BRANCH)
HAVE_BRANCH=1
!else
HAVE_BRANCH=0
!endif
#//
#// Temporary hardcode (while we figure out how to do this)
#// to support the Core modularity efforts...
#//
!ifndef MOZ_JAVAVER
!ifdef MOZ_MEDIUM
MOZ_JAVAVER =-r JAVA_STUB_RELEASE_19980319
!else
MOZ_JAVAVER =-r JAVA_RELEASE_19980304
!endif
!endif
NSPR20_BRANCH =-r NSPR20_RELEASE_19980304_BRANCH
SECURITY_BRANCH=-r SECURITY_RELEASE_19980210
CORECONF_BRANCH=-r CFG_1_6
DBM_BRANCH =-r DBM_RELEASE_19980319
!if "$(MOZ_DATE)" != ""
CVS_BRANCH=-D "$(MOZ_DATE)"
HAVE_DATE=1
!else
HAVE_DATE=0
!endif
!if $(HAVE_DATE) && $(HAVE_BRANCH)
ERR_MESSAGE=$(ERR_MESSAGE)^
Cannot specify both MOZ_BRANCH and MOZ_DATE
!endif
NMAKE=@nmake -nologo -$(MAKEFLAGS)
#//------------------------------------------------------------------------
#//
#// Stuff a do complete pull and build
#//
#//------------------------------------------------------------------------
default:: build_all
pull_and_build_all:: pull_all \
build_all
#// Do this when you pull a new tree, or else you will often get bugs
#// when replaceing an old dist with a new dist.
pull_clobber_build_all:: pull_all \
clobber_all \
build_all
clobber_build_all:: clobber_all \
build_all
# In theory, we should use some symbol in ns/config/liteness.mak,
# but we haven't pulled the file yet. So, refer to MOZ_LITE and
# MOZ_MEDIUM explicitly .
!if defined(MOZ_LITE) || defined(MOZ_MEDIUM)
pull_all:: pull_client_source_product
!else
pull_all:: pull_client
!endif
!ifndef NO_SECURITY
pull_security:
-cvs -q co $(CORECONF_BRANCH) ns/coreconf
-cvs -q co $(SECURITY_BRANCH) CoreSecurity
!else
pull_security:
!endif
pull_client: pull_security
@echo +++ client.mak: checking out the client with "$(CVS_BRANCH)"
cd $(MOZ_SRC)\.
-cvs -q co $(DBM_BRANCH) ns/dbm
-cvs -q co $(CVS_BRANCH) Client50Win
-cvs -q co $(MOZ_JAVAVER) JavaWin
-cvs -q co $(NSPR20_BRANCH) CoreNSPR20
pull_client_source_product:
@echo +++ client.mak: checking out the client with "$(CVS_BRANCH)"
cd $(MOZ_SRC)\.
-cvs -q co $(DBM_BRANCH) ns/dbm
-cvs -q co $(CVS_BRANCH) ClientSourceProductWin
-cvs -q co $(MOZ_JAVAVER) JavaStubWin
build_all: build_ldap \
build_dist \
build_client
build_dist:
@echo +++ client.mak: building dist
cd $(MOZ_SRC)\ns
$(NMAKE) -f makefile.win
!if defined(MOZ_LITE) || defined(MOZ_MEDIUM)
build_ldap:
!else
build_ldap:
@echo +++ client.mak: building ldap
cd $(MOZ_SRC)\ns\netsite\ldap\libraries\msdos\winsock
$(NMAKE) -f nsldap.mak DEPEND=1
$(NMAKE) -f nsldap.mak
$(NMAKE) -f nsldap.mak EXPORT=1
!endif
build_client:
@echo +++ client.mak: building client
cd $(MOZ_SRC)\ns\cmd\winfe\mkfiles32
!if "$(MOZ_BITS)" == "16"
$(NMAKE) -f mozilla.mak exports
!endif
$(NMAKE) -f mozilla.mak DEPEND=1
$(NMAKE) -f mozilla.mak
#
# remove all source files from the tree and print a report of what was missed
#
clobber_all:
cd $(MOZ_SRC)\ns
$(NMAKE) -f makefile.win clobber_all
cd $(MOZ_SRC)\ns\cmd\winfe\mkfiles32
$(NMAKE) -f mozilla.mak clobber_all
!if !defined(MOZ_MEDIUM)
cd $(MOZ_SRC)\ns\netsite\ldap\libraries\msdos\winsock
$(NMAKE) -f nsldap.mak clobber_all
!endif
depend:
-del /s /q make.dep
$(NMAKE) -f makefile.win depend
quick:
@cd $(MOZ_SRC)\.
@cvs -q co ns/quickup
@cd $(MOZ_SRC)\ns\quickup
@$(MOZ_TOOLS)\perl5\perl doupdate.pl
#//------------------------------------------------------------------------
#// Utility stuff...
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
# Verify that MOZ_SRC is set correctly
#//------------------------------------------------------------------------
# Check to see if it is set at all
!if "$(MOZ_SRC)"!=""
#
# create a temp file at the root and make sure it is visible from MOZ_SRC
#
!if [copy $(MAKEDIR)\client.mak $(MAKEDIR)\xyzzy.tmp > NUL] == 0
!endif
!if !EXIST( $(MOZ_SRC)\ns\xyzzy.tmp )
ERR_MESSAGE=$(ERR_MESSAGE)^
MOZ_SRC isn't set correctly: [$(MOZ_SRC)\ns]!=[$(MAKEDIR)]
!endif
!if [del $(MAKEDIR)\xyzzy.tmp]
!endif
!else
# MOZ_SRC isn't set at all
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_SRC isn't set.
!endif
#//------------------------------------------------------------------------
# Verify that MOZ_BITS is set
#//------------------------------------------------------------------------
!if !defined(MOZ_BITS)
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_BITS isn't set.
!endif
!if !defined(MOZ_TOOLS)
ERR_MESSAGE=$(ERR_MESSAGE)^
Environment variable MOZ_TOOLS isn't set.
!endif
#//------------------------------------------------------------------------
#// Display error
#//------------------------------------------------------------------------
!if "$(ERR_MESSAGE)" != ""
ERR_MESSAGE = ^
client.mak: ^
$(ERR_MESSAGE) ^
^
client.mak: usage^
^
nmake -f client.mak [MOZ_BRANCH=<cvs_branch_name>] ^
[MOZ_DATE=<cvs_date>]^
[pull_and_build_all]^
[pull_all]^
[pull_dist]^
[pull_client]^
[build_all]^
[build_dist]^
[build_ldap]^
[build_client]^
^
Environment variables:^
^
MOZ_BITS set to either 32 or 16 ^
MOZ_SRC set to the directory above ns or "$(MAKEDIR)\.."^
MOZ_TOOLS set to the directory containing the java compiler see ^
http://warp/tools/nt^
JAVA_HOME set to the same thing as MOZ_TOOLS^
!ERROR $(ERR_MESSAGE)
!endif

130
mozilla/config/AIX.mk Normal file
View File

@@ -0,0 +1,130 @@
#
# 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 IBM AIX for RS/6000 and PPC
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := aix
CPU_ARCH := rs6000 # How can I determine this?
GFX_ARCH := x
OS_INCLUDES =
G++INCLUDES =
LOC_LIB_DIR = /usr/lib/X11
MOTIF =
MOTIFLIB = -lXm
OS_LIBS = -lm -lbsd
PLATFORM_FLAGS = -qarch=com -qmaxmem=65536 -DAIX -Daix
MOVEMAIL_FLAGS =
PORT_FLAGS = -DSYSV -DNEED_CDEFS_H -DNEED_SELECT_H -DNEED_IOCTL_H -DSYS_MACHINE_H -DUSE_NODL_TABS -DHAVE_SIGNED_CHAR -DHAVE_SYS_SELECT_H -DNEED_SYS_WAIT_H -DHAVE_INT32_T -DNEED_H_ERRNO
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/aix.lm
EN_LOCALE = en_US.ISO8859-1
DE_LOCALE = de_DE.ISO8859-1
FR_LOCALE = fr_FR.ISO8859-1
JP_LOCALE = ja_JP.IBM-eucJP
SJIS_LOCALE = Ja_JP.IBM-932
KR_LOCALE = ko_KR.IBM-eucKR
CN_LOCALE = zh_CN
TW_LOCALE = zh_TW.IBM-eucTW
I2_LOCALE = iso88592
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(OS_RELEASE),3.2)
PLATFORM_FLAGS += -qtune=601 -DAIXV3 -DAIX3_2_5
PORT_FLAGS += -DSW_THREADS
else
PLATFORM_FLAGS += -qtune=604 -qnosom -DAIXV4
endif
ifeq ($(OS_RELEASE),4.1)
PLATFORM_FLAGS += -DAIX4_1
PORT_FLAGS += -DSW_THREADS
OS_LIBS += -lsvld
DSO_LDOPTS = -bM:SRE -bh:4 -bnoentry
AIX_NSPR = $(DIST)/bin/libnspr_shr.a
LIBNSPR = $(AIX_NSPR)
AIX_NSPR_LINK = -L$(DIST)/bin -lnspr_shr -blibpath:/usr/local/lib/netscape:/usr/lib:/lib:.
#
# Used to link java, javah. Include 3 relative paths since we're guessing
# at runtime where the hell the library is. LIBPATH can be set, but
# setting this will be hell for release people, _AND_ I couldn't get it to
# work. Sigh. -mcafee
#
AIX_NSPR_DIST_LINK = -L$(DIST)/bin -lnspr_shr -blibpath:.:../dist/$(OBJDIR)/bin:../../dist/$(OBJDIR)/bin:../../../dist/$(OBJDIR)/bin:/usr/lib:/lib
endif
ifneq (,$(filter 4.2 4.3,$(OS_RELEASE)))
PORT_FLAGS += -DHW_THREADS -DUSE_PTHREADS -DPOSIX7
OS_LIBS += -ldl
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -brtl -bM:SRE -bnoentry -bexpall
ifeq ($(OS_RELEASE),4.2)
PLATFORM_FLAGS += -DAIX4_2
endif
ifeq ($(OS_RELEASE),4.3)
PLATFORM_FLAGS += -DAIX4_3
endif
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
CC = cc
CCC = xlC -+
BSDECHO = $(DIST)/bin/bsdecho
RANLIB = /usr/ccs/bin/ranlib
WHOAMI = /bin/whoami
ifneq ($(OS_RELEASE),3.2)
UNZIP_PROG = $(CONTRIB_BIN)unzip
ZIP_PROG = $(CONTRIB_BIN)zip
endif
######################################################################
# Other
######################################################################
ifdef SERVER_BUILD
CC = xlC_r
# In order to automatically generate export lists, we need to use -g with -O
OPTIMIZER = -g -O
PORT_FLAGS += -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -DFD_SETSIZE=4096
endif
#ifeq ($(PTHREADS_USER),1)
#USE_PTHREADS =
#else
#USE_PTHREADS = 1
#endif
MUST_BOOTLEG_ALLOCA = 1
BUILD_UNIX_PLUGINS = 1
DSO_LDFLAGS = -lXm -lXt -lX11
EXTRA_DSO_LDOPTS = -lc

84
mozilla/config/BSD_OS.mk Normal file
View File

@@ -0,0 +1,84 @@
#
# 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 BSDI BSD/386 and BSD/OS for x86
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := bsdi
CPU_ARCH := x86
GFX_ARCH := x
OS_INCLUDES = -I/usr/X11/include
G++INCLUDES = -I/usr/include/g++
LOC_LIB_DIR = /usr/X11/lib
MOTIF = $(NS_LIB)/Xm
MOTIFLIB = -lXm
OS_LIBS = -lcompat
PLATFORM_FLAGS = -Wall -Wno-format -DBSDI -D__386BSD__ -DBSD -Di386
MOVEMAIL_FLAGS = -DHAVE_STRERROR
PORT_FLAGS = -DSW_THREADS -DNEED_BSDREGEX -DNTOHL_ENDIAN_H -DUSE_NODL_TABS -DNEED_SYS_WAIT_H -DNO_TZNAME -DHAVE_NETINET_IN_H -DNO_INT64_T -DNEED_UINT_T -DHAVE_SYS_SELECT_H
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/bsd386.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
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(OS_RELEASE),1.1)
PLATFORM_FLAGS += -DBSDI_1
PORT_FLAGS += -DNEED_UINT -DNEED_IOCTL_H -DNEED_REALPATH
endif
ifeq ($(OS_RELEASE),2.1)
PLATFORM_FLAGS += -DBSDI_2
PORT_FLAGS += -DHAVE_FILIO_H
UNZIP_PROG = $(CONTRIB_BIN)unzip
endif
ifeq ($(OS_RELEASE),3.0)
PLATFORM_FLAGS += -DBSDI_2 -DBSDI_3
PORT_FLAGS += -DHAVE_FILIO_H
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
EMACS = /usr/bin/true
PERL = /usr/bin/perl
RANLIB = /usr/bin/ranlib
######################################################################
# Other
######################################################################

89
mozilla/config/FreeBSD.mk Normal file
View File

@@ -0,0 +1,89 @@
#
# 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 FreeBSD
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := freebsd
CPU_ARCH := x86
GFX_ARCH := x
OS_INCLUDES = -I/usr/X11R6/include
G++INCLUDES = -I/usr/include/g++
LOC_LIB_DIR =
MOTIF =
MOTIFLIB =
OS_LIBS =
# Don't define BSD, because it's already defined in /usr/include/sys/param.h.
PLATFORM_FLAGS = -DFREEBSD -DBSDI -DBSDI_2 -D__386BSD__ -Di386 $(DSO_CFLAGS)
MOVEMAIL_FLAGS = -DHAVE_STRERROR
PORT_FLAGS = -DSW_THREADS -DNEED_UINT -DHAVE_LCHOWN -DNTOHL_ENDIAN_H -DHAVE_FILIO_H -DNEED_SYS_TIME_H -DNEED_UINT_T -DHAVE_BSD_FLOCK
PDJAVA_FLAGS = -mx128m
OS_GPROF_FLAGS = -pg
LD_FLAGS = -L/usr/X11R6/lib -lXm
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/bsd386.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
######################################################################
# Version-specific stuff
######################################################################
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
DLL_SUFFIX = so.1.0
EMACS = /usr/bin/true
JAVA_PROG = $(JAVA_BIN)java
RANLIB = /usr/bin/ranlib
######################################################################
# Other
######################################################################
ifeq ($(USE_PTHREADS),1)
OS_LIBS = -lc_r
PORT_FLAGS += -D_PR_NEED_FAKE_POLL
else
OS_LIBS = -lc
PORT_FLAGS += -D_PR_LOCAL_THREADS_ONLY
endif
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_CFLAGS = -fpic
DSO_LDFLAGS =
DSO_LDOPTS = -Bshareable

119
mozilla/config/HP-UX.mk Normal file
View File

@@ -0,0 +1,119 @@
#
# 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
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := hpux
CPU_ARCH := hppa
GFX_ARCH := x
OS_INCLUDES =
G++INCLUDES =
LOC_LIB_DIR = /usr/lib/X11
MOTIF =
MOTIFLIB =
OS_LIBS = -ldld
PLATFORM_FLAGS = $(DSO_CFLAGS) -DHPUX -Dhpux -D$(CPU_ARCH) $(ADDITIONAL_CFLAGS)
MOVEMAIL_FLAGS = -DHAVE_STRERROR
PORT_FLAGS = -D_HPUX_SOURCE -DSW_THREADS -DNO_SIGNED -DNO_FNDELAY -DHAVE_ODD_SELECT -DNO_CDEFS_H -DNO_LONG_LONG -DNEED_IOCTL_H -DNEED_MATH_H -DUSE_NODL_TABS -DMITSHM -DNEED_SYS_WAIT_H -DHAVE_INT32_T -DNEED_UINT_T -DNEED_H_ERRNO
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/hpux.lm
EN_LOCALE = american.iso88591
DE_LOCALE = german.iso88591
FR_LOCALE = french.iso88591
JP_LOCALE = japanese.euc
SJIS_LOCALE = japanese
KR_LOCALE = korean
CN_LOCALE = chinese-s
TW_LOCALE = chinese-t.big5
I2_LOCALE = i2
IT_LOCALE = it
SV_LOCALE = sv
ES_LOCALE = es
NL_LOCALE = nl
PT_LOCALE = pt
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(OS_RELEASE),A.09)
PLATFORM_FLAGS += -DHPUX9 -Dhpux9
OS_LIBS += -L/lib/pa1.1 -lm
NO_INLINE = +d
else
OS_LIBS += -lm
endif
ifeq ($(OS_RELEASE),B.10)
PLATFORM_FLAGS += -DHPUX10 -Dhpux10
PORT_FLAGS += -DRW_NO_OVERLOAD_SCHAR -DHAVE_MODEL_H
JAVA_PROG = $(CONTRIB_BIN)java
ifeq ($(OS_VERSION),.10)
PLATFORM_FLAGS += -DHPUX10_10
endif
ifeq ($(OS_VERSION),.20)
PLATFORM_FLAGS += -DHPUX10_20
endif
ifeq ($(OS_VERSION),.30)
PLATFORM_FLAGS += -DHPUX10_30
endif
endif
ifeq ($(OS_RELEASE),B.11)
PLATFORM_FLAGS += -DHPUX10 -DHPUX11
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
BSDECHO = $(DIST)/bin/bsdecho
CC = cc -Ae
CCC = CC -Aa +a1 $(NO_INLINE)
DLL_SUFFIX = sl
PERL = $(LOCAL_BIN)perl
######################################################################
# Other
######################################################################
ifdef SERVER_BUILD
PLATFORM_FLAGS += +DA1.0 -Wl,-E
endif
ELIBS_CFLAGS = -g -DHAVE_STRERROR
HAVE_PURIFY = 1
MUST_BOOTLEG_ALLOCA = 1
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -b
DSO_LDFLAGS =
DSO_CFLAGS = +Z

183
mozilla/config/IRIX.mk Normal file
View File

@@ -0,0 +1,183 @@
#
# 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
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := irix
CPU_ARCH := mips
GFX_ARCH := x
OS_INCLUDES =
G++INCLUDES =
LOC_LIB_DIR = /usr/lib/X11
MOTIF =
MOTIFLIB =
OS_LIBS =
PLATFORM_FLAGS = -DIRIX
MOVEMAIL_FLAGS =
PORT_FLAGS = -DSVR4 -DHAVE_LCHOWN -DHAVE_SIGNED_CHAR -DHAVE_FILIO_H -DHAS_PGNO_T -DMITSHM -DHAVE_WAITID -DNEED_VBASE -DNEED_SYS_TIME_H -DHAVE_SYSTEMINFO_H -DNO_JNI_STUBS -D_MIPS_SIM_ABI32
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/irix.lm
EN_LOCALE = en_US
DE_LOCALE = de
FR_LOCALE = fr
JP_LOCALE = ja_JP.EUC
SJIS_LOCALE = ja_JP.SJIS
KR_LOCALE = ko_KR.euc
CN_LOCALE = zh_CN.ugb
TW_LOCALE = zh_TW.ucns
I2_LOCALE = i2
IT_LOCALE = it
SV_LOCALE = sv
ES_LOCALE = es
NL_LOCALE = nl
PT_LOCALE = pt
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(OS_RELEASE),6)
#
# The "-woff 131" silences the really noisy 6.x ld's warnings about
# having multiply defined weak symbols.
#
# The "-woff 3247" silences complaints about the "#pragma segment"
# stuff strewn all over libneo (apparently for Macintoshes).
#
NO_NOISE = -woff 131
PLATFORM_FLAGS += -multigot -Wl,-nltgot,170
PORT_FLAGS += -DNO_UINT32_T -DNO_INT64_T -DNEED_BSD_TYPES
SHLIB_LD_OPTS = -no_unresolved
ifeq ($(AWT_11),1)
JAVAC_ZIP = $(NS_LIB)/rt.jar:$(NS_LIB)/dev.jar:$(NS_LIB)/i18n.jar:$(NS_LIB)/tiny.jar
endif
endif
ifndef NS_USE_GCC
CC = cc
CCC = CC -woff 3247
endif
ifeq ($(OS_VERSION),.3)
PERL = $(LOCAL_BIN)perl5
ifndef NS_USE_GCC
XGOT_FLAG = -xgot
#
# Use gtscc to unbloat the C++ global count.
#
ifdef USE_GTSCC
ifndef NO_GTSCC
XGOT_FLAG =
CCC = $(DIST)/bin/gtscc $(GTSCC_CC_OPTIONS) -gtsfile $(DEPTH)/config/$(OBJDIR)/db.gts -gtsrootdir $(DEPTH)
ifeq ($(findstring modules/,$(SRCDIR)),modules/)
CC = $(DIST)/bin/gtscc $(GTSCC_CC_OPTIONS) -gtsfile $(DEPTH)/config/$(OBJDIR)/db.gts -gtsrootdir $(DEPTH)
endif
ifeq ($(findstring sun-java/,$(SRCDIR)),sun-java/)
CC = $(DIST)/bin/gtscc $(GTSCC_CC_OPTIONS) -gtsfile $(DEPTH)/config/$(OBJDIR)/db.gts -gtsrootdir $(DEPTH)
endif
endif
endif
endif
PLATFORM_FLAGS += $(XGOT_FLAG) -DIRIX5_3
endif
ifeq ($(OS_VERSION),.2)
PLATFORM_FLAGS += -DIRIX6_2
endif
ifeq ($(OS_VERSION),.3)
PLATFORM_FLAGS += -DIRIX6_3
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
WHOAMI = /bin/whoami
UNZIP_PROG = $(NS_BIN)unzip
ZIP_PROG = $(NS_BIN)zip
######################################################################
# Other
######################################################################
ifdef NS_USE_GCC
PLATFORM_FLAGS += -Wall -Wno-format
ASFLAGS += -x assembler-with-cpp
ifdef BUILD_OPT
OPTIMIZER = -O6
endif
else
PLATFORM_FLAGS += -32 -fullwarn -xansi -DIRIX_STARTUP_SPEEDUPS
ifdef BUILD_OPT
OPTIMIZER = -O -Olimit 4000
endif
endif
ifndef NO_MDUPDATE
MDUPDATE_FLAGS = -MDupdate $(DEPENDENCIES)
endif
ifeq ($(USE_KERNEL_THREADS),1)
PORT_FLAGS += -DHW_THREADS -D_SGI_MP_SOURCE
else
PORT_FLAGS += -DSW_THREADS
endif
#
# The "o32" calling convention is the default for 5.3 and 6.2.
# According to the SGI dudes, they will migrate to "n32" for 6.5.
# What will we do then?
# If we want to do the same, simply uncomment the line below ..
#
#PORT_FLAGS += -D_MIPS_SIM_NABI32
#
# To get around SGI's problems with the Asian input method.
#
MAIL_IM_HACK = *Mail*preeditType:none
NEWS_IM_HACK = *News*preeditType:none
#
# An nm command which generates an output like:
# archive.a:object.o: 0000003 T symbol
#
NM_PO = nm -Bpo
HAVE_PURIFY = 1
MUST_BOOTLEG_ALLOCA = 1
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(NO_NOISE) $(SHLIB_LD_OPTS) -shared -soname $(@:$(OBJDIR)/%.so=%.so)
DSO_LDOPTS = -elf -shared -all
DSO_LDFLAGS = -nostdlib -L/lib -L/usr/lib -L/usr/lib -lXm -lXt -lX11 -lgen
ifdef DSO_BACKEND
DSO_LDOPTS += -soname $(DSO_NAME)
endif

132
mozilla/config/Linux.mk Normal file
View File

@@ -0,0 +1,132 @@
#
# 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 (all architectures)
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := linux
ifeq (86,$(findstring 86,$(OS_TEST)))
CPU_ARCH := x86
else
CPU_ARCH := $(OS_TEST)
endif
GFX_ARCH := x
OS_INCLUDES =
G++INCLUDES = -I/usr/include/g++
LOC_LIB_DIR = /usr/lib/X11
MOTIF =
MOTIFLIB =
OS_LIBS =
PLATFORM_FLAGS = -ansi -Wall -pipe -DLINUX -Dlinux
MOVEMAIL_FLAGS = -DHAVE_STRERROR
PORT_FLAGS = -D_POSIX_SOURCE -D_BSD_SOURCE -DSW_THREADS -DNEED_ENDIAN_H -DNEED_GETOPT_H -DNEED_IOCTL_H -DUSE_NODL_TABS -DHAVE_SIGNED_CHAR -DNEED_SYS_TIME_H -DHAVE_SYS_BITYPES_H -DNEED_UINT_T
PDJAVA_FLAGS = -mx128m
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/linux.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
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(CPU_ARCH),alpha)
PLATFORM_FLAGS += -DLINUX1_2 -D__$(CPU_ARCH) -D_ALPHA_
OS_INCLUDES += -I/usr/X11R6/include
PORT_FLAGS += -DNEED_TIME_R -DMITSHM -D_XOPEN_SOURCE
OS_LIBS += -L/lib -ldl -lc
endif
ifeq ($(CPU_ARCH),ppc)
PLATFORM_FLAGS += -DMKLINUX -DLINUX1_2 -D$(CPU_ARCH)
OS_INCLUDES += -I/usr/local/include -I/usr/X11R6/include
endif
ifeq ($(CPU_ARCH),sparc)
PLATFORM_FLAGS += -DLINUX1_2 -D$(CPU_ARCH)
OS_INCLUDES += -I/usr/X11R6/include
endif
ifeq ($(CPU_ARCH),x86)
PLATFORM_FLAGS += -mno-486 -DLINUX1_2 -Di386
PORT_FLAGS += -DNEED_TIME_R -DMITSHM -D_XOPEN_SOURCE
OS_INCLUDES += -I/usr/X11R6/include
OS_LIBS += -L/lib -ldl -lc
endif
# These are CPU_ARCH independent
ifeq ($(OS_RELEASE),1.2)
PORT_FLAGS += -DNEED_SYS_WAIT_H
endif
ifeq ($(OS_RELEASE),2.0)
PORT_FLAGS += -DNO_INT64_T
PLATFORM_FLAGS += -DLINUX2_0
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
ifdef BUILD_OPT
OPTIMIZER = -O2
endif
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
EMACS = /bin/true
JAVA_PROG = $(JAVA_BIN)java
PERL = /usr/bin/perl
PROCESSOR_ARCHITECTURE = _$(CPU_ARCH)
RANLIB = /usr/bin/ranlib
ifneq ($(CPU_ARCH),ppc)
UNZIP_PROG = /usr/bin/unzip
ZIP_PROG = /usr/bin/zip
endif
######################################################################
# Other
######################################################################
ifeq ($(USE_PTHREADS),1)
PORT_FLAGS += -D_REENTRANT -D_PR_NEED_FAKE_POLL
else
PORT_FLAGS += -D_PR_LOCAL_THREADS_ONLY
endif
NEED_XMOS = 1
DSO_CFLAGS = -fpic
DSO_LDOPTS = -shared
DSO_LDFLAGS =
ifeq ($(USE_JDK11),1)
JAVA_HOME = /usr/local/java
JAVAC_ZIP = $(JAVA_HOME)/lib/classes.zip
endif

109
mozilla/config/Makefile Normal file
View File

@@ -0,0 +1,109 @@
# -*- Mode: Makefile -*-
#
# 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 = ..
HSRCS = pathsub.h
CSRCS = nsinstall.c pathsub.c
ifeq ($(subst /,_,$(shell uname -s)),OS2)
LOCAL_INCLUDES += -Ios2
endif
PLSRCS = nfspwd.pl revdepth.pl
TARGETS = $(PROGRAM) $(PLSRCS:.pl=)
ifneq ($(subst /,_,$(shell uname -s)),WINNT)
PROGRAM = nsinstall$(BIN_SUFFIX)
TARGETS += $(OBJDIR)/bsdecho$(BIN_SUFFIX)
endif
# IMPORTANT: Disable NSBUILDROOT for this directory only, otherwise we have
# a recursive rule for finding nsinstall and the perl scripts
ifdef NSBUILDROOT
override NSBUILDROOT :=
endif
include $(DEPTH)/config/rules.mk
ifeq ($(OS_ARCH)$(OS_RELEASE),SunOS4.1)
INCLUDES += -I../nsprpub/pr/include/md
endif
ifeq ($(OS_ARCH)$(OS_RELEASE),IRIX5)
TARGETS += $(OBJDIR)/gtscc$(BIN_SUFFIX)
endif
# On linux we need to generake a motif.mk file which has special defines
# for different motif versions.
ifeq ($(OS_ARCH),Linux)
#GARBAGE += motif.mk
export:: motif.mk
motif.mk:
@rm -f $@
ifeq ($(shell $(DEPTH)/config/xmversion.sh),2)
@echo "NS_MOTIF2_XP_LD_FLAGS = -lXp" > $@
else
@echo "NS_MOTIF2_XP_LD_FLAGS =" > $@
endif
endif
# Redefine MAKE_OBJDIR for just this directory
define MAKE_OBJDIR
if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); fi
endef
export:: $(TARGETS)
ifdef XP_OS2_VACPP
# could not get bsdecho rules to work implicitly, so here is explicit ones
$(OBJDIR)/bsdecho.o: bsdecho.c
@$(MAKE_OBJDIR)
$(CC) -Fo$@ $(CFLAGS) -c $<
$(OBJDIR)/bsdecho$(BIN_SUFFIX): $(OBJDIR)/bsdecho.o
@$(MAKE_OBJDIR)
$(LINK_EXE) -OUT:$@ $< $(LDFLAGS)
$(INSTALL) -m 444 $@ $(DIST)/bin
else
$(OBJDIR)/bsdecho$(BIN_SUFFIX): $(OBJDIR)/bsdecho.o
@$(MAKE_OBJDIR)
$(CCF) $(LDFLAGS) -o $@ $<
$(INSTALL) -m 444 $@ $(DIST)/bin
endif
$(OBJDIR)/gtscc$(BIN_SUFFIX): $(OBJDIR)/gtscc.o
@$(MAKE_OBJDIR)
$(CCF) $(LDFLAGS) -o $@ $< -lelf
$(INSTALL) -m 444 $@ $(DIST)/bin
ifdef MKDEPEND_DIR
clean clobber realclean clobber_all::
cd $(MKDEPEND_DIR); $(MAKE) $@
endif
# For the continuous build scripts.
show_objname:
@echo $(OBJDIR)
.PHONY: show_objname

86
mozilla/config/NCR.mk Normal file
View File

@@ -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.
#
######################################################################
# Config stuff for NCR SVR4 MP-RAS
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := ncr
CPU_ARCH := x86
GFX_ARCH := x
OS_INCLUDES = -I/usr/X/include
G++INCLUDES =
LOC_LIB_DIR = /usr/X/lib
MOTIF =
MOTIFLIB = -lXm
OS_LIBS =
PLATFORM_FLAGS = -DNCR -D_ATT4 -Di386
MOVEMAIL_FLAGS = -DUSG -DHAVE_STRERROR
PORT_FLAGS = -DSVR4 -DSYSV -DSW_THREADS -DHAVE_FILIO_H -DHAVE_LCHOWN -DNEED_S_ISLNK -DNEED_S_ISSOCK -DSYS_ENDIAN_H -DSYS_BYTEORDER_H -DUSE_NODL_TABS -DMITSHM -DHAVE_WAITID -DHAVE_NETINET_IN_H -DHAVE_REMAINDER -DHAVE_SYS_BITYPES_H -DPRFSTREAMS_BROKEN
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP =
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
######################################################################
# Version-specific stuff
######################################################################
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
EMACS = /bin/true
PERL = $(LOCAL_BIN)perl
WHOAMI = /usr/ucb/whoami
######################################################################
# Other
######################################################################
ifdef NS_USE_NATIVE
CC = cc
CCC = ncc
PLATFORM_FLAGS += -Hnocopyr
OS_LIBS += -L/opt/ncc/lib
else
PLATFORM_FLAGS += -Wall
OS_LIBS += -lsocket -lnsl -lresolv -ldl
endif
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G
DSO_LDFLAGS = -lXm -lXt -lX11 -lsocket -lnsl -lgen

81
mozilla/config/NEC.mk Normal file
View File

@@ -0,0 +1,81 @@
#
# 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 EWS-UX/V
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := nec
CPU_ARCH := mips
GFX_ARCH := x
OS_INCLUDES =
G++INCLUDES =
LOC_LIB_DIR = /usr/lib/X11
MOTIF =
MOTIFLIB = -L/usr/lib -lXm
OS_LIBS = -lsocket -lnsl -ldl -L/usr/ucblib -lc -lucb
PLATFORM_FLAGS = -DNEC -Dnec_ews -DNECSVR4 -D__SVR4
MOVEMAIL_FLAGS = -DUSG -DHAVE_STRERROR
PORT_FLAGS = -DSVR4 -DSW_THREADS -DHAVE_FILIO_H -DHAVE_LCHOWN -DNEED_S_ISLNK -DNEED_CDEFS_H -DNO_LONG_LONG -DSYS_BYTEORDER_H -DMITSHM -DHAVE_NETINET_IN_H -DHAVE_ARPA_NAMESER_H
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/nec.lm
EN_LOCALE = C
DE_LOCALE = de_DE.ISO8859-1
FR_LOCALE = fr_FR.ISO8859-1
JP_LOCALE = ja_JP.EUC
SJIS_LOCALE = ja_JP.SJIS
KR_LOCALE = ko_KR.EUC
CN_LOCALE = zh_CN.ugb
TW_LOCALE = zh_TW.ucns
I2_LOCALE = i2
######################################################################
# Version-specific stuff
######################################################################
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
ifndef NS_USE_GCC
CC = $(DEPTH)/build/hcc -Xa -KGnum=0 -KOlimit=4000
endif
BSDECHO = /usr/ucb/echo
EMACS = /bin/true
PERL = $(LOCAL_BIN)perl
WHOAMI = /usr/ucb/whoami
######################################################################
# Other
######################################################################
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G
DSO_LDFLAGS =

78
mozilla/config/NEWS-OS.mk Normal file
View File

@@ -0,0 +1,78 @@
#
# 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 Sony NEWS-OS
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := sony
CPU_ARCH := mips
GFX_ARCH := x
OS_INCLUDES = -I/usr/include
G++INCLUDES =
LOC_LIB_DIR = /usr/lib/X11
MOTIF =
MOTIFLIB = -L/usr/lib -lXm
OS_LIBS = -lsocket -lnsl -lgen -lresolv
PLATFORM_FLAGS = -Xa -fullwarn -DSONY
MOVEMAIL_FLAGS = -DHAVE_STRERROR
PORT_FLAGS = -DSYSV -DSVR4 -D__svr4 -D__svr4__ -DSW_THREADS -DHAVE_INT32_T -DHAVE_STDDEF_H -DHAVE_STDLIB_H -DHAVE_FILIO_H -DSYS_BYTEORDER_H -DNO_CDEFS_H -DHAVE_LCHOWN -DHAS_PGNO_T -DNO_MULTICAST
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP =
EN_LOCALE = C
DE_LOCALE = de_DE.ISO8859-1
FR_LOCALE = fr_FR.ISO8859-1
JP_LOCALE = ja.JP.EUC
SJIS_LOCALE = ja_JP.SJIS
KR_LOCALE = ko_KR.EUC
CN_LOCALE = zh_CN.ugb
TW_LOCALE = zh_TW.ucns
I2_LOCALE = i2
######################################################################
# Version-specific stuff
######################################################################
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
BSDECHO = /usr/ucb/echo
CC = cc
CCC = CC
EMACS = /bin/true
PERL = /bin/true
######################################################################
# Other
######################################################################
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G
DSO_LDFLAGS =

View File

@@ -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 NEXTSTEP
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := nextstep
CPU_ARCH := m68k
GFX_ARCH := x
OS_INCLUDES =
G++INCLUDES =
LOC_LIB_DIR =
MOTIF =
MOTIFLIB =
OS_LIBS =
PLATFORM_FLAGS = -Wall -Wno-format -DNEXTSTEP -D_NEXT_SOURCE
MOVEMAIL_FLAGS = -DHAVE_STRERROR
PORT_FLAGS = -DSW_THREADS -DNO_CDEFS_H -DNO_REGEX -DNEED_BSDREGEX -DNO_REGCOMP -DHAS_PGNO_T -DNO_MULTICAST -DNO_TZNAME
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(OS_RELEASE),3.3)
PLATFORM_FLAGS += -DNEXTSTEP3 -DNEXTSTEP33
else
ifeq ($(OS_RELEASE),4.2)
PLATFORM_FLAGS += -DNEXTSTEP4 -DNEXTSTEP42
endif
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
CC = cc
CCC = c++
EMACS = /bin/true
PERL = /usr/bin/perl
RANLIB = /bin/libtool
WHOAMI = /usr/ucb/whoami
######################################################################
# Other
######################################################################

114
mozilla/config/OSF1.mk Normal file
View File

@@ -0,0 +1,114 @@
#
# 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 (Digital UNIX)
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := dec
CPU_ARCH := alpha
GFX_ARCH := x
OS_INCLUDES =
G++INCLUDES =
LOC_LIB_DIR = /usr/lib/X11
MOTIF =
MOTIFLIB =
OS_LIBS =
PLATFORM_FLAGS = -taso -D_ALPHA_ -DIS_64 -DOSF1
MOVEMAIL_FLAGS =
PORT_FLAGS = -D_REENTRANT -DHAVE_LCHOWN -DNEED_CDEFS_H -DNTOHL_ENDIAN_H -DNEED_IOCTL_H -DMACHINE_ENDIAN_H -DHAVE_VA_LIST_STRUCT -DNEED_BYTE_ALIGNMENT -DMITSHM -DNEED_REALPATH -DHAVE_WAITID -DNEED_H_ERRNO -DNEED_SYS_TIME_H -DHAVE_SYSTEMINFO_H -DNEED_SYS_PARAM_H -DHAVE_INT32_T -DODD_VA_START -DHAVE_REMAINDER
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/osf1.lm
EN_LOCALE = en_US.ISO8859-1
DE_LOCALE = de_DE.ISO8859-1
FR_LOCALE = fr_FR.ISO8859-1
JP_LOCALE = ja_JP.eucJP
SJIS_LOCALE = ja_JP.SJIS
KR_LOCALE = ko_KR.eucKR
CN_LOCALE = zh_CN
TW_LOCALE = zh_TW.eucTW
I2_LOCALE = i2
IT_LOCALE = it
SV_LOCALE = sv
ES_LOCALE = es
NL_LOCALE = nl
PT_LOCALE = pt
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(OS_RELEASE),V2)
PORT_FLAGS += -DNEED_TIME_R
else
OS_LIBS += -lrt -lc_r
endif
ifeq ($(OS_RELEASE),V3)
PLATFORM_FLAGS += -DOSF1V3
endif
ifeq ($(OS_RELEASE),V4)
PLATFORM_FLAGS += -DOSF1V4
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
AR = ar rcl $@
CC = cc -ieee_with_inexact -std
CCC = cxx -ieee_with_inexact -x cxx -cfront
SHELL = /usr/bin/ksh
WHOAMI = /bin/whoami
UNZIP_PROG = $(NS_BIN)unzip
ZIP_PROG = $(NS_BIN)zip
######################################################################
# Other
######################################################################
ifdef BUILD_OPT
OPTIMIZER += -Olimit 4000
endif
ifeq ($(USE_KERNEL_THREADS),1)
ifdef NSPR20
PLATFORM_FLAGS += -pthread
OS_LIBS += -lpthread
else
PLATFORM_FLAGS += -threads
PORT_FLAGS += -DHW_THREADS
endif
else
PORT_FLAGS += -DSW_THREADS
endif
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -shared -all -expect_unresolved "*"
DSO_LDFLAGS = -lXm -lXt -lX11 -lc

View File

@@ -0,0 +1,61 @@
#
# 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 Rhapsody
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := rhapsody
CPU_ARCH := ppc
GFX_ARCH := x
OS_INCLUDES =
G++INCLUDES =
LOC_LIB_DIR =
MOTIF =
MOTIFLIB =
OS_LIBS =
PLATFORM_FLAGS = -DRHAPSODY -Wall -pipe
MOVEMAIL_FLAGS = -DHAVE_STRERROR
PORT_FLAGS = -DSW_THREADS -DHAVE_STDDEF_H -DHAVE_STDLIB_H -DHAVE_FILIO_H -DNTOHL_ENDIAN_H -DMACHINE_ENDIAN_H -DNO_REGEX -DNO_REGCOMP -DHAS_PGNO_T -DNO_TZNAME -DNO_X11
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
######################################################################
# Version-specific stuff
######################################################################
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
CC = /bin/cc
CCC = /bin/cc++
EMACS = /usr/bin/true
PERL = /usr/bin/true
RANLIB = /bin/libtool
######################################################################
# Other
######################################################################

88
mozilla/config/SCOOS.mk Normal file
View File

@@ -0,0 +1,88 @@
#
# 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
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := sco_os
CPU_ARCH := x86
GFX_ARCH := x
OS_INCLUDES = -I/usr/include/X11
G++INCLUDES =
LOC_LIB_DIR = /usr/lib/X11
MOTIF =
MOTIFLIB = -lXm
OS_LIBS = -lpmapi -lsocket
PLATFORM_FLAGS = -DSCO -Dsco -DSCO_SV -Di386
MOVEMAIL_FLAGS = -DUSG -DHAVE_STRERROR
PORT_FLAGS = -DSYSV -DSW_THREADS -DNO_SIGNED -DNEED_SOCKET_H -DNEED_S_ISLNK -DNO_LONG_LONG -DNEED_S_ISSOCK -DNEED_MATH_H -DSYS_BYTEORDER_H -DHAVE_BITYPES_H -DUSE_NODL_TABS -DMOTIF_WARNINGS_UPSET_JAVA -DMITSHM -DNO_ID_T -DHAVE_WAITID -DHAVE_SYS_NETINET_IN_H -DHAVE_REMAINDER -DNEED_SYS_SELECT_H -DHAVE_SYS_BITYPES_H -DNEED_H_ERRNO
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/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
######################################################################
# Version-specific stuff
######################################################################
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
BSDECHO = /bin/echo
CC = cc -b elf -K pic
CCC = $(DEPTH)/build/hcpp +.cpp +d
EMACS = /bin/true
WHOAMI = $(LOCAL_BIN)whoami
UNZIP_PROG = $(CONTRIB_BIN)unzip
ZIP_PROG = $(CONTRIB_BIN)zip
######################################################################
# Other
######################################################################
#
# -DSCO_PM - Policy Manager AKA: SCO Licensing
# Only (supposedly) needed for the RTM builds.
#
ifdef NEED_SCO_PM
PLATFORM_FLAGS += -DSCO_PM
endif
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G -b elf -d y
DSO_LDFLAGS =

104
mozilla/config/SINIX.mk Normal file
View File

@@ -0,0 +1,104 @@
#
# 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 SNI SINIX-N (aka ReliantUNIX)
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := sinix
CPU_ARCH := mips
GFX_ARCH := x
OS_INCLUDES = -I/usr/local/include
G++INCLUDES =
LOC_LIB_DIR = /usr/lib/locale
MOTIF =
MOTIFLIB = -lXm
OS_LIBS = -lsocket -lnsl -lgen -lm -ldl -lresolv -lc -L/usr/ucblib -lucb
PLATFORM_FLAGS = -DSNI -Dsinix
MOVEMAIL_FLAGS = -DUSG
PORT_FLAGS = -DSVR4 -DHAVE_FILIO_H -DNEED_S_ISSOCK -DNEED_TIMEVAL -DNEED_SELECT_H -DHAVE_LCHOWN -DNEED_S_ISLNK -DNEED_FCHMOD_PROTO -DNO_CDEFS_H -DSYS_BYTEORDER_H -DUSE_NODL_TABS -DMITSHM -DNO_MULTICAST -DHAVE_NETINET_IN_H -DHAVE_INT32_T
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/sinix.lm
EN_LOCALE = en_US.88591
DE_LOCALE = de_DE.88591
FR_LOCALE = fr_FR.88591
JP_LOCALE = ja_JP.EUC
SJIS_LOCALE = ja_JP.SJIS
KR_LOCALE = ko_KR.euc
CN_LOCALE = zh_CN.ugb
TW_LOCALE = zh_TW.ucns
I2_LOCALE = i2
IT_LOCALE = it_IT.88591
SV_LOCALE = sv_SV.88591
ES_LOCALE = es_ES.88591
NL_LOCALE = nl_NL.88591
PT_LOCALE = pt_PT.88591
######################################################################
# Version-specific stuff
######################################################################
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
BSDECHO = /usr/ucb/echo
EMACS = /bin/true
WHOAMI = /usr/ucb/whoami
PERL = $(LOCAL_BIN)perl
######################################################################
# Other
######################################################################
ifdef NS_USE_NATIVE
CC = cc
CCC = CC
PLATFORM_FLAGS += -fullwarn -xansi
ifdef BUILD_OPT
OPTIMIZER = -Olimit 4000
endif
else
PLATFORM_FLAGS += -pipe -Wall -Wno-format
ASFLAGS += -x assembler-with-cpp
ifdef BUILD_OPT
OPTIMIZER = -O
else
OPTIMIZER = -gdwarf
JAVA_OPTIMIZER = -gdwarf
endif
endif
ifneq ($(USE_KERNEL_THREADS),1)
PORT_FLAGS += -DSW_THREADS
endif
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G
DSO_LDFLAGS = $(MOTIFLIB) -lXt -lX11 $(OS_LIBS)

25
mozilla/config/SunOS.mk Normal file
View File

@@ -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 SunOS. 4 and 5 are vastly different, so we use 2 different files.
#
ifeq ($(OS_RELEASE),4.1)
include $(DEPTH)/config/SunOS4.mk
else
include $(DEPTH)/config/SunOS5.mk
endif

91
mozilla/config/SunOS4.mk Normal file
View File

@@ -0,0 +1,91 @@
#
# 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.x
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := sunos
CPU_ARCH := sparc
GFX_ARCH := x
OS_INCLUDES = -I/usr/X11R5/include -I$(MOTIF)/include
G++INCLUDES =
LOC_LIB_DIR = /usr/openwin/lib/locale
MOTIF = /home/motif/usr
MOTIFLIB = -L$(MOTIF)/lib -lXm
OS_LIBS = -ldl -lm
PLATFORM_FLAGS = -Wall -Wno-format -DSUNOS4
MOVEMAIL_FLAGS =
PORT_FLAGS = -DSW_THREADS -DNEED_SYSCALL -DSTRINGS_ALIGNED -DNO_REGEX -DNO_ISDIR -DUSE_RE_COMP -DNO_REGCOMP -DUSE_GETWD -DNO_MEMMOVE -DNO_ALLOCA -DBOGUS_MB_MAX -DNO_CONST -DHAVE_ODD_SEND -DHAVE_ODD_IOCTL -DHAVE_FILIO_H -DMITSHM -DNEED_SYS_WAIT_H -DNO_TZNAME -DNEED_SYS_TIME_H -DNO_MULTICAST -DHAVE_INT32_T -DNEED_UINT_T -DUSE_ODD_SSCANF -DUSE_ODD_SPRINTF -DNO_IOSTREAM_H
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/sunos.lm
EN_LOCALE = en_US
DE_LOCALE = de
FR_LOCALE = fr
JP_LOCALE = ja
SJIS_LOCALE = ja_JP.SJIS
KR_LOCALE = ko
CN_LOCALE = zh
TW_LOCALE = zh_TW
I2_LOCALE = i2
IT_LOCALE = it
SV_LOCALE = sv
ES_LOCALE = es
NL_LOCALE = nl
PT_LOCALE = pt
######################################################################
# Version-specific stuff
######################################################################
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
DLL_SUFFIX = so.1.0
PERL = $(LOCAL_SUN4)perl
RANLIB = /bin/ranlib
TAR = /usr/bin/tar
WHOAMI = /usr/ucb/whoami
UNZIP_PROG = $(NS_BIN)unzip
ZIP_PROG = $(NS_BIN)zip
######################################################################
# Other
######################################################################
ifndef NO_MDUPDATE
MDUPDATE_FLAGS = -MDupdate $(DEPENDENCIES)
endif
HAVE_PURIFY = 1
MUST_BOOTLEG_ALLOCA = 1
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) -L$(MOTIF)/lib
DSO_LDOPTS =
DSO_LDFLAGS =

177
mozilla/config/SunOS5.mk Normal file
View File

@@ -0,0 +1,177 @@
#
# 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 SunOS 5.x for SPARC and x86
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := solaris
ifeq ($(OS_TEST),i86pc)
CPU_ARCH := x86
else
CPU_ARCH := sparc
endif
GFX_ARCH := x
OS_INCLUDES = -I$(MOTIF)/include -I/usr/openwin/include
G++INCLUDES =
LOC_LIB_DIR = /usr/openwin/lib/locale
MOTIF = /usr/dt
MOTIFLIB = -lXm
OS_LIBS =
PLATFORM_FLAGS = $(DSO_CFLAGS) -DSOLARIS -D__svr4 -D__svr4__
MOVEMAIL_FLAGS = -DUSG
PORT_FLAGS = -DSVR4 -DSYSV -DHAVE_WEAK_IO_SYMBOLS -DHAVE_FILIO_H -DHAVE_LCHOWN -DNEED_CDEFS_H -DMITSHM -DHAVE_WAITID -DHAVE_FORK1 -DHAVE_REMAINDER -DHAVE_SYSTEMINFO_H -DHAVE_INT32_T -DNO_JNI_STUBS
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/sunos.lm
EN_LOCALE = en_US
DE_LOCALE = de
FR_LOCALE = fr
JP_LOCALE = ja
SJIS_LOCALE = ja_JP.SJIS
KR_LOCALE = ko
CN_LOCALE = zh
TW_LOCALE = zh_TW
I2_LOCALE = i2
IT_LOCALE = it
SV_LOCALE = sv
ES_LOCALE = es
NL_LOCALE = nl
PT_LOCALE = pt
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(CPU_ARCH),x86)
EMACS = /bin/true
PLATFORM_FLAGS += -Di386
PORT_FLAGS += -DNEED_INET_TCP_H
else
PLATFORM_FLAGS += -D$(CPU_ARCH)
endif
ifeq ($(OS_VERSION),.3)
MOTIF = /usr/local/Motif/opt/ICS/Motif/usr
MOTIFLIB = $(MOTIF)/lib/libXm.a
EMACS = /bin/true
endif
ifeq ($(OS_VERSION),.4)
PLATFORM_FLAGS += -DSOLARIS_24
endif
ifeq ($(OS_VERSION),.5)
PLATFORM_FLAGS += -DSOLARIS2_5 -DSOLARIS_55_OR_GREATER
PORT_FLAGS += -D_SVID_GETTOD
endif
ifeq ($(OS_RELEASE)$(OS_VERSION),5.5.1)
PLATFORM_FLAGS += -DSOLARIS2_5 -DSOLARIS_55_OR_GREATER
PORT_FLAGS += -D_SVID_GETTOD
endif
ifeq ($(OS_VERSION),.6)
PLATFORM_FLAGS += -DSOLARIS2_6 -DSOLARIS_55_OR_GREATER -DSOLARIS_56_OR_GREATER
PORT_FLAGS += -D_SVID_GETTOD
else
PORT_FLAGS += -DNEED_INET_TCP_H
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
BSDECHO = /usr/ucb/echo
WHOAMI = /usr/ucb/whoami
PROCESSOR_ARCHITECTURE = _$(CPU_ARCH)
UNZIP_PROG = $(NS_BIN)unzip
ZIP_PROG = $(NS_BIN)zip
######################################################################
# Other
######################################################################
ifdef NS_USE_NATIVE
CC = cc
CCC = CC
NO_MDUPDATE = 1
PORT_FLAGS += -DNS_USE_NATIVE
ASFLAGS += -Wa,-P
ifdef SERVER_BUILD
ifndef BUILD_OPT
PLATFORM_FLAGS += -xs
endif
endif
# -z gets around _sbrk multiple define.
OS_GPROF_FLAGS = -xpg -z muldefs
DSO_CFLAGS = -KPIC
else
PLATFORM_FLAGS += -Wall -Wno-format
ifneq ($(CPU_ARCH),x86)
ASFLAGS += -x assembler-with-cpp
endif
OS_GPROF_FLAGS = -pg
DSO_CFLAGS = -fPIC
endif
ifndef NO_MDUPDATE
MDUPDATE_FLAGS = -MDupdate $(DEPENDENCIES)
endif
ifeq ($(FORCE_SW_THREADS),1)
USE_KERNEL_THREADS = 0
endif
ifeq ($(USE_KERNEL_THREADS),1)
ifdef NSPR20
PORT_FLAGS += -D_PR_NTHREAD -D_REENTRANT
else
PORT_FLAGS += -DHW_THREADS -D_REENTRANT
endif
OS_LIBS = -lthread -lposix4
else
ifdef NSPR20
OS_LIBS = -lposix4
else
PORT_FLAGS += -DSW_THREADS
endif
endif
OS_LIBS += -lsocket -lnsl -ldl
ifndef NS_USE_NATIVE
OS_LIBS += -L$(NS_LIB)
endif
#
# An nm command which generates an output like:
# archive.a:object.o: 0000003 T symbol
#
NM_PO = nm -Ap
HAVE_PURIFY = 1
MUST_BOOTLEG_ALLOCA = 1
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G -L$(MOTIF)/lib -L/usr/openwin/lib
DSO_LDFLAGS =

View File

@@ -0,0 +1,83 @@
#
# 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
######################################################################
#
######################################################################
# Version-independent
######################################################################
ARCH := sco_uw
CPU_ARCH := x86
GFX_ARCH := x
OS_INCLUDES = -I/usr/X/include
G++INCLUDES =
LOC_LIB_DIR = /usr/lib/X11
MOTIF =
MOTIFLIB = -lXm
OS_LIBS = -lsocket -lc /usr/ucblib/libucb.a
PLATFORM_FLAGS = -DUNIXWARE -Di386
MOVEMAIL_FLAGS = -DUSG -DHAVE_STRERROR
PORT_FLAGS = -DSVR4 -DSYSV -DSW_THREADS -DHAVE_FILIO_H -DHAVE_ODD_ACCEPT -DNEED_S_ISLNK -DLAME_READDIR -DNO_CDEFS_H -DNO_LONG_LONG -DNEED_S_ISSOCK -DSYS_BYTEORDER_H -DUSE_NODL_TABS -DMOTIF_WARNINGS_UPSET_JAVA -DMITSHM -DNEED_SYS_TIME_H -DNO_MULTICAST -DHAVE_NETINET_IN_H -DHAVE_REMAINDER -DHAVE_INT32_T
PDJAVA_FLAGS =
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
LOCALE_MAP = $(DEPTH)/cmd/xfe/intl/unixware.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
######################################################################
# Version-specific stuff
######################################################################
ifeq ($(OS_RELEASE),5)
PLATFORM_FLAGS += -DUnixWare -DUNIXWARE5
PORT_FLAGS += -DSVR5 -D_SIMPLE_R
BUILD_UNIX_PLUGINS = 1
MKSHLIB = $(LD) $(DSO_LDOPTS)
DSO_LDOPTS = -G
DSO_LDFLAGS = -nostdlib -L/lib -L/usr/lib -L/usr/X/lib -lXm -lXt -lX11 -lgen
endif
######################################################################
# Overrides for defaults in config.mk (or wherever)
######################################################################
CC = $(DEPTH)/build/hcc
CCC = $(DEPTH)/build/hcpp
EMACS = /bin/true
WHOAMI = /usr/ucb/whoami
PERL = $(LOCAL_BIN)perl
######################################################################
# Other
######################################################################

113
mozilla/config/WIN16 Normal file
View File

@@ -0,0 +1,113 @@
# 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 Configuration file
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Define the OS dependent commands used by MAKE
#//
#//------------------------------------------------------------------------
CC=cl
LD=$(MOZ_TOOLS)\bin\optlinks.exe
AR=$(DEPTH)\CONFIG\TLIB.EXE /P64 /C
#AR=lib /NOLOGO /BATCH /NOIGNORECASE
RC=rc
#RM=del /F /Q
#RM_R=del /F /S /Q
RM=rm -f
RM_R=rm -fr
CP=cp
AWK=$(MOZ_TOOLS)\bin\gawk.exe
RANLIB=$(DEPTH)\config\true.bat
!ifndef MOZ_DEBUG
JAVAH_PROG=$(DEPTH)\dist\$(DIST_PREFIX)32_o.obj\bin\javah.exe
!else
JAVAH_PROG=$(DEPTH)\dist\$(DIST_PREFIX)32_d.obj\bin\javah.exe
!endif
#//------------------------------------------------------------------------
#//
#// Define Debug and optimization flags
#//
#//------------------------------------------------------------------------
!ifndef MOZ_DEBUG
!ifndef OPTIMIZER
OPTIMIZER=-Ox -Os -DDEVELOPER_DEBUG
!endif
OS_LFLAGS=
!else
!if defined(MOZ_FULL_DEBUG_INFO) || ("$(MAKE_OBJ_TYPE)" == "DLL")
OPTIMIZER=-Z7
!else if defined(MOZ_DEBUG_FLAG)
OPTIMIZER=$(MOZ_DEBUG_FLAG)
!else
OPTIMIZER=-Zd
!endif
OPTIMIZER=$(OPTIMIZER) -Od -DDEBUG -UNDEBUG
OS_LFLAGS=/CO
!endif
!if defined (MOZ_LITE)
OPTIMIZER=$(OPTIMIZER) -DMOZ_LITE
!endif
#//------------------------------------------------------------------------
#//
#// Specify the OS dependent compiler flags, linker flags and libraries
#//
#//------------------------------------------------------------------------
!ifdef 286_INSTRUCTIONS
INSTRUCTIONS=-G2
!else
INSTRUCTIONS=-G3
!endif
OS_CFLAGS=$(INSTRUCTIONS) -AL -Gx- -Gf -Gd -Gs -W3 -nologo \
!ifdef MOZ_JAVA
-DSEG_ARRAY \
!endif
-D_X86_ -D_WINDOWS -DXP_PC -DSW_THREADS
OS_LFLAGS=$(OS_LFLAGS) /NOE /NOD /NOI /XNOI \
/ALIGN:16 /BYORDINAL /FARCALL \
/PACKC:61440 /PACKD /REORDERSEGMENTS \
/DETAILEDMAP /XREF /ONERROR:NOEXE /NOLOGO /WARNDUPS
OS_LIBS=LIBW.LIB TOOLHELP.LIB
#//------------------------------------------------------------------------
#//
#// Specify the special flags for creating EXEs
#//
#//------------------------------------------------------------------------
EXE_CFLAGS=/GA /Gt3
EXE_LFLAGS=/STACK:20000
EXE_LIBS=OLDNAMES.LIB LLIBCEW.LIB
#//------------------------------------------------------------------------
#//
#// Specify the special flags for creating DLLs
#//
#//------------------------------------------------------------------------
!ifndef DLL_CFLAGS
DLL_CFLAGS=/GD /D "_WINDLL"
!endif
DLL_LFLAGS=
DLL_LIBS=OLDNAMES.LIB LDLLCEW.LIB

138
mozilla/config/WIN32 Normal file
View File

@@ -0,0 +1,138 @@
# 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.
#//------------------------------------------------------------------------
#//
#// Win32 Configuration file
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Define the OS dependent commands used by MAKE
#//
#//------------------------------------------------------------------------
CC=cl
LD=link
AR=lib
RC=rc
#RM=del /F /Q
#RM_R=del /F /S /Q
RM=rm -f
RM_R=rm -fr
CP=cp
AWK=$(MOZ_TOOLS)\bin\gawk.exe
RANLIB=$(DEPTH)\config\true.bat
JAVAH=$(DIST)\bin\javah.exe
JAVA=$(MOZ_TOOLS)\bin\java.exe
!ifndef JAVAH_IN_JAVA
JAVAH_PROG = $(DIST)\bin\javah.exe
!else
JAVAH_PROG = $(JAVA) netscape.tools.jric.Main
!endif
#//------------------------------------------------------------------------
#//
#// Define Debug and optimization flags
#//
#//------------------------------------------------------------------------
!ifdef MOZ_PROF
#
# compile with debug symbols, but without DEBUG code and ASSERTs
#
OPTIMIZER=-Z7 -UDEBUG -DNDEBUG -U_DEBUG
OS_LFLAGS=/DEBUG /DEBUGTYPE:CV /PDB:NONE
!else
!ifdef MOZ_DEBUG
#
# Uncomment for MSVC debug malloc logging...
#
#OPTIMIZER=-Z7 -DDEBUG -UNDEBUG -D_DEBUG -D_CRTDBG_MAP_ALLOC
OPTIMIZER=-Z7 -DDEBUG -UNDEBUG -D_DEBUG
OS_LFLAGS=/DEBUG /DEBUGTYPE:CV /PDB:NONE
!else
#
# optimize it
#
OPTIMIZER=-O1 -UDEBUG -DNDEBUG
OS_LFLAGS=
!endif
!endif
#//------------------------------------------------------------------------
#//
#// Select the correct RTL to link...
#//
#// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
#// DLL version of the RTL is used...
#//
#//------------------------------------------------------------------------
!ifdef USE_STATIC_LIBS
RTL_FLAGS=-MT # Statically linked multithreaded RTL
!ifdef MOZ_DEBUG
RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL
!endif
!else
RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
!ifdef MOZ_DEBUG
RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
!endif
!endif
#//------------------------------------------------------------------------
#//
#// Specify the OS dependent compiler flags, linker flags and libraries
#//
#//------------------------------------------------------------------------
OS_CFLAGS=$(OPTIMIZER) $(RTL_FLAGS) -W3 -nologo -D_X86_ -D_WINDOWS -DWIN32 \
-DXP_PC -DHW_THREADS
OS_CFLAGS=$(OS_CFLAGS) -DMSVC4
## Removed MOZ_LITE/MOZ_MEDIUM stuff from OS_CFLAGS
OS_LFLAGS=$(OS_LFLAGS)
OS_LIBS=kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib
#//------------------------------------------------------------------------
#//
#// Specify the special flags for creating EXEs
#//
#//------------------------------------------------------------------------
!ifdef SWAPTUNER
EXE_CFLAGS=/Gh
!else
EXE_CFLAGS=/Gy
!endif
EXE_LFLAGS=
EXE_LIBS=
#//------------------------------------------------------------------------
#//
#// Specify the special flags for creating DLLs
#//
#//------------------------------------------------------------------------
DLL_CFLAGS=
DLL_LFLAGS=/SUBSYSTEM:WINDOWS
DLL_LIBS=

114
mozilla/config/bin2rc.c Normal file
View File

@@ -0,0 +1,114 @@
/* -*- 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.
*/
#include <stdio.h>
#include <sys\stat.h>
int main(int iArgc, char **ppArgv) {
int iRetval = 1;
/* First argument, the filename to convert.
* Output to stdout, redirect to save.
*/
char *pFileName = ppArgv[1];
if(pFileName) {
FILE *pFile = fopen(pFileName, "rb");
if(pFile) {
struct stat sInfo;
/* Stat the file for size.
*/
if(!fstat(fileno(pFile), &sInfo)) {
int iChar;
int iX = 0;
int iFirsttime = 1;
/* Begin RCDATA
*/
printf("BEGIN\n");
/* First string identifies created via bin2rc.
* Users of the RCDATA must check for this to
* assume the format of the remainder of
* the data.
*/
printf("\t\"bin2rc generated resource\\0\",\t// bin2rc identity string\n");
/* Next string is optional parameter on command
* line. If not present, an empty string.
* Users of the RCDATA must understand this is
* the optional string that can be used for
* about any purpose they desire.
*/
printf("\t\"%s\\0\",\t// optional command line string\n", ppArgv[2] ? ppArgv[2] : "");
/* Next string is the size of the original file.
* Users of the RCDATA must understand that this
* is the size of the file's actual contents.
*/
printf("\t\"%ld\\0\"\t// data size header\n", sInfo.st_size);
while(EOF != (iChar = fgetc(pFile))) {
/* Comma?
*/
if(0 == iFirsttime) {
iX += printf(",");
}
else {
iFirsttime = 0;
}
/* Newline?
*/
if(iX >= 72) {
printf("\n");
iX = 0;
}
/* Tab?
*/
if(0 == iX) {
printf("\t");
iX += 8;
}
/* Octal byte.
*/
iX += printf("\"\\%.3o\"", iChar);
}
/* End RCDATA
*/
if(0 != iX) {
printf("\n");
}
printf("END\n");
/* All is well.
*/
iRetval = 0;
}
fclose(pFile);
pFile = NULL;
}
}
return(iRetval);
}

BIN
mozilla/config/bin2rc.exe Executable file

Binary file not shown.

77
mozilla/config/bsdecho.c Normal file
View File

@@ -0,0 +1,77 @@
/* -*- 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.
*/
/*
** This is a feeble attempt at creating a BSD-style echo command
** for use on platforms that have only a Sys-V echo. This version
** supports the '-n' flag, and will not interpret '\c', etc. As
** of this writing this is only needed on HP-UX and AIX 4.1.
** --briano.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if !defined(XP_OS2)
#include <unistd.h>
#endif
#ifdef SUNOS4
#include "sunos4.h"
#endif
void main(int argc, char **argv)
{
short numargs = argc;
short newline = 1;
if (numargs == 1)
{
exit(0);
}
if (strcmp(*++argv, "-n") == 0)
{
if (numargs == 2)
{
exit(0);
}
else
{
newline = 0;
numargs--;
argv++;
}
}
while (numargs > 1)
{
fprintf(stdout, "%s", *argv++);
numargs--;
if (numargs > 1)
{
fprintf(stdout, " ");
}
}
if (newline == 1)
{
fprintf(stdout, "\n");
}
exit(0);
}

View File

@@ -0,0 +1,41 @@
@echo off
rem The contents of this file are subject to the Netscape Public License
rem Version 1.0 (the "NPL"); you may not use this file except in
rem compliance with the NPL. You may obtain a copy of the NPL at
rem http://www.mozilla.org/NPL/
rem
rem Software distributed under the NPL is distributed on an "AS IS" basis,
rem WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
rem for the specific language governing rights and limitations under the
rem NPL.
rem
rem The Initial Developer of this code under the NPL is Netscape
rem Communications Corporation. Portions created by Netscape are
rem Copyright (C) 1998 Netscape Communications Corporation. All Rights
rem Reserved.
@echo on
@echo off
if not exist %2 echo Warning: %2 does not exist! (you may need to check it out)
if not exist %2 exit 1
pushd %2
goto NO_CAFE
if "%MOZ_CAFE%"=="" goto NO_CAFE
mkdir %MOZ_SRC%\ns\dist\classes\%2
%MOZ_TOOLS%\bin\sj.exe -classpath %MOZ_SRC%\ns\dist\classes;%MOZ_SRC%\ns\sun-java\classsrc -d %MOZ_SRC%\ns\dist\classes *.java
goto END
:NO_CAFE
%MOZ_TOOLS%\perl5\perl.exe %MOZ_SRC%\ns\config\outofdate.pl -d %MOZ_SRC%\ns\dist\classes\%2 *.java >> %1
%MOZ_TOOLS%\bin\java.exe -argfile %1
:END
popd

121
mozilla/config/clobber_miss.pl Executable file
View File

@@ -0,0 +1,121 @@
#!perl5
#
# 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.
#
#
# Searches the tree for unclobbered files
# should be relatively cross platform
#
$start_dir = $ENV{"MOZ_SRC"};
@ignore_list = ("make.dep","manifest.mnw");
$missed = 0;
print "\n\nChecking for unclobbered files\n" .
"------------------------------\n";
GoDir("ns");
if( $missed ){
die "\nError: $missed files or directories unclobbered\n";
}
else {
print "No unclobbered files found\n";
}
sub GoDir {
local($dir) = @_;
local(%filelist,$iscvsdir);
local($k,$v,$d,$fn,$rev, $mod_time);
local($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks);
if(! chdir "$start_dir/$dir" ){
return;
}
while(<*.*> ){
if( $_ ne '.' && $_ ne '..' && $_ ne 'CVS'
&& $_ ne 'nuke' ){
$filelist{$_} = 1;
}
}
if( -r "CVS/Entries" ){
$iscvsdir=1;
open(ENT, "CVS/Entries" ) ||
die "Cannot open CVS/Entries for reading\n";
while(<ENT>){
chop;
($d,$fn,$rev,$mod_time) = split(/\//);
if( $fn ne "" ){
if( $d eq "D" ){
$filelist{$fn} = 3;
}
else {
$filelist{$fn} = 2;
}
}
}
close(ENT);
}
while( ($k,$v) = each %filelist ){
if( $v == 1 && $iscvsdir && !IgnoreFile( $k ) ){
if( ! -d $k ){
print " file: $dir/$k\n";
$missed++;
}
else {
if( ! -r "$k/CVS/Entries" ){
print "directory: $dir/$k\n";
$missed++;
}
else {
$filelist{$k} = 3;
}
}
}
}
while( ($k,$v) = each %filelist ){
if( $v == 3 ){
GoDir("$dir/$k");
}
}
# while( ($k,$v) = each %filelist ){
# print "$k: $v\n";
# }
}
sub IgnoreFile {
local($fn) = @_;
local($i);
for $i (@ignore_list){
if( $fn eq $i ){
return 1;
}
}
return 0;
}

138
mozilla/config/common.mk Normal file
View File

@@ -0,0 +1,138 @@
#
# 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.
#
######################################################################
# Cross-platform defines used on all platforms (in theory)
######################################################################
#
# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
# Since the longest of these is 5 characters without the suffix,
# be sure to not set VERSION_NUMBER to anything longer than 3
# characters for Win16's sake.
#
# Also... If you change this value, there are several other places
# you'll need to change (because they're not reached by this
# variable):
# sun-java/nsjava/nsjava32.def
# sun-java/nsjava/nsjava16.def
# sun-java/classsrc/sun/audio/AudioDevice.java
# sun-java/classsrc/sun/awt/windows/WToolkit.java
#
VERSION_NUMBER = 40
ZIP_NAME = java_$(VERSION_NUMBER)
JAR_NAME = java$(VERSION_NUMBER).jar
# XXX obsolete
WIN_ZIP_NAME = $(ZIP_NAME).win
MAC_ZIP_NAME = $(ZIP_NAME).mac
UNIX_ZIP_NAME = $(ZIP_NAME).x
STAND_ALONE_ZIP_NAME = java_sa.zip
######################################################################
# Cross-Platform Java Stuff
######################################################################
# java interpreter
# get class files from the directory they are compiled to
JAVA_CLASSPATH = $(JAVAC_ZIP)$(PATH_SEPARATOR)$(JAVA_DESTPATH)
JAVA_FLAGS = -classpath $(JAVA_CLASSPATH) -ms8m
JAVA = $(JAVA_PROG) $(JAVA_FLAGS)
#
# NOTE: If a new DLL is being added to this define you will have to update
# ns/sun-java/include/javadefs.h in order not to break win16.
#
JAVA_DEFINES = -DJAR_NAME=\"$(JAR_NAME)\" -DJRTDLL=\"$(JRTDLL)\" -DMMDLL=\"$(MMDLL)\" \
-DAWTDLL=\"$(AWTDLL)\" -DJITDLL=\"$(JITDLL)\" -DJPWDLL=\"$(JPWDLL)\"
######################################################################
# javac
#
# java wants '-ms8m' and kaffe wants '-ms 8m', so this needs to be
# overridable.
#
JINT_FLAGS = -ms8m
# to run the compiler in the interpreter
JAVAC_PROG = $(JINT_FLAGS) $(PDJAVA_FLAGS) -classpath $(JAVAC_ZIP) sun.tools.javac.Main
JAVAC = $(JAVA_PROG) $(JAVAC_PROG) $(JAVAC_FLAGS)
# std set of options passed to the compiler
JAVAC_FLAGS = -classpath $(JAVAC_CLASSPATH) $(JAVAC_OPTIMIZER) -d $(JAVA_DESTPATH)
#
# The canonical Java classpath is:
# JAVA_DESTPATH, JAVA_SOURCEPATH, JAVA_LIBS
#
# appropriately delimited, in that order
#
JAVAC_CLASSPATH = $(JAVA_DESTPATH)$(PATH_SEPARATOR)$(JAVA_SOURCEPATH)
######################################################################
# javadoc
# Rules to build java .html files from java source files
JAVADOC_PROG = $(JAVA) sun.tools.javadoc.Main
JAVADOC_FLAGS = -classpath $(JAVAC_CLASSPATH)
JAVADOC = $(JAVADOC_PROG) $(JAVADOC_FLAGS)
######################################################################
# javah
JAVAH_FLAGS = -classpath $(JAVA_DESTPATH)
JAVAH = $(JAVAH_PROG) $(JAVAH_FLAGS)
######################################################################
# jmc
JMCSRCDIR = $(XPDIST)/_jmc
JMC_PROG = $(JAVA) netscape.tools.jmc.Main
JMC_CLASSPATH = $(JMCSRCDIR)$(PATH_SEPARATOR)$(JAVAC_CLASSPATH)
JMC_FLAGS = -classpath $(JMC_CLASSPATH) -verbose
JMC = $(JMC_PROG) $(JMC_FLAGS)
######################################################################
# zip
ZIP = $(ZIP_PROG) $(ZIP_FLAGS)
######################################################################
# idl2java
ORBTOOLS = $(DEPTH)/modules/iiop/tools/orbtools.zip
ORB_CLASSPATH = $(ORBTOOLS)$(PATH_SEPARATOR)$(JAVA_CLASSPATH)
IDL2JAVA_PROG = $(JAVA_PROG)
IDL2JAVA_FLAGS = -classpath $(ORB_CLASSPATH) pomoco.tools.idl2java
IDL2JAVA = $(IDL2JAVA_PROG) $(IDL2JAVA_FLAGS)
######################################################################
# lex and yacc
JAVALEX_PROG = $(JAVA_PROG) -classpath $(ORB_CLASSPATH) sbktech.tools.jax.driver
JAVALEX_FLAGS =
JAVALEX = $(JAVALEX_PROG) $(JAVALEX_FLAGS)
JAVACUP_PROG = $(JAVA_PROG) -classpath $(ORB_CLASSPATH) java_cup.Main
JAVACUP_FLAGS =
JAVACUP = $(JAVACUP_PROG) $(JAVACUP_FLAGS)

373
mozilla/config/config.guess vendored Executable file
View File

@@ -0,0 +1,373 @@
#!/bin/sh
# This script attempts to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:1.*:*)
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf${UNAME_RELEASE}
exit 0 ;;
# lemacs change from Dirk Grunwald <grunwald@foobar.cs.colorado.edu>
alpha:OSF1:V[123].*:*)
# 1.3 uses "V1.3" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
sun4*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc*:SunOS:5.*:*)
echo x86-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
echo sparc-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
mips:*:5*:RISCos)
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
echo m88k-dg-dgux${UNAME_RELEASE}
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix${UNAME_RELEASE}
exit 0 ;;
i[3456]86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
test -x /usr/bin/oslevel && test `/usr/bin/oslevel` = '=3240' \
&& echo rs6000-ibm-aix3.2.4 && exit 0
test -x /usr/bin/oslevel && test `/usr/bin/oslevel` = '=3250' \
&& echo rs6000-ibm-aix3.2.5 && exit 0
test -x /usr/bin/oslevel && test `/usr/bin/oslevel` = '<>3250' \
&& echo rs6000-ibm-aix3.2.5 && exit 0
echo rs6000-ibm-aix3.2
exit 0 ;;
*:AIX:*:4)
echo rs6000-ibm-aix4
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/31?:HP-UX:*:*)
echo m68000-hp-hpux
exit 0 ;;
9000/[34]??:HP-UX:*:*)
echo m68k-hp-hpux
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/7??:HP-UX:*:* | 9000/8?7:HP-UX:*:* )
echo hppa1.1-hp-hpux
exit 0 ;;
9000/8??:HP-UX:*:*)
echo hppa1.0-hp-hpux
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2:*)
echo c2-convex-bsd
exit 0 ;;
CRAY*X-MP:UNICOS:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:UNICOS:*:*)
echo ymp-cray-unicos
exit 0 ;;
CRAY-2:UNICOS:*:*)
echo cray2-cray-unicos
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
i[3456]86:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd
exit 0 ;;
i[3456]86:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd${UNAME_RELEASE}
exit 0 ;;
alpha:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux
exit 0 ;;
i[3456]86:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux
exit 0 ;;
ppc:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux
exit 0 ;;
i[3456]86:UNIX_SV:4.*:* | i[3456]86:SYSTEM_V:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
UNAME_REL=`(/bin/uname -v)`
echo ${UNAME_MACHINE}-sco-unixware${UNAME_REL}
else
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i[3456]86:*:3.2:*)
if /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= .*v//')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
echo ${UNAME_MACHINE}-sco-opensv${UNAME_REL}
else
echo ${UNAME_MACHINE}-unknown-sysv32
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M680[234]0:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[3456]??*:*:4.0:*)
uname -p 2>/dev/null | egrep 'Pentium|86' >/dev/null && echo x86-ncr-sysv4 && exit 0 ;;
m680[234]0:LynxOS:2.2*:*)
echo m68k-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
i[3456]86:LynxOS:2.2*:*)
echo x86-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.2*:*)
echo sparc-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
RM*:SINIX-N:5.4[23]:*|RM*:ReliantUNIX-N:5.4[23]:*)
echo mips-sni-reliantunix
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >dummy.c <<EOF
main()
{
#if defined (sony)
#if defined (MIPSEB)
#if defined (__svr4)
printf ("mips-sony-sysv\n"); exit (0);
#else
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#endif
#else
printf("m68k-sony-newsos\n"); exit(0);
#endif
#endif
#if defined (_nec_ews)
printf("mips-nec-uxv4.2\n"); exit(0);
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf("arm-acorn-riscix"); exit (0);
#endif
#if defined(hp300) && !defined(hpux)
printf("m68k-hp-bsd\n"); exit(0);
#endif
#if defined(NeXT)
#if !defined(__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version==2)
{
printf("%s-next-ns2\n", __ARCHITECTURE__);
exit(0);
}
else
{
printf("%s-next-ns3\n", __ARCHITECTURE__);
exit(0);
}
#endif
#if defined (MACH)
#if defined (vax)
printf("vax-dec-mach\n"); exit(0);
#else
#if defined (sun3)
printf("mc68000-sun-mach\n"); exit(0);
#else
#if defined (sparc)
printf("sparc-sun-mach\n"); exit(0);
#else
#if defined (mips)
printf("mips-dec-mach\n"); exit(0);
#else
#if defined (ibmrt)
printf("romp-ibm-mach\n"); exit(0);
#else
#if defined (i386)
printf("i386-unknown-mach\n"); exit(0);
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf("ns32k-encore-sysv\n"); exit(0);
#else
#if defined (CMU)
printf("ns32k-encore-mach\n"); exit(0);
#else
printf("ns32k-encore-bsd\n"); exit(0);
#endif
#endif
#endif
#if defined(__386BSD__) || (defined(__bsdi__) && defined(__i386__))
printf("i386-bsdi-bsd\n"); exit(0);
#endif
#if defined(sequent)
#if defined(i386)
printf("i386-sequent-dynix\n"); exit(0);
#endif
#if defined (ns32000)
printf("ns32k-sequent-dynix\n"); exit(0);
#endif
#endif
#if defined(_SEQUENT_)
printf("i386-sequent-ptx\n"); exit(0);
#endif
#if defined(vax)
#if !defined(ultrix)
printf("vax-dec-bsd\n"); exit(0);
#else
printf("vax-dec-ultrix\n"); exit(0);
#endif
#endif
exit (1);
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
#echo '(Unable to guess system type)' 1>&2
exit 1

339
mozilla/config/config.mak Normal file
View File

@@ -0,0 +1,339 @@
# 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.
!if !defined(CONFIG_CONFIG_MAK)
CONFIG_CONFIG_MAK=1
#//------------------------------------------------------------------------
#//
#// Define public make variables:
#//
#// OBJDIR - Specifies the location of intermediate files (ie. objs...)
#// Currently, the names are WINxx_O.OBJ or WINxx_D.OBJ for
#// optimized and debug builds respectively.
#//
#// DIST - Specifies the location of the distribution directory where
#// all targets are delivered.
#//
#// CFGFILE - Specifies the name of the temporary configuration file
#// containing the arguments to the current command.
#//
#// INCS - Default include paths.
#//
#// CFLAGS - Default compiler options.
#//
#// LFLAGS - Default linker options.
#//
#//------------------------------------------------------------------------
## Include support for MOZ_LITE/MOZ_MEDIUM
include <$(DEPTH)/config/liteness.mak>
!if "$(MOZ_BITS)" == "16"
!if "$(MAKE_OBJ_TYPE)" == "DLL"
OBJTYPE=D
!else
OBJTYPE=E
!endif
!else
OBJTYPE=
!endif
XPDIST=$(DEPTH)\dist
PUBLIC=$(XPDIST)\public
#//-----------------------------------------------------------------------
#// OBJDIR is NOT the same as DIST for Win16. The Win16 dist stuff can
#// be built with EXE or DLL compiler flags, but the DIST directory
#// has the same name no matter what
#//-----------------------------------------------------------------------
!ifdef MOZ_NAV_BUILD_PREFIX
DIST_PREFIX=NAV
!else
DIST_PREFIX=WIN
!endif
!ifndef MOZ_DEBUG
OBJDIR=$(DIST_PREFIX)$(MOZ_BITS)$(OBJTYPE)_O.OBJ
JAVA_OPTIMIZER = -O
!ifdef NO_CAFE
JAVAC_OPTIMIZER =
!else
#JAVAC_OPTIMIZER= -O -noinline
JAVAC_OPTIMIZER =
!endif
!else
OBJDIR=$(DIST_PREFIX)$(MOZ_BITS)$(OBJTYPE)_D.OBJ
JAVA_OPTIMIZER = -g
JAVAC_OPTIMIZER = -g
!endif
#//
#// DIST DEFINES SHOULD NEVER BE COMPONENT SPECIFIC.
#//
!ifndef MOZ_DEBUG
DIST=$(XPDIST)\$(DIST_PREFIX)$(MOZ_BITS)_O.OBJ
!else
DIST=$(XPDIST)\$(DIST_PREFIX)$(MOZ_BITS)_D.OBJ
!endif
CFGFILE=$(OBJDIR)\cmd.cfg
!if "$(MOZ_BITS)" == "16"
INCS=-I$(XPDIST)\public\win16 $(INCS) -I$(MOZ_SRC)\ns\include -I$(DIST)\include -I..\include
!else
INCS=$(INCS) -I$(MOZ_SRC)\ns\include -I$(DIST)\include \
-I$(XPDIST)\public\img -I$(XPDIST)\public\util \
-I$(XPDIST)\public\coreincl
!endif # 16
!ifndef NO_LAYERS
INCS=$(INCS) -I$(DEPTH)\lib\liblayer\include
!endif
!if "$(STAND_ALONE_JAVA)" == "1"
LCFLAGS=$(LCFLAGS) -DSTAND_ALONE_JAVA
!endif
!if defined(MOZ_JAVA)
MOZ_JAVA_FLAG=-DJAVA
!endif
# Perhaps we should add MOZ_LITENESS_FLAGS to 16 bit build
!if "$(MOZ_BITS)" == "16"
CFLAGS=$(MOZ_JAVA_FLAG) -DMOCHA -DLAYERS -DEDITOR $(OS_CFLAGS) $(MOZ_CFLAGS)
!else
CFLAGS=$(MOZ_JAVA_FLAG) -DMOCHA -DLAYERS $(OS_CFLAGS) $(MOZ_CFLAGS) $(MOZ_LITENESS_FLAGS)
!endif
LFLAGS=$(OS_LFLAGS) $(LLFLAGS) $(MOZ_LFLAGS)
# This compiles in heap dumping utilities and other good stuff
# for developers -- maybe we only want it in for a special SDK
# nspr/java runtime(?):
!if "$(MOZ_BITS)"=="32" || defined(MOZ_DEBUG)
CFLAGS = $(CFLAGS) -DDEVELOPER_DEBUG
!endif
!ifdef STANDALONE_IMAGE_LIB
CFLAGS=$(CFLAGS) -DSTANDALONE_IMAGE_LIB
!endif
# always need these:
CFLAGS = $(CFLAGS) -DNETSCAPE
# Specify that we are building a client.
# This will instruct the cross platform libraries to
# include all the client specific cruft.
!if defined(SERVER_BUILD)
CFLAGS = $(CFLAGS) -DSERVER_BUILD
!elseif defined(LIVEWIRE)
CFLAGS = $(CFLAGS) -DLIVEWIRE
!else
CFLAGS = $(CFLAGS) -DMOZILLA_CLIENT
!endif
PERL= $(MOZ_TOOLS)\perl5\perl.exe
MASM = $(MOZ_TOOLS)\bin\ml.exe
#//------------------------------------------------------------------------
#//
#// Include the OS dependent configuration information
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/WIN$(MOZ_BITS)>
!ifdef MOZ_DEBUG
!ifdef USERNAME
CFLAGS = $(CFLAGS) -DDEBUG_$(USERNAME)
!endif
!endif
#//------------------------------------------------------------------------
#//
#// Define the global make commands.
#//
#// MAKE_INSTALL - Copy a target to the distribution directory.
#//
#// MAKE_OBJDIRS - Create an object directory (if necessary).
#//
#// MAKE_MANGLE - Convert all long filenames into 8.3 names
#//
#// MAKE_UNMANGLE - Restore all long filenames
#//
#//------------------------------------------------------------------------
!if !defined(MOZ_SRC)
#enable builds on any drive if defined.
MOZ_SRC=y:
!endif
MAKE_INSTALL=@$(DEPTH)\config\makecopy.exe
MAKE_MANGLE=$(DEPTH)\config\mangle.exe
MAKE_UNMANGLE=if exist unmangle.bat call unmangle.bat
#//------------------------------------------------------------------------
#//
#// Common Libraries
#//
#//------------------------------------------------------------------------
!ifdef NSPR20
!if "$(MOZ_BITS)" == "16"
LIBNSPR=$(DIST)\lib\nspr21.lib
LIBNSPR=$(LIBNSPR) $(DIST)\lib\plds21.lib
LIBNSPR=$(LIBNSPR) $(DIST)\lib\msgc21.lib
!else
LIBNSPR=$(DIST)\lib\libnspr21.lib
LIBNSPR=$(LIBNSPR) $(DIST)\lib\libplds21.lib
LIBNSPR=$(LIBNSPR) $(DIST)\lib\libmsgc21.lib
!endif
!else
LIBNSPR=$(DIST)\lib\pr$(MOZ_BITS)$(VERSION_NUMBER).lib
!endif
!ifdef NSPR20
NSPRDIR = nsprpub
CFLAGS = $(CFLAGS) -DNSPR20
!else
NSPRDIR = nspr
!endif
LIBJPEG=$(DIST)\lib\jpeg$(MOZ_BITS)$(VERSION_NUMBER).lib
######################################################################
### Windows-Specific Java Stuff
PATH_SEPARATOR = ;
# where the bytecode will go
!if "$(AWT_11)" == "1"
JAVA_DESTPATH = $(MOZ_SRC)\ns\dist\classes11
!else
JAVA_DESTPATH = $(MOZ_SRC)\ns\dist\classes
!endif
# where the source are
DEFAULT_JAVA_SOURCEPATH = $(MOZ_SRC)\ns\sun-java\classsrc
!ifndef JAVA_SOURCEPATH
!if "$(AWT_11)" == "1"
JAVA_SOURCEPATH = $(MOZ_SRC)\ns\sun-java\classsrc11;$(DEFAULT_JAVA_SOURCEPATH)
!else
JAVA_SOURCEPATH = $(DEFAULT_JAVA_SOURCEPATH)
!endif
!endif
JAVA_PROG=$(MOZ_TOOLS)\bin\java.exe
#JAVA_PROG=$(DIST)\bin\java
JAVAC_ZIP=$(MOZ_TOOLS)/lib/javac.zip
ZIP_PROG = $(MOZ_TOOLS)\bin\zip
UNZIP_PROG = $(MOZ_TOOLS)\bin\unzip
ZIP_FLAGS = -0 -r -q
CFLAGS = $(CFLAGS) -DOS_HAS_DLL
DLL_SUFFIX = dll
LIB_SUFFIX = lib
!if "$(STAND_ALONE_JAVA)" == "1"
STAND_ALONE_JAVA_DLL_SUFFIX=s
!else
STAND_ALONE_JAVA_DLL_SUFFIX=
!endif
MOD_JRT=jrt$(MOZ_BITS)$(VERSION_NUMBER)
MOD_MM =mm$(MOZ_BITS)$(VERSION_NUMBER)
MOD_AWT=awt$(MOZ_BITS)$(VERSION_NUMBER)
MOD_AWTS=awt$(MOZ_BITS)$(VERSION_NUMBER)$(STAND_ALONE_JAVA_DLL_SUFFIX)
MOD_JIT=jit$(MOZ_BITS)$(VERSION_NUMBER)
MOD_JSJ=jsj$(MOZ_BITS)$(VERSION_NUMBER)
MOD_NET=net$(MOZ_BITS)$(VERSION_NUMBER)
MOD_JBN=jbn$(MOZ_BITS)$(VERSION_NUMBER)
MOD_NSC=nsc$(MOZ_BITS)$(VERSION_NUMBER)
MOD_JPW=jpw$(MOZ_BITS)$(VERSION_NUMBER)
MOD_JDB=jdb$(MOZ_BITS)$(VERSION_NUMBER)
MOD_ZIP=zip$(MOZ_BITS)$(VERSION_NUMBER)
MOD_ZPW=zpw$(MOZ_BITS)$(VERSION_NUMBER)
MOD_CON=con$(MOZ_BITS)$(VERSION_NUMBER)
JRTDLL=$(MOD_JRT).$(DLL_SUFFIX)
MMDLL =$(MOD_MM).$(DLL_SUFFIX)
AWTDLL=$(MOD_AWT).$(DLL_SUFFIX)
AWTSDLL=$(MOD_AWT)$(STAND_ALONE_JAVA_DLL_SUFFIX).$(DLL_SUFFIX)
JITDLL=$(MOD_JIT).$(DLL_SUFFIX)
JSJDLL=$(MOD_JSJ).$(DLL_SUFFIX)
NETDLL=$(MOD_NET).$(DLL_SUFFIX)
JBNDLL=$(MOD_JBN).$(DLL_SUFFIX)
NSCDLL=$(MOD_NSC).$(DLL_SUFFIX)
JPWDLL=$(MOD_JPW).$(DLL_SUFFIX)
JDBDLL=$(MOD_JDB).$(DLL_SUFFIX)
ZIPDLL=$(MOD_ZIP).$(DLL_SUFFIX)
ZPWDLL=$(MOD_ZPW).$(DLL_SUFFIX)
CONDLL=$(MOD_CON).$(DLL_SUFFIX)
ZIPLIB=$(DIST)\lib\$(MOD_ZIP).$(LIB_SUFFIX)
AWTLIB=$(DIST)\lib\$(MOD_AWT).$(LIB_SUFFIX)
######################################################################
include <$(DEPTH)/config/common.mk>
JAVA_DEFINES = \
-DJAR_NAME=\"$(JAR_NAME)\" \
-DJRTDLL=\"$(JRTDLL)\" \
-DMMDLL=\"$(MMDLL)\" \
-DAWTDLL=\"$(AWTDLL)\" \
-DAWTSDLL=\"$(AWTSDLL)\" \
-DJSJDLL=\"$(JSJDLL)\" \
-DJITDLL=\"$(JITDLL)\" \
-DNETDLL=\"$(NETDLL)\" \
-DJBNDLL=\"$(JBNDLL)\" \
-DNSCDLL=\"$(NSCDLL)\" \
-DJDBDLL=\"$(JDBDLL)\" \
-DJPWDLL=\"$(JPWDLL)\" \
-DZPWDLL=\"$(ZPWDLL)\" \
-DCONDLL=\"$(CONDLL)\"
!if "$(MOZ_BITS)" == "16"
# Override JAVA_DEFINES to make command line short for win16.
# Put any new defines into javadefs.h in ns/sun-java/include.
# This is to shorten the command line in order not to break Win16.
JAVA_DEFINES = -DJAR_NAME=\"$(JAR_NAME)\" -DMOZ_BITS=\"$(MOZ_BITS)\" -DVERSION_NUMBER=\"$(VERSION_NUMBER)\" -DDLL_SUFFIX=\".$(DLL_SUFFIX)\"
!endif
#JAVA_CLASSPATH = $(JAVA_CLASSPATH:/=\)
JMCSRCDIR = $(JMCSRCDIR:/=\)
JAVA_BOOT_CLASSPATH = $(JAVA_BOOT_CLASSPATH:/=\)
NMAKE=nmake -nologo -$(MAKEFLAGS)
########
# Get the cwd to prepend to all compiled source
# files. Will allow debugger to automatically find sources
# instead of asking for the path info.
# Win16 will break if enabled, guess we continue to live in pain
# therein.
########
!if "$(MOZ_BITS)" == "32"
CURDIR=$(MAKEDIR)^\
!endif
!endif # CONFIG_CONFIG_MAK

541
mozilla/config/config.mk Normal file
View File

@@ -0,0 +1,541 @@
#
# 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.mk
#
# Determines the platform and builds the macros needed to load the
# appropriate platform-specific .mk file, then defines all (most?)
# of the generic macros.
#
# This wastes time.
include $(DEPTH)/config/common.mk
#
# Important internal static macros
#
OS_ARCH := $(subst /,_,$(shell uname -s))
OS_RELEASE := $(shell uname -r)
OS_TEST := $(shell uname -m)
#
# Tweak the default OS_ARCH and OS_RELEASE macros as needed.
#
ifeq ($(OS_ARCH),AIX)
OS_RELEASE := $(shell uname -v).$(shell uname -r)
endif
ifeq ($(OS_ARCH),BSD_386)
OS_ARCH := BSD_OS
endif
ifeq ($(OS_ARCH),IRIX64)
OS_ARCH := IRIX
endif
ifeq ($(OS_ARCH),UNIX_SV)
ifneq ($(findstring NCR,$(shell grep NCR /etc/bcheckrc | head -1 )),)
OS_ARCH := NCR
else
OS_ARCH := UNIXWARE
OS_RELEASE := $(shell uname -v)
endif
endif
ifeq ($(OS_ARCH),ncr)
OS_ARCH := NCR
endif
# This is the only way to correctly determine the actual OS version on NCR boxes.
ifeq ($(OS_ARCH),NCR)
OS_RELEASE := $(shell awk '{print $$3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$$/\2.\3/')
endif
ifeq ($(OS_ARCH),UNIX_System_V)
OS_ARCH := NEC
endif
ifeq ($(OS_ARCH),SCO_SV)
OS_ARCH := SCOOS
OS_RELEASE := 5.0
endif
ifeq ($(OS_ARCH),SINIX-N)
OS_ARCH := SINIX
endif
# SINIX changes name to ReliantUNIX with 5.43
ifeq ($(OS_ARCH),ReliantUNIX-N)
OS_ARCH := SINIX
endif
ifeq ($(OS_ARCH),UnixWare)
OS_ARCH := UNIXWARE
endif
ifeq ($(OS_ARCH),OS_2)
OS_ARCH := OS2
OS_RELEASE := 4.0
endif
#
# Strip off the excessively long version numbers on these platforms,
# but save the version to allow multiple versions of the same base
# platform to be built in the same tree.
#
ifneq (,$(filter FreeBSD HP-UX IRIX Linux OSF1 SunOS,$(OS_ARCH)))
OS_VERS := $(suffix $(OS_RELEASE))
OS_RELEASE := $(basename $(OS_RELEASE))
OS_VERSION := $(shell echo $(OS_VERS) | sed 's/-.*//')
endif
OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
#
# Personal makefile customizations go in these optional make include files.
#
MY_CONFIG := $(DEPTH)/config/myconfig.mk
MY_RULES := $(DEPTH)/config/myrules.mk
#
# Relative pathname from top-of-tree to current source directory
#
ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
REVDEPTH := $(DEPTH)/config/revdepth
SRCDIR = $(shell $(PERL) $(REVDEPTH).pl $(DEPTH))
endif
#
# Define an include-at-most-once flag
#
NS_CONFIG_MK = 1
#
# Provide the means to easily override our tool directory locations.
#
ifdef NETSCAPE_HIERARCHY
CONTRIB_BIN := /tools/contrib/bin/
JAVA_BIN := /usr/local/java/bin/
LOCAL_BIN := /usr/local/bin/
LOCAL_SUN4 := /usr/local/sun4/bin/
NS_BIN := /tools/ns/bin/
NS_LIB := /tools/ns/lib
JAVA_LIB := /usr/local/netscape/java/lib
XFEPRIVDIR := $(DEPTH)/../ns_priv/xfe/
else
NS_LIB := .
JAVA_LIB := .
endif
#
# Default command macros; can be overridden in <arch>.mk.
#
AS = $(CC)
ASFLAGS = $(CFLAGS)
BSDECHO = echo
CC = gcc
CCC = g++
CCF = $(CC) $(CFLAGS)
LINK_EXE = $(LINK) $(OS_LFLAGS) $(LFLAGS)
LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
NFSPWD = $(DEPTH)/config/nfspwd
PURIFY = purify $(PURIFYOPTIONS)
QUANTIFY = quantify $(QUANTIFYOPTIONS)
RANLIB = /bin/true
SDKINSTALL = $(NSINSTALL) -t
UNZIP_PROG = $(LOCAL_BIN)/unzip
ZIP_PROG = $(LOCAL_BIN)/zip
ZIP_FLAGS = -0rq
ifeq ($(OS_ARCH),OS2)
EMPTY :=
SLASH := /$(EMPTY)
BSLASH := \$(EMPTY)
SEMICOLON := ;$(EMPTY)
SPACE := $(EMPTY) $(EMPTY)
PATH_SEPARATOR := \;
XP_DEFINE = -DXP_PC
LIB_SUFFIX = lib
DLL_SUFFIX = dll
MAP_SUFFIX = map
BIN_SUFFIX = .exe
NSINSTALL = nsinstall
INSTALL = $(NSINSTALL)
JAVAC_ZIP = $(subst $(BSLASH),$(SLASH),$(JAVA_HOME))/lib/classes.zip
else
ifeq ($(OS_ARCH),WINNT)
PATH_SEPARATOR := :
RC = rc$(BIN_SUFFIX)
XP_DEFINE = -DXP_PC
LIB_SUFFIX = lib
DLL_SUFFIX = dll
BIN_SUFFIX = .exe
AR = lib -NOLOGO -OUT:"$@"
DLLFLAGS = $(XLFLAGS) -OUT:"$@"
LFLAGS = $(OBJS) $(DEPLIBS) $(EXTRA_LIBS) -OUT:"$@"
NSINSTALL = nsinstall
INSTALL = $(NSINSTALL)
JAVA_PROG = java
else
PATH_SEPARATOR := :
XP_DEFINE = -DXP_UNIX
AR = ar cr $@
DLL_SUFFIX = so
LIB_SUFFIX = a
ifeq ($(AWT_11),1)
JAVA_PROG = $(NS_BIN)java
JAVAC_ZIP = $(NS_LIB)/classes.zip
else
JAVA_PROG = $(LOCAL_BIN)java
JAVAC_ZIP = $(JAVA_LIB)/javac.zip
endif
PERL = $(NS_BIN)perl
TAR = tar
EMACS = xemacs
WHOAMI = /usr/bin/whoami
endif
endif
#
# Debug by default.
#
OBJDIR_TAG = _DBG
OPTIMIZER = -g
JAVA_OPTIMIZER = -g
XBCFLAGS = -FR$*
XCFLAGS = $(LCFLAGS)
XLFLAGS = $(LLFLAGS)
ifeq ($(OS_ARCH),WINNT)
OPTIMIZER = -Od -Z7
JAVA_OPTIMIZER = $(OPTIMIZER)
XLFLAGS += -DEBUG
else
DEFINES = -DDEBUG -UNDEBUG -DDEBUG_$(shell $(WHOAMI)) -DTRACING
endif
ifdef BUILD_OPT
OBJDIR_TAG = _OPT
XBCFLAGS =
ifeq ($(OS_ARCH),WINNT)
OPTIMIZER = -O2
else
OPTIMIZER = -O
DEFINES = -UDEBUG -DNDEBUG -DTRIMMED
endif
endif
#
# XXX For now, we're including $(DEPTH)/include directly instead of
# getting this stuff from dist. This stuff is old and will eventually
# be put in the library directories where it belongs so that it can
# get exported to dist properly.
#
INCLUDES = $(LOCAL_PREINCLUDES) $(MODULE_PREINCLUDES) -I$(DEPTH)/include $(LOCAL_INCLUDES) $(OS_INCLUDES)
LIBNT = $(DIST)/lib/libnt.$(LIB_SUFFIX)
LIBAWT = $(DIST)/lib/libawt.$(LIB_SUFFIX)
LIBMMEDIA = $(DIST)/lib/libmmedia.$(LIB_SUFFIX)
#
# NSPR 2.0 is now the default, "setenv NSPR10 1" to go back to 1.0
#
ifndef NSPR10
NSPR20 = 1
NSPRDIR = nsprpub
DEFINES += -DNSPR20
INCLUDES += -I$(DIST)/include
LIBNSPR = $(DIST)/lib/libplds21.$(LIB_SUFFIX) \
$(DIST)/lib/libmsgc21.$(LIB_SUFFIX) \
$(DIST)/lib/libnspr21.$(LIB_SUFFIX)
PURELIBNSPR = $(DIST)/lib/purelibplds21.$(LIB_SUFFIX) \
$(DIST)/lib/purelibmsgc21.$(LIB_SUFFIX) \
$(DIST)/lib/purelibnspr21.$(LIB_SUFFIX)
else
NSPRDIR = nspr
LIBNSPR = $(DIST)/lib/libnspr.$(LIB_SUFFIX)
PURELIBNSPR = $(DIST)/lib/libpurenspr.$(LIB_SUFFIX)
endif
ifdef DBMALLOC
LIBNSPR += $(DIST)/lib/libdbmalloc.$(LIB_SUFFIX)
endif
ifeq ($(OS_ARCH),OS2)
LIBNSJAVA = $(DIST)/lib/jrt$(MOZ_BITS)$(VERSION_NUMBER).$(LIB_SUFFIX)
LIBMD = $(DIST)/lib/libjmd.$(LIB_SUFFIX)
LIBJAVA = $(DIST)/lib/libjrt.$(LIB_SUFFIX)
LIBNSPR = $(DIST)/lib/pr$(MOZ_BITS)$(VERSION_NUMBER).$(LIB_SUFFIX)
LIBXP = $(DIST)/lib/libxp.$(LIB_SUFFIX)
else
ifeq ($(OS_ARCH),WINNT)
LIBNSJAVA = $(DIST)/lib/jrt3221.$(LIB_SUFFIX)
else
LIBNSJAVA = $(DIST)/lib/nsjava32.$(LIB_SUFFIX)
endif
endif
CFLAGS = $(XP_DEFINE) $(OPTIMIZER) $(OS_CFLAGS) $(MDUPDATE_FLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROF_FLAGS)
NOMD_CFLAGS = $(XP_DEFINE) $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS)
#
# Include the binary distrib stuff, if necessary.
#
ifdef NS_BUILD_CORE
include $(DEPTH)/config/coreconf.mk
endif
#
# Now include the platform-specific stuff.
#
include $(DEPTH)/config/$(OS_ARCH).mk
#
# Some platforms (Solaris) might require builds using either
# (or both) compiler(s).
#
ifdef SHOW_CC_TYPE
COMPILER = _$(notdir $(CC))
endif
#
# Name of the binary code directories
#
ifeq ($(OS_ARCH)_$(PROCESSOR_ARCHITECTURE),WINNT_x86)
OBJDIR_NAME = $(OS_CONFIG)$(OS_VERSION)$(OBJDIR_TAG).OBJ
else
OBJDIR_NAME = $(OS_CONFIG)$(OS_VERSION)$(PROCESSOR_ARCHITECTURE)$(COMPILER)$(IMPL_STRATEGY)$(OBJDIR_TAG).OBJ
endif
# Figure out where the binary code lives. It either lives in the src
# tree (NSBUILDROOT is undefined) or somewhere else.
ifdef NSBUILDROOT
BUILD = $(NSBUILDROOT)/$(OBJDIR_NAME)/build
OBJDIR = $(BUILD)/$(SRCDIR)
XPDIST = $(NSBUILDROOT)
DIST = $(NSBUILDROOT)/$(OBJDIR_NAME)/dist
else
BUILD = $(OBJDIR_NAME)
OBJDIR = $(OBJDIR_NAME)
XPDIST = $(DEPTH)/dist
DIST = $(DEPTH)/dist/$(OBJDIR_NAME)
endif
# all public include files go in subdirectories of PUBLIC:
PUBLIC = $(XPDIST)/public
VPATH = $(OBJDIR)
DEPENDENCIES = $(OBJDIR)/.md
ifneq ($(OS_ARCH),WINNT)
MKDEPEND_DIR = $(DEPTH)/config/mkdepend
MKDEPEND = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend
MKDEPENDENCIES = $(OBJDIR)/depend.mk
endif
#
# Include any personal overrides the user might think are needed.
#
-include $(MY_CONFIG)
######################################################################
# Now test variables that might have been set or overridden by $(MY_CONFIG).
DEFINES += -DNETSCAPE -DOSTYPE=\"$(OS_CONFIG)\"
# Specify that we are building a client.
# This will instruct the cross platform libraries to
# include all the client specific cruft.
ifdef SERVER_BUILD
DEFINES += -DSERVER_BUILD
ifdef LIVEWIRE
DEFINES += -DLIVEWIRE
endif
STATIC_JAVA = yes
else
MOZILLA_CLIENT = 1
DEFINES += -DMOZILLA_CLIENT
endif
ifdef MOZ_LITE
NO_EDITOR = 1
NO_UNIX_LDAP = 1
MOZ_JSD = 1
MOZ_NAV_BUILD_PREFIX = 1
endif
ifdef MOZ_MEDIUM
DEFINES += -DNO_SECURITY -DEDITOR -DMOZ_COMMUNICATOR_IIDS
EDITOR = 1
MOZ_JSD = 1
MOZ_COMMUNICATOR_IIDS = 1
MOZ_COMMUNICATOR_CONFIG_JS = 1
MOZ_COPY_ALL_JARS = 1
NO_SECURITY = 1
endif
ifdef MOZ_GOLD
DEFINES += -DGOLD
BUILD_GOLD = 1
endif
ifdef EDITOR
DEFINES += -DEDITOR -DEDITOR_UI
BUILD_EDITOR = 1
BUILD_EDITOR_UI = 1
BUILD_EDT = 1
endif
# Build layers by default
ifndef NO_LAYERS
DEFINES += -DLAYERS
endif
ifdef BUILD_DEBUG_GC
DEFINES += -DDEBUG_GC
endif
ifdef BUILD_UNIX_PLUGINS
# UNIX_EMBED Should not be needed. For now these two defines go
# together until I talk with jg. --dp
DEFINES += -DUNIX_EMBED -DX_PLUGINS
endif
ifndef NO_UNIX_LDAP
DEFINES += -DUNIX_LDAP
endif
#
# Platform dependent switching off of NSPR, JAVA and MOCHA
#
ifndef NO_NSPR
DEFINES += -DNSPR
endif
ifdef MOZ_JAVA
DEFINES += -DJAVA
endif
ifndef NO_MOCHA
DEFINES += -DMOCHA
endif
ifdef FORTEZZA
DEFINES += -DFORTEZZA
endif
ifdef UNIX_SKIP_ASSERTS
DEFINES += -DUNIX_SKIP_ASSERTS
endif
ifdef SHACK
DEFINES += -DSHACK
endif
ifndef NO_UNIX_ASYNC_DNS
DEFINES += -DUNIX_ASYNC_DNS
endif
# For profiling
ifdef MOZILLA_GPROF
# Don't want profiling on build tools..
ifneq ($(SRCDIR),config)
PROF_FLAGS = $(OS_GPROF_FLAGS) -DMOZILLA_GPROF
endif
endif
# This compiles in heap dumping utilities and other good stuff
# for developers -- maybe we only want it in for a special SDK
# nspr/java runtime(?):
DEFINES += -DDEVELOPER_DEBUG
######################################################################
GARBAGE = $(DEPENDENCIES) core $(wildcard core.[0-9]*)
ifndef SDK
SDK = $(DEPTH)/dist/sdk
endif
ifneq ($(OS_ARCH),WINNT)
NSINSTALL = $(DEPTH)/config/$(OBJDIR_NAME)/nsinstall
ifeq ($(NSDISTMODE),copy)
# copy files, but preserve source mtime
INSTALL = $(NSINSTALL) -t
else
ifeq ($(NSDISTMODE),absolute_symlink)
# install using absolute symbolic links
INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
else
# install using relative symbolic links
INSTALL = $(NSINSTALL) -R
endif
endif
endif
######################################################################
### Java Stuff - see common.mk
######################################################################
# where the bytecode will go
JAVA_DESTPATH = $(XPDIST)/classes
# where the sources for the module you are compiling are
# default is sun-java/classsrc, override for other modules
ifndef JAVA_SOURCEPATH
JAVA_SOURCEPATH = $(DEPTH)/sun-java/classsrc
endif
ifndef JAVAH_IN_JAVA
ifeq ($(OS_ARCH),OS2)
JAVAH_PROG = flipper $(DIST)/bin/javah
else
JAVAH_PROG = $(DIST)/bin/javah
endif
else
JAVAH_PROG = $(JAVA) netscape.tools.jric.Main
endif
ifeq ($(STAND_ALONE_JAVA),1)
STAND_ALONE_JAVA_DLL_SUFFIX = s
endif
ifeq ($(OS_ARCH),OS2)
AWTDLL = awt$(MOZ_BITS)$(VERSION_NUMBER).$(DLL_SUFFIX)
AWTSDLL = awt$(MOZ_BITS)$(VERSION_NUMBER)$(STAND_ALONE_JAVA_DLL_SUFFIX).$(DLL_SUFFIX)
CONDLL = con.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JBNDLL = jbn.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JDBCDLL = jdb.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JITDLL = jit.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JPWDLL = jpw.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
JRTDLL = jrt$(MOZ_BITS)$(VERSION_NUMBER).$(DLL_SUFFIX)
JSJDLL = jsj.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
MMDLL = mm$(MOZ_BITS)$(VERSION_NUMBER).$(DLL_SUFFIX)
NETDLL = net.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
NSCDLL = nsc.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
ZIPDLL = zip.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
ZPWDLL = zpw.$(MOZ_BITS)$(VERSION_NUMBER)(DLL_SUFFIX)
else
AWTDLL = libawt.$(DLL_SUFFIX)
AWTSDLL = libawt$(STAND_ALONE_JAVA_DLL_SUFFIX).$(DLL_SUFFIX)
CONDLL = libcon.$(DLL_SUFFIX)
JBNDLL = libjbn.$(DLL_SUFFIX)
JDBCDLL = libjdb.$(DLL_SUFFIX)
JITDLL = libjit.$(DLL_SUFFIX)
JPWDLL = libjpw.$(DLL_SUFFIX)
JRTDLL = libjrt.$(DLL_SUFFIX)
JSJDLL = libjsj.$(DLL_SUFFIX)
MMDLL = libmm.$(DLL_SUFFIX)
NETDLL = libnet.$(DLL_SUFFIX)
NSCDLL = libnsc.$(DLL_SUFFIX)
ZIPDLL = libzip.$(DLL_SUFFIX)
ZPWDLL = libzpw.$(DLL_SUFFIX)
endif
JAVA_DEFINES += -DAWTSDLL=\"$(AWTSDLL)\" -DCONDLL=\"$(CONDLL)\" -DJBNDLL=\"$(JBNDLL)\" -DJDBDLL=\"$(JDBDLL)\" \
-DJSJDLL=\"$(JSJDLL)\" -DNETDLL=\"$(NETDLL)\" -DNSCDLL=\"$(NSCDLL)\" -DZPWDLL=\"$(ZPWDLL)\"

View File

@@ -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.
#
#
# coreconf.mk
#
# Defines the macro definitions for the modules that do binary
# distributions into /m/dist.
#
#
# Are we building the client?
#
ifndef SERVER_BUILD
ifeq ($(OS_ARCH),SunOS)
IMPL_STRATEGY = _LOCAL
else
IMPL_STRATEGY = _CLASSIC
else
ifeq ($(PTHREADS_USER),1)
USE_PTHREADS =
IMPL_STRATEGY = _PTH_USER
endif
ifeq ($(USE_PTHREADS),1)
IMPL_STRATEGY = _PTH
endif
endif

25
mozilla/config/cvsco.pl Executable file
View File

@@ -0,0 +1,25 @@
#!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.
#
chdir($ENV{'MOZ_SRC'});
$cmd = "cvs -q co ".$ARGV[0]." ".$ARGV[1];
print "Excecuting ".$cmd."...\n";
system($cmd);

90
mozilla/config/dll.inc Normal file
View File

@@ -0,0 +1,90 @@
# 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.
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build 16 and 32 bit
#// DLLs.
#//
#//------------------------------------------------------------------------
!if defined(DLL) && !defined(CONFIG_DLL_INC)
CONFIG_DLL_INC=1
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#//
#// Rule to build a 16-bit DLL using the DLL target
#//
#//------------------------------------------------------------------------
$(DLL): $(OBJDIR) $(OBJS) $(RESFILE) $(DEFFILE) $(MISCDEP)
echo +++ make: Creating DLL: $@
# //
# // create response file for the command. The format is:
# // Object files, Output file, Map file, Libraries, DEF file, RES file
# //
echo $(LFLAGS) > $(CFGFILE)
echo /implib:$*.lib >> $(CFGFILE)
for %%d in ($(OBJS)) do echo %%d + >> $(CFGFILE)
echo. >> $(CFGFILE)
echo $(OBJDIR)\$(*B).dll, >> $(CFGFILE)
!ifdef MAPFILE
echo $(MAPFILE), >> $(CFGFILE)
!endif
echo $(LLIBS) $(OS_LIBS) >> $(CFGFILE)
!ifdef DEFFILE
echo $(DEFFILE), >> $(CFGFILE)
!else
echo. >> $(CFGFILE)
!endif
!ifdef RESFILE
echo $(RESFILE), >> $(CFGFILE)
!else
echo. >> $(CFGFILE)
!endif
# //
# // execute the commands
# //
$(LD) @$(CFGFILE)
!else
#//------------------------------------------------------------------------
#//
#// Rule to build a 32-bit DLL using the DLL target
#//
#//------------------------------------------------------------------------
$(DLL): $(OBJDIR) $(OBJS) $(RESFILE) $(DEFFILE) $(MISCDEP)
echo +++ make: Creating DLL: $@
$(LD) @<<$(CFGFILE)
/NOLOGO /DLL /OUT:$@
/PDB:$(PDBFILE)
!ifdef DEFFILE
/DEF:$(DEFFILE)
!endif
!ifdef MAPFILE
/MAP:$(MAPFILE)
!endif
$(LFLAGS)
$(OBJS)
$(RESFILE)
$(LLIBS) $(OS_LIBS)
<<KEEP
!endif
!endif # DLL && ! CONFIG_DLL_INC

87
mozilla/config/exe.inc Normal file
View File

@@ -0,0 +1,87 @@
# 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.
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build 16 and 32 bit
#// executables.
#//
#//------------------------------------------------------------------------
!if defined(PROGRAM) && !defined(CONFIG_EXE_INC)
CONFIG_EXE_INC=1
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#//
#// Rule to build a 16-bit executable using the PROGRAM target
#//
#//------------------------------------------------------------------------
$(PROGRAM):: $(OBJDIR) $(OBJS) $(RESFILE) $(DEFFILE) $(MISCDEP)
echo +++ make: Creating EXE: $@
# //
# // create response file for the command. The format is:
# // Object files, Output file, Map file, Libraries, DEF file, RES file
# //
echo $(LFLAGS) > $(CFGFILE)
for %%d in ($(OBJS)) do echo %%d + >> $(CFGFILE)
echo. >> $(CFGFILE)
echo $(OBJDIR)\$(*B).exe, >> $(CFGFILE)
echo $(MAPFILE), >> $(CFGFILE)
echo $(LLIBS) $(OS_LIBS) >> $(CFGFILE)
!ifdef DEFFILE
echo $(DEFFILE), >> $(CFGFILE)
!else
echo. >> $(CFGFILE)
!endif
!ifdef RESFILE
echo $(RESFILE), >> $(CFGFILE)
!else
echo. >> $(CFGFILE)
!endif
# //
# // execute the command
# //
$(LD) /ST:8192 @$(CFGFILE)
!else
#//------------------------------------------------------------------------
#//
#// Rule to build a 32-bit executable using the PROGRAM target
#//
#//------------------------------------------------------------------------
$(PROGRAM):: $(OBJDIR) $(OBJS) $(RESFILE) $(DEFFILE) $(MISCDEP)
echo +++ make: Creating EXE: $@
$(LD) @<<$(CFGFILE)
/NOLOGO /OUT:$@
/PDB:$(PDBFILE)
!ifdef DEFFILE
/DEF:$(DEFFILE)
!endif
!ifdef MAPFILE
/MAP:$(MAPFILE)
!endif
$(LFLAGS)
$(OBJS)
$(RESFILE)
$(LLIBS) $(OS_LIBS)
<<
!endif
!endif # PROGRAM && ! CONFIG_EXE_INC

53
mozilla/config/fastcwd.pl Normal file
View File

@@ -0,0 +1,53 @@
#!perl5
#
# 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.
#
# By John Bazik
#
# Usage: $cwd = &fastcwd;
#
# This is a faster version of getcwd. It's also more dangerous because
# you might chdir out of a directory that you can't chdir back into.
#
sub fastcwd {
local($odev, $oino, $cdev, $cino, $tdev, $tino);
local(@path, $path);
local(*DIR);
($cdev, $cino) = stat('.');
for (;;) {
($odev, $oino) = ($cdev, $cino);
chdir('..');
($cdev, $cino) = stat('.');
last if $odev == $cdev && $oino == $cino;
opendir(DIR, '.');
for (;;) {
$_ = readdir(DIR);
next if $_ eq '.';
next if $_ eq '..';
last unless $_;
($tdev, $tino) = lstat($_);
last unless $tdev != $odev || $tino != $oino;
}
closedir(DIR);
unshift(@path, $_);
}
chdir($path = '/' . join('/', @path));
$path;
}
1;

2730
mozilla/config/gtscc.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
@echo off
rem The contents of this file are subject to the Netscape Public License
rem Version 1.0 (the "NPL"); you may not use this file except in
rem compliance with the NPL. You may obtain a copy of the NPL at
rem http://www.mozilla.org/NPL/
rem
rem Software distributed under the NPL is distributed on an "AS IS" basis,
rem WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
rem for the specific language governing rights and limitations under the
rem NPL.
rem
rem The Initial Developer of this code under the NPL is Netscape
rem Communications Corporation. Portions created by Netscape are
rem Copyright (C) 1998 Netscape Communications Corporation. All Rights
rem Reserved.
@echo on
@if not exist %2\nul mkdir %2
@rm -f %2\%1
@cp %1 %2

201
mozilla/config/java.inc Normal file
View File

@@ -0,0 +1,201 @@
# 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.
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build Java Header
#// and Stub files
#//
#//------------------------------------------------------------------------
!if !defined(CONFIG_JAVA_INC)
CONFIG_JAVA_INC=1
#//------------------------------------------------------------------------
#// Setup to generate Mac java headers (checkout ns/lib/mac/Java
#//------------------------------------------------------------------------
!ifdef MOZ_GENMAC
MAC_JAVA_HEADERS_DIR = $(DEPTH)/lib/mac/Java
#//------------------------------------------------------------------------
#// Figure out how to do the pull.
#//------------------------------------------------------------------------
!if "$(MOZ_BRANCH)" != ""
CVS_BRANCH=-r $(MOZ_BRANCH)
HAVE_BRANCH=1
!else
HAVE_BRANCH=0
!endif
!if "$(MOZ_TIP)" != ""
CVS_BRANCH=-A
!endif
!if "$(MOZ_DATE)" != ""
CVS_BRANCH=-D "$(MOZ_DATE)"
HAVE_DATE=1
!else
HAVE_DATE=0
!endif
!if $(HAVE_DATE) && $(HAVE_BRANCH)
ERR_MESSAGE=$(ERR_MESSAGE)^
Cannot specify both MOZ_BRANCH and MOZ_DATE
!endif
$(MAC_JAVA_HEADERS_DIR):
@echo +++ Checking out $(MAC_JAVA_HEADERS_DIR) +++
$(PERL) $(DEPTH)/config/cvsco.pl $(CVS_BRANCH) ns/lib/mac/Java
@echo +++ Done Checking out $(MAC_JAVA_HEADERS_DIR) +++
!endif
!ifdef JDK_GEN
!ifdef MOZ_JAVA
#//------------------------------------------------------------------------
#//
#// Rule to generate Java header files using javah.
#//
#//------------------------------------------------------------------------
$(JDK_GEN):: display_java_header_msg
!$(JAVAH) -d _gen $@
!ifdef NSBUILDROOT
LINCS = $(LINCS) -I$(JDK_GEN_DIR) -I$(XPDIST)
!else
LINCS = $(LINCS) -I$(JDK_GEN_DIR)
!endif
display_java_header_msg:
echo +++ make: Generating java header files...
!ifdef MOZ_GENMAC
$(JDK_GEN)::display_java_header_msg_mac $(MAC_JAVA_HEADERS_DIR)
echo +++ make: creating JDK header for $@
!$(JAVAH) -mac -d $(MAC_JAVA_HEADERS_DIR)/_gen $@
display_java_header_msg_mac:
echo +++ make: Generating Macintosh JDK header files +++
!endif
!endif # MOZ_JAVA
!endif
!ifdef JDK_GEN
!ifdef MOZ_JAVA
#//------------------------------------------------------------------------
#//
#// Rules to generate Java stub files using javah.
#//
#//------------------------------------------------------------------------
$(JDK_GEN)::display_java_stub_msg
!$(JAVAH) -stubs -d _stubs $@
display_java_stub_msg:
echo +++ make: Generating java stub files...
!ifdef MOZ_GENMAC
$(JDK_GEN)::display_java_stub_msg_mac $(MAC_JAVA_HEADERS_DIR)
echo +++ make: creating JDK stub for $@
!$(JAVAH) -mac -stubs -d $(MAC_JAVA_HEADERS_DIR)/_stubs $@
display_java_stub_msg_mac:
echo +++ make: Generating Macintosh JDK stub files +++
!endif
export:: $(JDK_GEN)
!endif # MOZ_JAVA
!endif
!ifdef JAVA_LIBSTUB_FILES
!ifdef MOZ_JAVA
#//------------------------------------------------------------------------
#//
#// Rules to generate libstubs.c using javah.
#//
#//------------------------------------------------------------------------
libstubs.c::$(JAVA_LIBSTUB_FILES)
echo +++ make: Generating libstubs.c...
$(JAVAH) -o libstubs.c -stubs $**
stubs$(MOZ_BITS).c::$(JAVA_LIBSTUB_FILES)
echo +++ make: Generating stubs$(MOZ_BITS).c...
$(JAVAH) -o stubs$(MOZ_BITS).c -stubs $**
!endif # MOZ_JAVA
!endif
!ifdef JRI_GEN
!ifdef MOZ_JAVA
#//------------------------------------------------------------------------
#//
#// Rule to generate JRI header files using javah.
#//
#//------------------------------------------------------------------------
$(JRI_GEN):: display_jri_header_msg
!$(JAVAH) -jri -d _jri $@
!ifdef NSBUILDROOT
LINCS = $(LINCS) -I$(JRI_GEN_DIR) -I$(XPDIST)
!else
LINCS = $(LINCS) -I$(JRI_GEN_DIR)
!endif
display_jri_header_msg:
echo +++ make: Generating JRI header files...
!ifdef MOZ_GENMAC
$(JRI_GEN)::display_jri_header_msg_mac $(MAC_JAVA_HEADERS_DIR)
echo +++ make: creating JRI header for $@
!$(JAVAH) -mac -jri -d $(MAC_JAVA_HEADERS_DIR)/_jri $@
display_jri_header_msg_mac:
echo +++ make: Generating Macintosh java JRI header files +++
!endif
!endif # MOZ_JAVA
!endif
!ifdef JRI_GEN
!ifdef MOZ_JAVA
#//------------------------------------------------------------------------
#//
#// Rules to generate JRI stub files using javah.
#//
#//------------------------------------------------------------------------
$(JRI_GEN)::display_jri_stub_msg
!$(JAVAH) -stubs -jri -d _jri $@
display_jri_stub_msg:
echo +++ make: Generating JRI stub files...
!ifdef MOZ_GENMAC
$(JRI_GEN)::display_jri_stub_msg_mac $(MAC_JAVA_HEADERS_DIR)
echo +++ make: creating JRI stub for $@
!$(JAVAH) -mac -jri -stubs -d $(MAC_JAVA_HEADERS_DIR)/_jri $@
display_jri_stub_msg_mac:
echo +++ make: Generating Macintosh java JRI stub files +++
!endif
export:: $(JRI_GEN)
!endif # MOZ_JAVA
!endif
!endif # CONFIG_JAVA_INC

67
mozilla/config/lib.inc Normal file
View File

@@ -0,0 +1,67 @@
# 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.
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build 16 and 32 bit
#// libraries.
#//
#//------------------------------------------------------------------------
!if defined(LIBRARY) && !defined(CONFIG_LIB_INC)
CONFIG_LIB_INC=1
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#//
#// Rule to build a 16-bit Library
#//
#//------------------------------------------------------------------------
$(LIBRARY):: $(OBJDIR) $(OBJS)
# //
# // create response file for the command. The format is:
# // LIBNAME, -+foo.obj -+bar.obj , LISTFILE, NEWLIB
# //
rm -f $(CFGFILE)
!if "$(OS)" == "Windows_NT"
for %%d in ($(OBJS)) do echo -+%%d ^& >> $(CFGFILE)
!else
for %%d in ($(OBJS)) do echo -+%%d & >> $(CFGFILE)
!endif
echo * >> $(CFGFILE)
# //
# // execute the commands
# //
$(RM) $@
$(AR) $@ @$(CFGFILE)
$(RANLIB) $@
!else
#//------------------------------------------------------------------------
#//
#// Rule to build a 32-bit Library
#//
#//------------------------------------------------------------------------
$(LIBRARY):: $(OBJDIR) $(OBJS)
$(RM) $@ 2> NUL
$(AR) @<<$(CFGFILE)
-NOLOGO -OUT:$@
$(OBJS)
<<
$(RANLIB) $@
!endif
!endif # LIBRARY && ! CONFIG_LIB_INC

154
mozilla/config/liteness.mak Normal file
View File

@@ -0,0 +1,154 @@
# 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.
################################################################################
#
# MOZ_LITE and MOZ_MEDIUM stuff
#
# Does two things 1) Sets environment variables for use by other build scripts.
# 2) Sets MOZ_LITENESS_FLAGS to be appended to the command lines
# for calling the compilers/tools, CFLAGS, RCFLAGS, etc.
#
################################################################################
# Under the new system for MOZ_LITE, MOZ_MEDIUM. There should be no references to
# MOZ_LITE or MOZ_MEDIUM in the code, either as an #ifdef, or as some other conditional
# if in the build scripts. Instead, all #ifdefs, !if, etc. should be based on the
# module-specific tag. E.g. #ifdef MOZ_MAIL_NEWS, #ifdef MOZ_LDAP, etc.
# The reason for this is that we can decide what goes into the LITE and MEDIUM
# builds by just tweaking this file (and the appropriate file for MAC and UNIX).
#
# Originally, I planned on defining MOZ_MEDIUM as being the same as MOZ_LITE + EDITOR,
# but there were still many cases in the code and build scripts where I would have had
# to do something ugly like "#if !defined(MOZ_LITE) || defined(MOZ_MEDIUM)". This
# would be very error prone and difficult to maintain. I believe defining and
# using a bunch of new symbols reduces the total amount of pain in both the short and
# long term.
#
# IMPORTANT!! The method of running a build has not changed. You define
# MOZ_LITE or MOZ_MEDIUM (not both) in your environment, and start the build.
# You do not have to define the symbols for every module. E.g. you should never
# have to define EDITOR, or MOZ_MAIL_NEWS in your environment. The build scripts
# will do this for you, via the file you are looking at right now.
### Here is the list of all possible modules under control of MOZ_LITE/MOZ_MEDIUM,
### Some only affect the build scripts, so are only set as environment variables, and
### not added to MOZ_LITENESS_FLAGS
#
# MOZ_MAIL_NEWS
# Enables mail and news.
#
# EDITOR
# Enables the editor
#
# MOZ_OFFLINE
# Enables go offline/go online
#
# MOZ_LOC_INDEP
# Location independence
#
# MOZ_TASKBAR
# The "taskbar" or "component bar"
#
# MOZ_LDAP
# Enable LDAP, MOZ_NO_LDAP has been depreciated
#
# MOZ_ADMIN_LIB
# Mission Control
#
# MOZ_COMMUNICATOR_NAME
# Use "Communicator" as opposed to "Navigator" in strings,
# Use the Communicator icon, splash screen, etc. instead of the Navigator one.
# *** IMPORTANT *** This also controls whether the user agent string has " ;Nav"
# appended to it. i.e. only append " ;Nav" if MOZ_COMMUNICATOR_NAME is not set.
#
# MOZ_JSD
# Build JS debug code, needs to be turned off when we remove java from build.
#
# MOZ_IFC_TOOLS
# Build ns/ifc/tools. Should this be the same as MOZ_JSD??
#
# MOZ_NETCAST
# Build netcaster.
#
# MOZ_COMMUNICATOR_IIDS
# For windows, use the COM IIDs for Communicator, as opposed to those for the
# Navigator-only version. We must have a different set so that multiple versions can
# be installed on the same machine. We need a more general solution to the problem of
# multiple versions of the interface IDs.
#
# MOZ_COMMUNICATOR_ABOUT
# Use the about: information from Communicator, as opposed to that for the Navigator-only
# version. We will probably have to make another one for the source-only release.
#
# MOZ_NAV_BUILD_PREFIX
# For building multiple versions with varying degree of LITEness in the same tree.
# If true, use "Nav" as the prefix for the directory under ns/dist, else use "WIN".
# Also, if true, build client in, say, NavDbg as oppposed to x86Dbg.
#
# MOZ_COMMUNICATOR_CONFIG_JS
# Use "config.js" instead of the one specific to the Navigator-only version.
#
# MOZ_COPY_ALL_JARS
# Copy all JAR files to the destination directory, else just copy the JARS appropriate for the
# Navigator-only version.
#
# MOZ_SPELLCHK
# Enable the spellchecker.
### MOZ_LITE ###
# NOTE: Doesn't need -DMOZ_LITE anymore.
!if defined(MOZ_LITE)
MOZ_LITENESS_FLAGS=
MOZ_JSD=1
MOZ_NAV_BUILD_PREFIX=1
### MOZ_MEDIUM ###
!elseif defined(MOZ_MEDIUM)
MOZ_LITENESS_FLAGS=-DEDITOR -DMOZ_COMMUNICATOR_IIDS
EDITOR=1
MOZ_JSD=1
MOZ_COMMUNICATOR_IIDS=1
MOZ_COMMUNICATOR_CONFIG_JS=1
MOZ_COPY_ALL_JARS=1
### Full build ###
!else
MOZ_LITENESS_FLAGS=-DMOZ_MAIL_NEWS -DEDITOR -DMOZ_OFFLINE -DMOZ_LOC_INDEP \
-DMOZ_TASKBAR -DMOZ_LDAP -DMOZ_ADMIN_LIB \
-DMOZ_COMMUNICATOR_NAME -DMOZ_COMMUNICATOR_IIDS \
-DMOZ_NETCAST -DMOZ_COMMUNICATOR_ABOUT -DMOZ_SPELLCHK
MOZ_MAIL_NEWS=1
EDITOR=1
MOZ_OFFLINE=1
MOZ_LOC_INDEP=1
MOZ_TASKBAR=1
MOZ_LDAP=1
MOZ_ADMIN_LIB=1
MOZ_COMMUNICATOR_NAME=1
MOZ_JSD=1
MOZ_IFC_TOOLS=1
MOZ_NETCAST=1
MOZ_COMMUNICATOR_IIDS=1
MOZ_COMMUNICATOR_ABOUT=1
MOZ_COMMUNICATOR_CONFIG_JS=1
MOZ_COPY_ALL_JARS=1
MOZ_SPELLCHK=1
!endif

158
mozilla/config/makecopy.c Normal file
View File

@@ -0,0 +1,158 @@
/* -*- 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.
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <direct.h>
#include <sys/stat.h>
#include <io.h>
#include <fcntl.h>
static const char *prog;
void Usage(void)
{
fprintf(stderr, "makecopy: <file> <dir-path>\n");
}
void FlipSlashes(char *name)
{
int i;
/*
** Flip any "unix style slashes" into "dos style backslashes"
*/
for( i=0; name[i]; i++ ) {
if( name[i] == '/' ) name[i] = '\\';
}
}
void GetPathName(char *file, char *new_path)
{
int i;
i = strlen(file);
for( i=strlen(file); i && file[i] != '\\'; i--);
strncpy(new_path, file, i);
if( new_path[i] != '\\' ) {
new_path[i++] = '\\';
}
new_path[i] = '\0';
}
int MakeDir( char *path )
{
char *cp, *pstr;
struct stat sb;
pstr = path;
while( cp = strchr(pstr, '\\') ) {
*cp = '\0';
if( stat(path, &sb) == 0 && (sb.st_mode & _S_IFDIR) ) {
/* sub-directory already exists.... */
} else {
/* create the new sub-directory */
printf("+++ makecopy: creating directory %s\n", path);
if( mkdir(path) < 0 ) {
return -1;
}
}
*cp = '\\';
pstr = cp+1;
}
}
int CopyIfNecessary(char *oldFile, char *newFile, char *path)
{
BY_HANDLE_FILE_INFORMATION hNewInfo;
BY_HANDLE_FILE_INFORMATION hOldInfo;
HANDLE hFile;
/* Try to open the destination file */
if ( (hFile = CreateFile(newFile, GENERIC_READ, FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL)) != INVALID_HANDLE_VALUE ) {
if (GetFileInformationByHandle(hFile, &hNewInfo) == FALSE) {
goto copy_file;
}
CloseHandle(hFile);
/* Try to open the source file */
if ( (hFile = CreateFile(oldFile, GENERIC_READ, FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL)) != INVALID_HANDLE_VALUE ) {
if (GetFileInformationByHandle(hFile, &hOldInfo) == FALSE) {
goto copy_file;
}
}
CloseHandle(hFile);
/*
** If both the source and destination were created at the same time
** and have the same size then do not copy...
*/
if ((hOldInfo.ftLastWriteTime.dwLowDateTime == hNewInfo.ftLastWriteTime.dwLowDateTime) &&
(hOldInfo.ftLastWriteTime.dwHighDateTime == hNewInfo.ftLastWriteTime.dwHighDateTime) &&
(hOldInfo.nFileSizeLow == hNewInfo.nFileSizeLow) &&
(hOldInfo.nFileSizeHigh == hNewInfo.nFileSizeHigh)) {
return 0;
}
}
copy_file:
printf("+++ makecopy: Installing %s into directory %s\n", oldFile, path);
if( ! CopyFile(oldFile, newFile, FALSE) ) {
return 1;
}
return 0;
}
static char new_file[4096];
static char new_path[4096];
int main( int argc, char *argv[] )
{
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
if( argc != 3 ) {
Usage();
return 2;
}
_splitpath(argv[1], NULL, NULL, fname, ext);
sprintf(new_file, "%s\\%s%s", argv[2], fname, ext);
FlipSlashes(new_file);
sprintf(new_path, "%s\\", argv[2]);
FlipSlashes(new_path);
if( MakeDir(new_path) < 0 ) {
fprintf(stderr, "\n+++ makecopy: unable to create directory %s\n", new_path);
return 1;
}
return CopyIfNecessary(argv[1], new_file, new_path);
}

BIN
mozilla/config/makecopy.exe Executable file

Binary file not shown.

View File

@@ -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.
#//------------------------------------------------------------------------
#//
#// Makefile fo NS/CONFIG - various commands used by other makefiles
#//
#//------------------------------------------------------------------------
!if "$(MOZ_BITS)" == "16"
!error This makefile must be build using 32-bit tools
!endif
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH = ..
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/rules.mak>
#//
#// Rule to build makedir.exe
#//
makecopy.exe:: makecopy.c
$(CC) -O2 -MD makecopy.c
mangle.exe:: mangle.c
$(CC) -O2 -MD mangle.c
mantomak.exe:: mantomak.c
$(CC) -O2 -MD mantomak.c
bin2rc.exe:: bin2rc.c
$(CC) -O2 -MD bin2rc.c
export:: makecopy.exe mangle.exe mantomak.exe bin2rc.exe
install:: export

120
mozilla/config/mangle.c Normal file
View File

@@ -0,0 +1,120 @@
/* -*- 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.
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
HANDLE hMangleFile;
void Usage(void)
{
fprintf(stderr, "MANGLE: <file>\n");
}
BOOL MangleFile( const char *real_name, const char *mangle_name )
{
int len;
DWORD dwWritten;
char buffer[2048];
if( mangle_name && *mangle_name && strcmpi(real_name, mangle_name) ) {
printf("Mangle: renaming %s to %s\n", real_name, mangle_name);
if( ! MoveFile(real_name, "X_MANGLE.TMP") ) {
fprintf(stderr, "MANGLE: cannot rename %s to X_MANGLE.TMP\n",
real_name);
return FALSE;
}
if( ! MoveFile("X_MANGLE.TMP", mangle_name) ) {
MoveFile("X_MANGLE.TMP", real_name);
fprintf(stderr, "MANGLE: cannot rename X_MANGLE.TMP to %s\n",
mangle_name);
return FALSE;
}
len = sprintf(buffer, "mv %s %s\r\n", mangle_name, real_name);
if( (WriteFile( hMangleFile, buffer, len, &dwWritten, NULL ) == FALSE) ||
(dwWritten != len) ) {
fprintf(stderr, "MANGLE: error writing to UNMANGLE.BAT\n");
return FALSE;
}
}
return TRUE;
}
int main( int argc, char *argv[] )
{
WIN32_FIND_DATA find_data;
HANDLE hFoundFile;
if( argc != 1 ) {
Usage();
return 2;
}
hMangleFile = CreateFile("unmangle.bat", /* name */
GENERIC_READ|GENERIC_WRITE, /* access mode */
0, /* share mode */
NULL, /* security descriptor */
CREATE_NEW, /* how to create */
FILE_ATTRIBUTE_NORMAL, /* file attributes */
NULL ); /* template file */
if( hMangleFile == INVALID_HANDLE_VALUE ) {
if( GetLastError() == ERROR_FILE_EXISTS ) {
fprintf(stderr, "MANGLE: UNMANGLE.BAT already exists\n");
} else {
fprintf(stderr, "MANGLE: cannot open UNMANGLE.BAT\n");
}
return 1;
}
if( (hFoundFile = FindFirstFile("*.*", &find_data)) == INVALID_HANDLE_VALUE ) {
fprintf(stderr, "MANGLE: cannot read directory\n");
return 1;
}
do {
if( !MangleFile(find_data.cFileName, find_data.cAlternateFileName) ) {
fprintf(stderr, "MANGLE: cannot rename %s to %s\n",
find_data.cFileName, find_data.cAlternateFileName );
FindClose( hFoundFile );
CloseHandle( hMangleFile );
return 1;
}
} while( FindNextFile(hFoundFile, &find_data) );
FindClose( hFoundFile );
{
int len;
DWORD dwWritten;
char buffer[255];
len = sprintf(buffer, "del unmangle.bat\r\n");
WriteFile ( hMangleFile, buffer, len, &dwWritten, NULL );
}
CloseHandle( hMangleFile );
return 0;
}

BIN
mozilla/config/mangle.exe Executable file

Binary file not shown.

989
mozilla/config/mantomak.c Normal file
View File

@@ -0,0 +1,989 @@
/* -*- 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.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define DEFAULT_MANIFEST_EXT ".mn"
#define DEFAULT_MAKEFILE_EXT ".win"
typedef struct char_list_struct {
char *m_pString;
struct char_list_struct *m_pNext;
} char_list;
typedef struct macro_list_struct {
char *m_pMacro;
char_list *m_pValue;
struct macro_list_struct *m_pNext;
} macro_list;
void help(void);
char *input_filename(const char *);
char *output_filename(const char *, const char *);
int input_to_output(FILE *, FILE *);
int output_rules(FILE *);
int output_end(FILE *);
int buffer_to_output(char *, FILE *);
macro_list *extract_macros(char *);
char *find_macro(char *, char **);
void add_macro(char *, macro_list **);
int macro_length(char *);
int value_length(char *);
void add_values(char *, char_list **);
char *skip_white(char *);
int write_macros(macro_list *, FILE *);
int write_values(char_list *, FILE *, int);
void free_macro_list(macro_list *);
void free_char_list(char_list *);
void morph_macro(macro_list **, char *, char *, char *);
void slash_convert(macro_list *, char *);
int explicit_rules(macro_list *, char *, FILE *);
void create_classroot(macro_list **ppList );
int main(int argc, char *argv[])
{
int iOS = 0;
char *pInputFile = NULL;
char *pOutputFile = NULL;
/* Figure out arguments.
* [REQUIRED] First argument is input file.
* [OPTIONAL] Second argument is output file.
*/
if(argc > 1) {
FILE *pInputStream = NULL;
FILE *pOutputStream = NULL;
/* Form respective filenames.
*/
pInputFile = input_filename(argv[1]);
pOutputFile = output_filename(pInputFile, argc > 2 ? argv[2] : NULL);
if(pInputFile == NULL) {
fprintf(stderr, "MANTOMAK: Unable to form input filename\n");
iOS = 1;
}
else {
pInputStream = fopen(pInputFile, "rb");
if(pInputStream == NULL) {
fprintf(stderr, "MANTOMAK: Unable to open input file %s\n", pInputFile);
iOS = 1;
}
}
if(pOutputFile == NULL) {
fprintf(stderr, "MANTOMAK: Unable to form output filename\n");
iOS = 1;
}
else if(pInputStream != NULL) {
pOutputStream = fopen(pOutputFile, "wt");
if(pOutputStream == NULL) {
fprintf(stderr, "MANTOMAK: Unable to open output file %s\n", pOutputFile);
iOS = 1;
}
}
/* Only do the real processing if our error code is not
* already set.
*/
if(iOS == 0) {
iOS = input_to_output(pInputStream, pOutputStream);
}
if(pInputStream != NULL) {
fclose(pInputStream);
pInputStream = NULL;
}
if(pOutputStream != NULL) {
fclose(pOutputStream);
pOutputStream = NULL;
}
}
else {
help();
iOS = 1;
}
if(pInputFile) {
free(pInputFile);
pInputFile = NULL;
}
if(pOutputFile) {
free(pOutputFile);
pOutputFile = NULL;
}
return(iOS);
}
void help(void)
{
fprintf(stderr, "USAGE:\tmantomak.exe InputFile [OutputFile]\n\n");
fprintf(stderr, "InputFile:\tManifest file. If without extension, \"%s\" assumed.\n", DEFAULT_MANIFEST_EXT);
fprintf(stderr, "OutputFile:\tNMake file. If not present, \"InputFile%s\" assumed.\n", DEFAULT_MAKEFILE_EXT);
}
char *input_filename(const char *pInputFile)
{
char aResult[_MAX_PATH];
char aDrive[_MAX_DRIVE];
char aDir[_MAX_DIR];
char aName[_MAX_FNAME];
char aExt[_MAX_EXT];
if(pInputFile == NULL) {
return(NULL);
}
_splitpath(pInputFile, aDrive, aDir, aName, aExt);
if(aExt[0] == '\0') {
/* No extension provided.
* Use the default.
*/
strcpy(aExt, DEFAULT_MANIFEST_EXT);
}
aResult[0] = '\0';
_makepath(aResult, aDrive, aDir, aName, aExt);
if(aResult[0] == '\0') {
return(NULL);
}
else {
return(strdup(aResult));
}
}
char *output_filename(const char *pInputFile, const char *pOutputFile)
{
char aResult[_MAX_PATH];
char aDrive[_MAX_DRIVE];
char aDir[_MAX_DIR];
char aName[_MAX_FNAME];
char aExt[_MAX_EXT];
if(pOutputFile != NULL) {
return(strdup(pOutputFile));
}
/* From here on out, we have to create our own filename,
* implied from the input file name.
*/
if(pInputFile == NULL) {
return(NULL);
}
_splitpath(pInputFile, aDrive, aDir, aName, aExt);
strcpy(aExt, DEFAULT_MAKEFILE_EXT);
aResult[0] = '\0';
_makepath(aResult, aDrive, aDir, aName, aExt);
if(aResult[0] == '\0') {
return(NULL);
}
else {
return(strdup(aResult));
}
}
int input_to_output(FILE *pInput, FILE *pOutput)
{
char *pHog = NULL;
long lSize = 0;
int iRetval = 0;
/* Read the entire file into memory.
*/
fseek(pInput, 0, SEEK_END);
lSize = ftell(pInput);
fseek(pInput, 0, SEEK_SET);
pHog = (char *)malloc(lSize + 1);
if(pHog) {
*(pHog + lSize) = '\0';
fread(pHog, lSize, 1, pInput);
iRetval = buffer_to_output(pHog, pOutput);
free(pHog);
pHog = NULL;
}
else {
fprintf(stderr, "MANTOMAK: Out of Memory....\n");
iRetval = 1;
}
return(iRetval);
}
int output_rules(FILE *pOutput)
{
int iRetval = 0;
if(EOF ==
fputs("\n"
"!if \"$(MANIFEST_LEVEL)\"==\"RULES\""
"\n",
pOutput))
{
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
}
return(iRetval);
}
int output_end(FILE *pOutput)
{
int iRetval = 0;
if(EOF ==
fputs("\n"
"!endif"
"\n",
pOutput))
{
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
}
return(iRetval);
}
int buffer_to_output(char *pBuffer, FILE *pOutput)
{
int iRetval = 0;
macro_list *pMacros = NULL;
/* Tokenize the macros and their corresponding values.
*/
pMacros = extract_macros(pBuffer);
if(pMacros != NULL) {
/* Perform forward to backslash conversion on those macros known to be
* path information only.
*/
slash_convert(pMacros, "JBOOTDIRS");
slash_convert(pMacros, "JDIRS");
slash_convert(pMacros, "DEPTH");
slash_convert(pMacros, "PACKAGE");
slash_convert(pMacros, "JMC_GEN_DIR");
slash_convert(pMacros, "DIST_PUBLIC");
/* Process some of the macros, and convert them
* into different macros with different data.
*/
morph_macro(&pMacros, "JMC_GEN", "JMC_HEADERS", "$(JMC_GEN_DIR)\\%s.h");
morph_macro(&pMacros, "JMC_GEN", "JMC_STUBS", "$(JMC_GEN_DIR)\\%s.c");
morph_macro(&pMacros, "JMC_GEN", "JMC_OBJS", ".\\$(OBJDIR)\\%s.obj");
morph_macro(&pMacros, "CSRCS", "C_OBJS", ".\\$(OBJDIR)\\%s.obj");
morph_macro(&pMacros, "CPPSRCS", "CPP_OBJS", ".\\$(OBJDIR)\\%s.obj");
morph_macro(&pMacros, "REQUIRES", "LINCS", "-I$(XPDIST)\\public\\%s");
create_classroot( &pMacros );
/* Output the Macros and the corresponding values.
*/
iRetval = write_macros(pMacros, pOutput);
/* Output rule file inclusion
*/
if(iRetval == 0) {
iRetval = output_rules(pOutput);
}
/* Output explicit build rules/dependencies for JMC_GEN.
*/
if(iRetval == 0) {
iRetval = explicit_rules(pMacros, "JMC_GEN", pOutput);
}
if(iRetval == 0) {
iRetval = output_end(pOutput);
}
/* Free off the macro list.
*/
free_macro_list(pMacros);
pMacros = NULL;
}
return(iRetval);
}
int explicit_rules(macro_list *pList, char *pMacro, FILE *pOutput)
{
int iRetval = 0;
macro_list *pEntry = NULL;
if(pList == NULL || pMacro == NULL || pOutput == NULL) {
return(0);
}
/* Find macro of said name.
* Case insensitive.
*/
pEntry = pList;
while(pEntry) {
if(stricmp(pEntry->m_pMacro, pMacro) == 0) {
break;
}
pEntry = pEntry->m_pNext;
}
if(pEntry) {
/* Decide style of rule depending on macro name.
*/
if(stricmp(pEntry->m_pMacro, "JMC_GEN") == 0) {
char_list *pNames = NULL;
char *pModuleName = NULL;
char *pClassName = NULL;
pNames = pEntry->m_pValue;
while(pNames) {
pModuleName = pNames->m_pString;
pClassName = pModuleName + 1;
fprintf(pOutput, "$(JMC_GEN_DIR)\\%s.h", pModuleName);
fprintf(pOutput, ": ");
fprintf(pOutput, "$(JMCSRCDIR)\\%s.class", pClassName);
fprintf(pOutput, "\n ");
fprintf(pOutput, "$(JMC) -d $(JMC_GEN_DIR) -interface $(JMC_GEN_FLAGS) $(?F:.class=)");
fprintf(pOutput, "\n");
fprintf(pOutput, "$(JMC_GEN_DIR)\\%s.c", pModuleName);
fprintf(pOutput, ": ");
fprintf(pOutput, "$(JMCSRCDIR)\\%s.class", pClassName);
fprintf(pOutput, "\n ");
fprintf(pOutput, "$(JMC) -d $(JMC_GEN_DIR) -module $(JMC_GEN_FLAGS) $(?F:.class=)");
fprintf(pOutput, "\n");
pNames = pNames->m_pNext;
}
}
else {
/* Don't know how to format macro.
*/
iRetval = 69;
}
}
return(iRetval);
}
void slash_convert(macro_list *pList, char *pMacro)
{
macro_list *pEntry = NULL;
if(pList == NULL || pMacro == NULL) {
return;
}
/* Find macro of said name.
* Case insensitive.
*/
pEntry = pList;
while(pEntry) {
if(stricmp(pEntry->m_pMacro, pMacro) == 0) {
break;
}
pEntry = pEntry->m_pNext;
}
if(pEntry) {
char *pConvert = NULL;
char_list *pValue = pEntry->m_pValue;
while(pValue) {
pConvert = pValue->m_pString;
while(pConvert && *pConvert) {
if(*pConvert == '/') {
*pConvert = '\\';
}
pConvert++;
}
pValue = pValue->m_pNext;
}
}
}
void morph_macro(macro_list **ppList, char *pMacro, char *pMorph, char *pPrintf)
{
macro_list *pEntry = NULL;
if(ppList == NULL || pMacro == NULL || pMorph == NULL || pPrintf == NULL) {
return;
}
/* Find macro of said name.
* Case insensitive.
*/
pEntry = *ppList;
while(pEntry) {
if(stricmp(pEntry->m_pMacro, pMacro) == 0) {
break;
}
pEntry = pEntry->m_pNext;
}
if(pEntry) {
char_list *pFilename = NULL;
char aPath[_MAX_PATH];
char aDrive[_MAX_DRIVE];
char aDir[_MAX_DIR];
char aFName[_MAX_FNAME];
char aExt[_MAX_EXT];
char *pBuffer = NULL;
/* Start with buffer size needed.
* We expand this as we go along if needed.
*/
pBuffer = (char *)malloc(strlen(pMorph) + 2);
strcpy(pBuffer, pMorph);
strcat(pBuffer, "=");
/* Go through each value, converting over to new macro.
*/
pFilename = pEntry->m_pValue;
while(pFilename) {
_splitpath(pFilename->m_pString, aDrive, aDir, aFName, aExt);
/* Expand buffer by required amount.
*/
sprintf(aPath, pPrintf, aFName);
strcat(aPath, " ");
pBuffer = (char *)realloc(pBuffer, _msize(pBuffer) + strlen(aPath));
strcat(pBuffer, aPath);
pFilename = pFilename->m_pNext;
}
/* Add the macro.
*/
add_macro(pBuffer, ppList);
free(pBuffer);
pBuffer = NULL;
}
}
void create_classroot(macro_list **ppList )
{
char cwd[512];
int i, i2;
macro_list *pEntry = NULL;
macro_list *pE;
/* Find macro of said name.
* Case insensitive.
*/
pEntry = *ppList;
while(pEntry) {
if(stricmp(pEntry->m_pMacro, "PACKAGE") == 0) {
break;
}
pEntry = pEntry->m_pNext;
}
if(pEntry == 0 || pEntry->m_pValue == 0 || pEntry->m_pValue->m_pString == 0) {
return;
}
_getcwd( cwd, 512 );
i = strlen( pEntry->m_pValue->m_pString );
i2 = strlen( cwd );
cwd[i2-i-1] = 0;
pE = NULL;
pE = (macro_list *)calloc(sizeof(macro_list),1);
pE->m_pMacro = strdup("CLASSROOT");
pE->m_pValue = (char_list *)calloc(sizeof(char_list),1);
pE->m_pValue->m_pString = strdup(cwd);
while(*ppList) {
ppList = &((*ppList)->m_pNext);
}
*ppList = pE;
}
int write_macros(macro_list *pList, FILE *pOutput)
{
int iRetval = 0;
int iLineLength = 0;
if(pList == NULL || pOutput == NULL) {
return(0);
}
if(EOF ==
fputs("\n"
"!if \"$(MANIFEST_LEVEL)\"==\"MACROS\""
"\n",
pOutput))
{
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
return(1);
}
while(pList) {
int bIgnoreForWin16 = 0;
/* The following macros should not be emitted for Win16 */
if (0 == strcmp(pList->m_pMacro, "LINCS")) {
bIgnoreForWin16 = 1;
}
if (bIgnoreForWin16) {
if(0 > fprintf(pOutput, "!if \"$(MOZ_BITS)\" != \"16\"\n")) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
}
if(0 > fprintf(pOutput, "%s=", pList->m_pMacro)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength += strlen(pList->m_pMacro) + 1;
iRetval = write_values(pList->m_pValue, pOutput, iLineLength);
if(iRetval) {
break;
}
if(EOF == fputc('\n', pOutput)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength = 0;
pList = pList->m_pNext;
if (bIgnoreForWin16) {
if(0 > fprintf(pOutput, "!endif\n")) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
bIgnoreForWin16 = 0;
}
}
if(EOF ==
fputs("\n"
"!endif"
"\n",
pOutput))
{
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
return(1);
}
return(iRetval);
}
int write_values(char_list *pList, FILE *pOutput, int iLineLength)
{
int iRetval = 0;
if(pList == NULL || pOutput == NULL) {
return(0);
}
while(pList) {
if(iLineLength == 0) {
if(EOF == fputs(" ", pOutput)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength += 4;
if(0 > fprintf(pOutput, "%s ", pList->m_pString)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength += strlen(pList->m_pString) + 1;
}
else if(iLineLength + strlen(pList->m_pString) > 72) {
if(EOF == fputs("\\\n", pOutput)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength = 0;
continue;
}
else {
if(0 > fprintf(pOutput, "%s ", pList->m_pString)) {
fprintf(stderr, "MANTOMAK: Error writing to file....\n");
iRetval = 1;
break;
}
iLineLength += strlen(pList->m_pString) + 1;
}
pList = pList->m_pNext;
}
return(iRetval);
}
macro_list *extract_macros(char *pBuffer)
{
macro_list *pRetval = NULL;
char *pTraverse = NULL;
char *pMacro = NULL;
pTraverse = pBuffer;
while(pTraverse) {
pMacro = NULL;
pTraverse = find_macro(pTraverse, &pMacro);
if(pMacro) {
add_macro(pMacro, &pRetval);
}
}
return(pRetval);
}
void add_macro(char *pString, macro_list **ppList)
{
macro_list *pEntry = NULL;
int iLength = 0;
if(pString == NULL || *pString == '\0' || ppList == NULL) {
return;
}
/* Allocate a new list entry for the macro.
*/
pEntry = (macro_list *)malloc(sizeof(macro_list));
memset(pEntry, 0, sizeof(macro_list));
/* Very first part of the string is the macro name.
* How long is it?
*/
iLength = macro_length(pString);
pEntry->m_pMacro = (char *)malloc(iLength + 1);
memset(pEntry->m_pMacro, 0, iLength + 1);
strncpy(pEntry->m_pMacro, pString, iLength);
/* Skip to the values.
* These are always on the right side of an '='
*/
pString = strchr(pString, '=');
if(pString) {
pString++;
}
add_values(pString, &(pEntry->m_pValue));
/* Add the macro to the end of the macro list.
*/
while(*ppList) {
ppList = &((*ppList)->m_pNext);
}
*ppList = pEntry;
}
void add_values(char *pString, char_list **ppList)
{
char_list **ppTraverse = NULL;
char_list *pEntry = NULL;
int iLength = 0;
int iBackslash = 0;
if(pString == NULL || *pString == '\0' || ppList == NULL) {
return;
}
while(pString) {
/* Find start of value.
*/
iBackslash = 0;
while(*pString) {
if(*pString == '\\') {
iBackslash++;
}
else if(*pString == '\n') {
if(iBackslash == 0) {
/* End of values.
* Setting to NULL gets out of all loops.
*/
pString = NULL;
break;
}
iBackslash = 0;
}
else if(!isspace(*pString)) {
/* Backslashes part of string.
* This screws up if a backslash is in the middle of the string.
*/
pString -= iBackslash;
break;
}
pString++;
}
if(pString == NULL || *pString == '\0') {
break;
}
/* Do not honor anything beginning with a #
*/
if(*pString == '#') {
/* End of line.
*/
while(*pString && *pString != '\n') {
pString++;
}
continue;
}
/* Very first part of the string is value name.
* How long is it?
*/
iLength = value_length(pString);
/* Do not honor $(NULL)
*/
if(_strnicmp(pString, "$(NULL)", 7) == 0) {
pString += iLength;
continue;
}
/* Allocate a new list entry for the next value.
*/
pEntry = (char_list *)malloc(sizeof(char_list));
memset(pEntry, 0, sizeof(char_list));
pEntry->m_pString = (char *)malloc(iLength + 1);
memset(pEntry->m_pString, 0, iLength + 1);
strncpy(pEntry->m_pString, pString, iLength);
/* Add new value entry to the end of the list.
*/
ppTraverse = ppList;
while(*ppTraverse) {
ppTraverse = &((*ppTraverse)->m_pNext);
}
*ppTraverse = pEntry;
/* Go on to next value.
*/
pString += iLength;
}
}
char *find_macro(char *pBuffer, char **ppMacro)
{
char *pRetval = NULL;
int iBackslash = 0;
if(pBuffer == NULL || ppMacro == NULL) {
return(NULL);
}
/* Skip any whitespace in the buffer.
* If comments need to be skipped also, this is the place.
*/
while(1) {
while(*pBuffer && isspace(*pBuffer)) {
pBuffer++;
}
if(*pBuffer == '#') {
/* Go to the end of the line, it's a comment.
*/
while(*pBuffer && *pBuffer != '\n') {
pBuffer++;
}
continue;
}
break;
}
if(*pBuffer) {
/* Should be at the start of a macro.
*/
*ppMacro = pBuffer;
}
/* Find the end of the macro for the return value.
* This is the end of a line which does not contain a backslash at the end.
*/
while(*pBuffer) {
if(*pBuffer == '\\') {
iBackslash++;
}
else if(*pBuffer == '\n') {
if(iBackslash == 0) {
pRetval = pBuffer + 1;
break;
}
iBackslash = 0;
}
else if(!isspace(*pBuffer)) {
iBackslash = 0;
}
pBuffer++;
}
return(pRetval);
}
int macro_length(char *pMacro)
{
int iRetval = 0;
if(pMacro == NULL) {
return(0);
}
/* Length is no big deal.
* Problem is finding the end:
* whitespace
* '='
*/
while(*pMacro) {
if(*pMacro == '=') {
break;
}
else if(isspace(*pMacro)) {
break;
}
pMacro++;
iRetval++;
}
return(iRetval);
}
int value_length(char *pValue)
{
int iRetval = 0;
if(pValue == NULL) {
return(0);
}
/* Length is no big deal.
* Problem is finding the end:
* whitespace
* '\\'whitespace
*/
while(*pValue) {
if(*pValue == '\\') {
char *pFindNewline = pValue + 1;
/* If whitespace to end of line, break here.
*/
while(isspace(*pFindNewline)) {
if(*pFindNewline == '\n') {
break;
}
pFindNewline++;
}
if(*pFindNewline == '\n') {
break;
}
}
else if(isspace(*pValue)) {
break;
}
pValue++;
iRetval++;
}
return(iRetval);
}
char *skip_white(char *pString)
{
if(pString == NULL) {
return(NULL);
}
while(*pString && isspace(*pString)) {
pString++;
}
return(pString);
}
void free_macro_list(macro_list *pList)
{
macro_list *pFree = NULL;
if(pList == NULL) {
return;
}
while(pList) {
pFree = pList;
pList = pList->m_pNext;
pFree->m_pNext = NULL;
free_char_list(pFree->m_pValue);
pFree->m_pValue = NULL;
free(pFree->m_pMacro);
pFree->m_pMacro = NULL;
free(pFree);
pFree = NULL;
}
}
void free_char_list(char_list *pList)
{
char_list *pFree = NULL;
if(pList == NULL) {
return;
}
while(pList) {
pFree = pList;
pList = pList->m_pNext;
pFree->m_pNext = NULL;
free(pFree->m_pString);
pFree->m_pString = NULL;
free(pFree);
pFree = NULL;
}
}

BIN
mozilla/config/mantomak.exe Executable file

Binary file not shown.

View File

@@ -0,0 +1,32 @@
#
# 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 = ../..
MODULE = mkdepend
PROGRAM = mkdepend
CSRCS = cppsetup.c \
ifparser.c \
include.c \
main.c \
parse.c \
pr.c
include $(DEPTH)/config/rules.mk
DEFINES += -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\"

View File

@@ -0,0 +1,244 @@
/* $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;
cppsetup(line, filep, inc)
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(symbol)
char *symbol;
{
static struct symtab undefined;
struct symtab *sp;
sp = isdefined(symbol, currentinc, NULL);
if (sp == NULL) {
sp = &undefined;
sp->s_value = NULL;
}
return (sp);
}
pperror(tag, x0,x1,x2,x3,x4)
int tag,x0,x1,x2,x3,x4;
{
warning("\"%s\", line %d: ", currentinc->i_file, currentfile->f_line);
warning(x0,x1,x2,x3,x4);
}
yyerror(s)
register char *s;
{
fatalerr("Fatal error: %s\n", s);
}
#else /* not CPP */
#include "ifparser.h"
struct _parse_data {
struct filepointer *filep;
struct inclist *inc;
const char *line;
};
static const char *
_my_if_errors (ip, cp, expecting)
IfParser *ip;
const char *cp;
const char *expecting;
{
#ifdef DEBUG_MKDEPEND
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);
#endif /* DEBUG_MKDEPEND */
return NULL;
}
#define MAXNAMELEN 256
static struct symtab *
_lookup_variable (ip, var, len)
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 (ip, var, len)
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 (ip, var, len)
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);
}
cppsetup(line, filep, inc)
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 */

View File

@@ -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.
*/
#ifndef NO_X11
#include <X11/Xosdefs.h>
#ifdef WIN32
#include <X11/Xw32defs.h>
#endif
#include <X11/Xfuncproto.h>
#endif /* NO_X11 */
#include <stdio.h>
#include <ctype.h>
#ifndef X_NOT_POSIX
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#endif
#endif
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#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 <stdlib.h>
#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
char *malloc(), *realloc();
#endif /* macII */
#else
char *malloc();
char *realloc();
#endif
char *copy();
char *base_name();
char *getline();
struct symtab *slookup();
struct symtab *isdefined();
struct symtab *fdefined();
struct filepointer *getfile();
struct inclist *newinclude();
struct inclist *inc_path();
#if NeedVarargsPrototypes
extern fatalerr(char *, ...);
extern warning(char *, ...);
extern warning1(char *, ...);
#endif

View File

@@ -0,0 +1,458 @@
/*
* $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 <ctype.h>
/****************************************************************************
Internal Macros and Utilities for Parser
****************************************************************************/
#define DO(val) if (!(val)) return NULL
#define CALLFUNC(ggg,fff) (*((ggg)->funcs.fff))
#define SKIPSPACE(ccc) while (isspace(*ccc)) ccc++
#define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_')
static const char *
parse_variable (g, cp, varp)
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 (g, cp, valp)
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 (g, cp, valp)
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 (g, cp, valp)
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));
/* Do nothing in the divide-by-zero case. */
if (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 (g, cp, valp)
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 (g, cp, valp)
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 (g, cp, valp)
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 (g, cp, valp)
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 (g, cp, valp)
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 (g, cp, valp)
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 (g, cp, valp)
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 (g, cp, valp)
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 (g, cp, valp)
IfParser *g;
const char *cp;
int *valp;
{
return parse_lor (g, cp, valp);
}

View File

@@ -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 <stdio.h>
#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 * */);

View File

@@ -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 <sys/param.h>
#if NEWSOS < 41
#define imake_ccflags "-Dbsd43 -DNOSTDHDRS"
#else
#if NEWSOS < 42
#define imake_ccflags "-Dbsd43"
#endif
#endif
#endif
#endif
#ifdef _CRAY
#define imake_ccflags "-DSYSV -DUSG"
#endif
#if defined(_IBMR2) || defined(aix)
#define imake_ccflags "-Daix -DSYSV"
#endif
#ifdef Mips
# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43)
# define imake_ccflags "-DBSD43"
# else
# define imake_ccflags "-DSYSV"
# endif
#endif
#ifdef is68k
#define imake_ccflags "-Dluna -Duniosb"
#endif
#ifdef SYSV386
# ifdef SVR4
# define imake_ccflags "-Xc -DSVR4"
# else
# define imake_ccflags "-DSYSV"
# endif
#endif
#ifdef SVR4
# ifdef i386
# define imake_ccflags "-Xc -DSVR4"
# endif
#endif
#ifdef SYSV
# ifdef i386
# define imake_ccflags "-DSYSV"
# endif
#endif
#ifdef __convex__
#define imake_ccflags "-fn -tm c1"
#endif
#ifdef apollo
#define imake_ccflags "-DX_NOT_POSIX"
#endif
#ifdef WIN32
#define imake_ccflags "-nologo -batch -D__STDC__"
#endif
#ifdef __uxp__
#define imake_ccflags "-DSVR4 -DANSICPP"
#endif
#ifdef __sxg__
#define imake_ccflags "-DSYSV -DUSG -DNOSTDHDRS"
#endif
#ifdef sequent
#define imake_ccflags "-DX_NOT_STDC_ENV -DX_NOT_POSIX"
#endif
#ifdef _SEQUENT_
#define imake_ccflags "-DSYSV -DUSG"
#endif
#if defined(SX) || defined(PC_UX)
#define imake_ccflags "-DSYSV"
#endif
#ifdef nec_ews_svr2
#define imake_ccflags "-DUSG"
#endif
#if defined(nec_ews_svr4) || defined(_nec_ews_svr4) || defined(_nec_up) || defined(_nec_ft)
#define imake_ccflags "-DSVR4"
#endif
#ifdef MACH
#define imake_ccflags "-DNOSTDHDRS"
#endif
/* this is for OS/2 under EMX. This won't work with DOS */
#if defined(__EMX__)
#define imake_ccflags "-DBSD43"
#endif
#else /* not CCIMAKE */
#ifndef MAKEDEPEND
/*
* Step 2: dup2
* If your OS doesn't have a dup2() system call to duplicate one file
* descriptor onto another, define such a mechanism here (if you don't
* already fall under the existing category(ies).
*/
#if defined(SYSV) && !defined(_CRAY) && !defined(Mips) && !defined(_SEQUENT_)
#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : (close(fd2), \
fcntl(fd1, F_DUPFD, fd2)))
#endif
/*
* Step 3: FIXUP_CPP_WHITESPACE
* If your cpp collapses tabs macro expansions into a single space and
* replaces escaped newlines with a space, define this symbol. This will
* cause imake to attempt to patch up the generated Makefile by looking
* for lines that have colons in them (this is why the rules file escapes
* all colons). One way to tell if you need this is to see whether or not
* your Makefiles have no tabs in them and lots of @@ strings.
*/
#if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || (defined(AMOEBA) && defined(CROSS_COMPILE))
#define FIXUP_CPP_WHITESPACE
#endif
#ifdef WIN32
#define REMOVE_CPP_LEADSPACE
#define INLINE_SYNTAX
#define MAGIC_MAKE_VARS
#endif
#ifdef __minix_vmd
#define FIXUP_CPP_WHITESPACE
#endif
/*
* Step 4: USE_CC_E, DEFAULT_CC, DEFAULT_CPP
* If you want to use cc -E instead of cpp, define USE_CC_E.
* If use cc -E but want a different compiler, define DEFAULT_CC.
* If the cpp you need is not in /lib/cpp, define DEFAULT_CPP.
*/
#ifdef hpux
#define USE_CC_E
#endif
#ifdef WIN32
#define USE_CC_E
#define DEFAULT_CC "cl"
#endif
#ifdef apollo
#define DEFAULT_CPP "/usr/lib/cpp"
#endif
#if defined(_IBMR2) && !defined(DEFAULT_CPP)
#define DEFAULT_CPP "/usr/lpp/X11/Xamples/util/cpp/cpp"
#endif
#if defined(sun) && defined(SVR4)
#define DEFAULT_CPP "/usr/ccs/lib/cpp"
#endif
#ifdef __bsdi__
#define DEFAULT_CPP "/usr/bin/cpp"
#endif
#ifdef __uxp__
#define DEFAULT_CPP "/usr/ccs/lib/cpp"
#endif
#ifdef __sxg__
#define DEFAULT_CPP "/usr/lib/cpp"
#endif
#ifdef _CRAY
#define DEFAULT_CPP "/lib/pcpp"
#endif
#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
#define DEFAULT_CPP "/usr/libexec/cpp"
#endif
#ifdef MACH
#define USE_CC_E
#endif
#ifdef __minix_vmd
#define DEFAULT_CPP "/usr/lib/cpp"
#endif
#if defined(__EMX__)
/* expects cpp in PATH */
#define DEFAULT_CPP "cpp"
#endif
/*
* Step 5: cpp_argv
* The following table contains the flags that should be passed
* whenever a Makefile is being generated. If your preprocessor
* doesn't predefine any unique symbols, choose one and add it to the
* end of this table. Then, do the following:
*
* a. Use this symbol in Imake.tmpl when setting MacroFile.
* b. Put this symbol in the definition of BootstrapCFlags in your
* <platform>.cf file.
* c. When doing a make World, always add "BOOTSTRAPCFLAGS=-Dsymbol"
* to the end of the command line.
*
* Note that you may define more than one symbol (useful for platforms
* that support multiple operating systems).
*/
#define ARGUMENTS 50 /* number of arguments in various arrays */
char *cpp_argv[ARGUMENTS] = {
"cc", /* replaced by the actual program to exec */
"-I.", /* add current directory to include path */
#ifdef unix
"-Uunix", /* remove unix symbol so that filename unix.c okay */
#endif
#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(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 */

View File

@@ -0,0 +1,308 @@
/* $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"
extern struct inclist inclist[ MAXFILES ],
*inclistp;
extern char *includedirs[ ];
extern char *notdotdot[ ];
extern boolean show_where_not;
extern boolean warn_multiple;
struct inclist *inc_path(file, include, dot)
register char *file,
*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!!)
*/
remove_dotdot(path)
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);
}
isdot(p)
register char *p;
{
if(p && *p++ == '.' && *p++ == '\0')
return(TRUE);
return(FALSE);
}
isdotdot(p)
register char *p;
{
if(p && *p++ == '.' && *p++ == '.' && *p++ == '\0')
return(TRUE);
return(FALSE);
}
issymbolic(dir, component)
register char *dir, *component;
{
#ifdef S_IFLNK
struct stat st;
char buf[ BUFSIZ ], **pp;
sprintf(buf, "%s%s%s", dir, *dir ? "/" : "", component);
for (pp=notdotdot; *pp; pp++)
if (strcmp(*pp, buf) == 0)
return (TRUE);
if (lstat(buf, &st) == 0
&& (st.st_mode & S_IFMT) == S_IFLNK) {
*pp++ = copy(buf);
if (pp >= &notdotdot[ MAXDIRS ])
fatalerr("out of .. dirs, increase MAXDIRS\n");
return(TRUE);
}
#endif
return(FALSE);
}
/*
* Add an include file to the list of those included by 'file'.
*/
struct inclist *newinclude(newfile, incstring)
register char *newfile, *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);
}
included_by(ip, newfile)
register struct inclist *ip, *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; i<ip->i_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 complain if ip has */
/* no #include SYMBOL lines */
/* and is not a .c file */
if (warn_multiple)
{
warning("%s includes %s more than once!\n",
ip->i_file, newfile->i_file);
warning1("Already have\n");
for (i=0; i<ip->i_listlen; i++)
warning1("\t%s\n", ip->i_list[i]->i_file);
}
}
return;
}
ip->i_list = (struct inclist **) realloc(ip->i_list,
sizeof(struct inclist *) * ++ip->i_listlen);
}
ip->i_list[ ip->i_listlen-1 ] = newfile;
}
inc_clean ()
{
register struct inclist *ip;
for (ip = inclist; ip < inclistp; ip++) {
ip->i_marked = FALSE;
}
}

View File

@@ -0,0 +1,710 @@
/* $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"
#ifdef hpux
#define sigvec sigvector
#endif /* hpux */
#ifdef X_POSIX_C_SOURCE
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
#include <signal.h>
#undef _POSIX_C_SOURCE
#else
#if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE)
#include <signal.h>
#else
#define _POSIX_SOURCE
#include <signal.h>
#undef _POSIX_SOURCE
#endif
#endif
#if NeedVarargsPrototypes
#include <stdarg.h>
#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 ],
*inclistp = 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 */
static
#ifdef SIGNALRETURNSINT
int
#else
void
#endif
catch (sig)
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 */
main(argc, argv)
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);
/*
* catch signals.
*/
#ifdef USGISH
/* should really reset SIGINT to SIG_IGN if it was. */
#ifdef SIGHUP
signal (SIGHUP, catch);
#endif
signal (SIGINT, catch);
#ifdef SIGQUIT
signal (SIGQUIT, catch);
#endif
signal (SIGILL, catch);
#ifdef SIGBUS
signal (SIGBUS, catch);
#endif
signal (SIGSEGV, catch);
#ifdef SIGSYS
signal (SIGSYS, catch);
#endif
signal (SIGFPE, catch);
#else
sig_act.sa_handler = 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(file)
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);
}
freefile(fp)
struct filepointer *fp;
{
free(fp->f_base);
free(fp);
}
char *copy(str)
register char *str;
{
register char *p = (char *)malloc(strlen(str) + 1);
strcpy(p, str);
return(p);
}
match(str, list)
register char *str, **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(filep)
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(file)
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 (from, to)
char *from, *to;
{
(void) unlink (to);
if (link (from, to) == 0) {
unlink (from);
return 0;
} else {
return -1;
}
}
#endif /* USGISH */
redirect(line, makefile)
char *line,
*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 */
}
#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);
}
#if NeedVarargsPrototypes
warning(char *msg, ...)
#else
/*VARARGS0*/
warning(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
char *msg;
#endif
{
#ifdef DEBUG_MKDEPEND
#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
#endif /* DEBUG_MKDEPEND */
}
#if NeedVarargsPrototypes
warning1(char *msg, ...)
#else
/*VARARGS0*/
warning1(msg,x1,x2,x3,x4,x5,x6,x7,x8,x9)
char *msg;
#endif
{
#ifdef DEBUG_MKDEPEND
#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
#endif /* DEBUG_MKDEPEND */
}

View File

@@ -0,0 +1,368 @@
.\" $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.
.\"
.\" 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
.\" dealing in this Software without prior written authorization from the
.\" X Consortium.
.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

View File

@@ -0,0 +1,567 @@
/* $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;
find_includes(filep, file, file_red, recursion, failOK)
struct filepointer *filep;
struct inclist *file, *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);
}
gobble(filep, file, file_red)
register struct filepointer *filep;
struct inclist *file, *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 (line, filep, file_red, file, parse_it)
register char *line;
register struct filepointer *filep;
register struct inclist *file_red, *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(symbol, file, srcfile)
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(symbol, file, srcfile)
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
*/
zero_value(exp, filep, file_red)
register char *exp;
register struct filepointer *filep;
register struct inclist *file_red;
{
if (cppsetup(exp, filep, file_red))
return(IFFALSE);
else
return(IF);
}
define(def, file)
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);
}
define2(name, val, file)
char *name, *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(symbol, file)
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);
}
undefine(symbol, file)
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];
}
}

View File

@@ -0,0 +1,132 @@
/* $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;
add_include(filep, file, file_red, include, dot, failOK)
struct filepointer *filep;
struct inclist *file, *file_red;
char *include;
boolean dot;
{
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) {
/* Only add new dependency files if they don't have "/usr/include" in them. */
if (!(newfile && newfile->i_file && strstr(newfile->i_file, "/usr/"))) {
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);
}
}
}
recursive_pr_include(head, file, base)
register struct inclist *head;
register char *file, *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; i<head->i_listlen; i++)
recursive_pr_include(head->i_list[ i ], file, base);
}
pr(ip, file, base)
register struct inclist *ip;
char *file, *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; i<ip->i_listlen; i++)
printf("\n#\t%s", ip->i_list[ i ]->i_incstring);
}

30
mozilla/config/nfspwd.pl Normal file
View File

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

42
mozilla/config/nodl.pl Normal file
View File

@@ -0,0 +1,42 @@
#! 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 out the nodltab.
# Usage: nodl.pl table-name sym1 sym2 ... symN
#
$table = $ARGV[0];
shift(@ARGV);
print "/* Automatically generated file; do not edit */\n\n";
print "#include \"prtypes.h\"\n\n";
print "#include \"prlink.h\"\n\n";
foreach $symbol (@ARGV) {
print "extern void ",$symbol,"();\n";
}
print "\n";
print "PRStaticLinkTable ",$table,"[] = {\n";
foreach $symbol (@ARGV) {
print " { \"",$symbol,"\", ",$symbol," },\n";
}
print " { 0, 0, },\n";
print "};\n";

417
mozilla/config/nsinstall.c Normal file
View File

@@ -0,0 +1,417 @@
/* -*- 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
*/
#ifdef XP_OS2_VACPP
#include "getopt.c"
#include "dirent.c"
#endif
#include <stdio.h> /* OSF/1 requires this before grp.h, so put it first */
#include <assert.h>
#include <fcntl.h>
#ifndef XP_OS2_VACPP
#include <grp.h>
#include <pwd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef XP_OS2_VACPP
#include <unistd.h>
#include <utime.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include "pathsub.h"
#ifdef NEED_GETOPT_H
#include <getopt.h>
#endif
#ifdef XP_OS2_VACPP
#include <dirent.h>
#include <direct.h>
#include <io.h>
#include <sys\utime.h>
#include <sys\types.h>
#endif
#ifdef SUNOS4
#include "sunos4.h"
#endif
#ifdef NEED_S_ISLNK
#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
#endif
#endif
#ifdef NEED_FCHMOD_PROTO
extern int fchmod(int fildes, mode_t mode);
#endif
#ifdef XP_OS2
/*Note: OS/2 has no concept of users or groups, or symbolic links...*/
#define lstat stat
/*looks reasonably safe based on OS/2's stat.h...*/
#define S_ISLNK(mode) 0 /*no way in hell on a file system that doesn't support it*/
#ifdef XP_OS2_VACPP
typedef unsigned short mode_t;
typedef unsigned short uid_t;
typedef unsigned short gid_t;
#define mkdir(path, mode) mkdir(path)
#define W_OK 1
#endif
#define touid(spam) 0
#define togid(spam) 0
#define access(spam, spam2) 0
#define chown(spam1, spam2, spam3) 0
#define lchown(spam1, spam2, spam3) 0
#define fchown(spam1, spam2, spam3) 0
#define readlink(spam1, spam2, spam3) -1
#define symlink(spam1, spam2) -1
#ifndef XP_OS2_VACPP
unsigned long DosSetFileSize(int, int);
#endif
#define ftruncate(spam1, spam2) (DosSetFileSize(spam1, spam2)?-1:0)
#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, (int)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);
}
#ifndef XP_OS2
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;
}
#endif
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, fromsb;
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':
#ifdef XP_OS2
/* treat like -t since no symbolic links on OS2 */
dotimes = 1;
#else
dolink = dorelsymlink = 1;
#endif
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)
#ifdef RHAPSODY
{
cwd = malloc(PATH_MAX + 1);
cwd = getcwd(cwd, PATH_MAX);
}
#else
cwd = getcwd(0, PATH_MAX);
#endif
xchdir(todir);
#ifdef RHAPSODY
todir = malloc(PATH_MAX + 1);
todir = getcwd(todir, PATH_MAX);
#else
todir = getcwd(0, PATH_MAX);
#endif
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 = 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 = xmalloc(len + 1);
sprintf(linkname, "%s/%s", linkprefix, name);
} else if (dorelsymlink) {
/* Symlink the relative path from todir to source name. */
linkname = 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. */
#ifdef XP_OS2_VACPP
#pragma info(nocnd)
#endif
if ((exists && (!S_ISLNK(tosb.st_mode) ||
readlink(toname, buf, sizeof buf) != len ||
strncmp(buf, name, len) != 0)) ||
((stat(name, &fromsb) == 0) &&
(fromsb.st_mtime > tosb.st_mtime))) {
#ifdef XP_OS2_VACPP
#pragma info(restore)
#endif
if ( S_ISDIR(tosb.st_mode) ) {
(void)rmdir(toname);
} else {
(void)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. */
#ifdef XP_OS2_FIX
fromfd = open(name, O_RDONLY | O_BINARY);
#else
fromfd = open(name, O_RDONLY);
#endif
if (fromfd < 0 || fstat(fromfd, &sb) < 0)
fail("cannot access %s", name);
if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0))
if (S_ISDIR(tosb.st_mode)) {
(void)rmdir(toname);
} else {
(void)unlink(toname);
}
#ifdef XP_OS2
chmod(toname, S_IREAD | S_IWRITE);
#endif
#ifdef XP_OS2_FIX
tofd = open(toname, O_CREAT | O_WRONLY | O_BINARY, 0666);
#else
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
#endif
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);
#ifndef XP_OS2
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);
#endif
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);
#ifdef XP_OS2
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 (chmod(toname, (mode & (S_IREAD | S_IWRITE))) < 0)
fail("cannot change mode of %s", toname);
#endif
}
free(toname);
}
free(cwd);
free(todir);
return 0;
}

209
mozilla/config/obj.inc Normal file
View File

@@ -0,0 +1,209 @@
# 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.
!if !defined(VERBOSE)
.SILENT:
!endif
## Include support for MOZ_LITE/MOZ_MEDIUM
include <$(DEPTH)/config/liteness.mak>
RCFLAGS=$(RCFLAGS) $(MOZ_LITENESS_FLAGS)
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the rules necessary to build 16 and 32 bit
#// object files.
#//
#//------------------------------------------------------------------------
!if !defined(CONFIG_OBJ_INC)
CONFIG_OBJ_INC=1
#//------------------------------------------------------------------------
#//
#// Rules for compiling 16/32 bit object files from either c or c++ source
#//
#//------------------------------------------------------------------------
.c.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
$(CURDIR)$(*B).c
<<KEEP
.c{.\$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).c
<<KEEP
{.\_jmc\}.c{.\$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)_jmc\$(*B).c
<<KEEP
.cpp.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
$(CURDIR)$(*B).cpp
<<
.cpp{.\$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).cpp
<<
{.\_jmc\}.cpp{.\$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-nologo -c $(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)_jmc\$(*B).cpp
<<KEEP
#//------------------------------------------------------------------------
#//
#// Rule for compiling resource files
#//
#//------------------------------------------------------------------------
.rc{.\$(OBJDIR)\}.res:
# //
# // execute the command
# //
echo Creating Resource file: $*.res
$(RC) $(RCFLAGS) -r -Fo.\$(OBJDIR)\$(*B).res $(*B).rc
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#//
#// Rule for building simple 16 bit executables
#//
#//------------------------------------------------------------------------
.c{.\$(OBJDIR)\}.exe:
$(CC) @<<$(CFGFILE)
-c
$(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PBDFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).c
<<
$(LD) @<<$(CFGFILE)
$(LFLAGS)
$(OBJDIR)\$(*B).obj,
$(OBJDIR)\$(*B).exe,
$(MAPFILE),
$(LLIBS) $(OS_LIBS),
$(DEFFILE),
$(RESFILE),
<<
!else
#//------------------------------------------------------------------------
#//
#// Rule for building simple 32 bit executables
#//
#//------------------------------------------------------------------------
.c{.\$(OBJDIR)\}.exe:
$(CC) @<<$(CFGFILE)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PBDFILE)
-Fe.\$(OBJDIR)\
$(CURDIR)$(*B).c
<<
!endif
#//------------------------------------------------------------------------
#//
#// Rule for creating .i file containing c preprocessor output
#//
#//------------------------------------------------------------------------
.c.i:
@$(CC) @<<$(CFGFILE)
/P -c
$(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
$(CURDIR)$(*B).c
<<KEEP
.c{.\$(OBJDIR)\}.i:
@$(CC) @<<$(CFGFILE)
/P -c
$(OPTIMIZER)
$(CFLAGS)
$(LCFLAGS)
$(LINCS)
$(LINCS_1)
$(INCS)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(CURDIR)$(*B).c
<<KEEP
!endif # CONFIG_OBJ_INC

71
mozilla/config/os2.mk Normal file
View File

@@ -0,0 +1,71 @@
#
# 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 OS/2
######################################################################
SHELL = GBASH.EXE
# Specify toolset. Default to EMX.
ifeq ($(MOZ_OS2_TOOLS),VACPP)
XP_OS2_VACPP = 1
else
XP_OS2_EMX = 1
endif
ifdef XP_OS2_EMX
######################################################################
# These are for emx/gcc
######################################################################
PLATFORM_FLAGS = -ansi -Wall -Zmtd -DXP_OS2 -DXP_OS2_FIX -DXP_OS2_EMX
MOVEMAIL_FLAGS =
PORT_FLAGS = -DNEED_GETOPT_H -DHAVE_SIGNED_CHAR
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
######################################################################
# end XP_OS2_EMX
######################################################################
endif
ifdef XP_OS2_VACPP
######################################################################
# These are for VisualAge C++
######################################################################
CC = icc
LINK = ilink
ifdef BUILD_OPT
OPTIMIZER = -O+ -Oi
else
OPTIMIZER = -Ti+
endif
PLATFORM_FLAGS = -q -W3 -DOS2::4 -DXP_OS2 -DXP_OS2_FIX -DXP_OS2_VACPP -N10 -D_X86_
PLATFORM_FLAGS += -Gm -Gd+ -Su4 -Ss -I. -I$(DEPTH)/config/os2
MOVEMAIL_FLAGS =
PORT_FLAGS = -DHAVE_SIGNED_CHAR
OS_CFLAGS = $(PLATFORM_FLAGS) $(PORT_FLAGS) $(MOVEMAIL_FLAGS)
OS_LFLAGS = /PM:VIO /NOLOGO
######################################################################
# End XP_OS2_VACPP
######################################################################
endif

348
mozilla/config/os2/dirent.c Normal file
View File

@@ -0,0 +1,348 @@
#ifdef OS2
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
/*#ifndef __EMX__
#include <libx.h>
#endif */
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#include <os2.h>
#if OS2 >= 2
# define FFBUF FILEFINDBUF3
# define Word ULONG
/*
* LS20 recommends a request count of 100, but according to the
* APAR text it does not lead to missing files, just to funny
* numbers of returned entries.
*
* LS30 HPFS386 requires a count greater than 2, or some files
* are missing (those starting with a character less that '.').
*
* Novell looses entries which overflow the buffer. In previous
* versions of dirent2, this could have lead to missing files
* when the average length of 100 directory entries was 40 bytes
* or more (quite unlikely for files on a Novell server).
*
* Conclusion: Make sure that the entries all fit into the buffer
* and that the buffer is large enough for more than 2 entries
* (each entry is at most 300 bytes long). And ignore the LS20
* effect.
*/
# define Count 25
# define BufSz (25 * (sizeof(FILEFINDBUF3)+1))
#else
# define FFBUF FILEFINDBUF
# define Word USHORT
# define BufSz 1024
# define Count 3
#endif
#if defined(__IBMC__) || defined(__IBMCPP__)
#define error(rc) _doserrno = rc, errno = EOS2ERR
#elif defined(MICROSOFT)
#define error(rc) _doserrno = rc, errno = 255
#else
#define error(rc) errno = 255
#endif
struct _dirdescr {
HDIR handle; /* DosFindFirst handle */
char fstype; /* filesystem type */
Word count; /* valid entries in <ffbuf> */
long number; /* absolute number of next entry */
int index; /* relative number of next entry */
FFBUF * next; /* pointer to next entry */
char name[MAXPATHLEN+3]; /* directory name */
unsigned attrmask; /* attribute mask for seekdir */
struct dirent entry; /* buffer for directory entry */
BYTE ffbuf[BufSz];
};
/*
* Return first char of filesystem type, or 0 if unknown.
*/
static char
getFSType(const char *path)
{
static char cache[1+26];
char drive[3], info[512];
Word unit, infolen;
char r;
if (isalpha(path[0]) && path[1] == ':') {
unit = toupper(path[0]) - '@';
path += 2;
} else {
ULONG driveMap;
#if OS2 >= 2
if (DosQueryCurrentDisk(&unit, &driveMap))
#else
if (DosQCurDisk(&unit, &driveMap))
#endif
return 0;
}
if ((path[0] == '\\' || path[0] == '/')
&& (path[1] == '\\' || path[1] == '/'))
return 0;
if (cache [unit])
return cache [unit];
drive[0] = '@' + unit;
drive[1] = ':';
drive[2] = '\0';
infolen = sizeof info;
#if OS2 >= 2
if (DosQueryFSAttach(drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen))
return 0;
if (infolen >= sizeof(FSQBUFFER2)) {
FSQBUFFER2 *p = (FSQBUFFER2 *)info;
r = p->szFSDName[p->cbName];
} else
#else
if (DosQFSAttach((PSZ)drive, 0, FSAIL_QUERYNAME, (PVOID)info, &infolen, 0))
return 0;
if (infolen >= 9) {
char *p = info + sizeof(USHORT);
p += sizeof(USHORT) + *(USHORT *)p + 1 + sizeof(USHORT);
r = *p;
} else
#endif
r = 0;
return cache [unit] = r;
}
char *
abs_path(const char *name, char *buffer, int len)
{
char buf[4];
if (isalpha(name[0]) && name[1] == ':' && name[2] == '\0') {
buf[0] = name[0];
buf[1] = name[1];
buf[2] = '.';
buf[3] = '\0';
name = buf;
}
#if OS2 >= 2
if (DosQueryPathInfo((PSZ)name, FIL_QUERYFULLNAME, buffer, len))
#else
if (DosQPathInfo((PSZ)name, FIL_QUERYFULLNAME, (PBYTE)buffer, len, 0L))
#endif
return NULL;
return buffer;
}
DIR *
openxdir(const char *path, unsigned att_mask)
{
DIR *dir;
char name[MAXPATHLEN+3];
Word rc;
dir = malloc(sizeof(DIR));
if (dir == NULL) {
errno = ENOMEM;
return NULL;
}
strncpy(name, path, MAXPATHLEN);
name[MAXPATHLEN] = '\0';
switch (name[strlen(name)-1]) {
default:
strcat(name, "\\");
case '\\':
case '/':
case ':':
;
}
strcat(name, ".");
if (!abs_path(name, dir->name, MAXPATHLEN+1))
strcpy(dir->name, name);
if (dir->name[strlen(dir->name)-1] == '\\')
strcat(dir->name, "*");
else
strcat(dir->name, "\\*");
dir->fstype = getFSType(dir->name);
dir->attrmask = att_mask | A_DIR;
dir->handle = HDIR_CREATE;
dir->count = 100;
#if OS2 >= 2
rc = DosFindFirst(dir->name, &dir->handle, dir->attrmask,
dir->ffbuf, sizeof dir->ffbuf, &dir->count, FIL_STANDARD);
#else
rc = DosFindFirst((PSZ)dir->name, &dir->handle, dir->attrmask,
(PFILEFINDBUF)dir->ffbuf, sizeof dir->ffbuf, &dir->count, 0);
#endif
switch (rc) {
default:
free(dir);
error(rc);
return NULL;
case NO_ERROR:
case ERROR_NO_MORE_FILES:
;
}
dir->number = 0;
dir->index = 0;
dir->next = (FFBUF *)dir->ffbuf;
return (DIR *)dir;
}
DIR *
opendir(const char *pathname)
{
return openxdir(pathname, 0);
}
struct dirent *
readdir(DIR *dir)
{
static int dummy_ino = 2;
if (dir->index == dir->count) {
Word rc;
dir->count = 100;
#if OS2 >= 2
rc = DosFindNext(dir->handle, dir->ffbuf,
sizeof dir->ffbuf, &dir->count);
#else
rc = DosFindNext(dir->handle, (PFILEFINDBUF)dir->ffbuf,
sizeof dir->ffbuf, &dir->count);
#endif
if (rc) {
error(rc);
return NULL;
}
dir->index = 0;
dir->next = (FFBUF *)dir->ffbuf;
}
if (dir->index == dir->count)
return NULL;
memcpy(dir->entry.d_name, dir->next->achName, dir->next->cchName);
dir->entry.d_name[dir->next->cchName] = '\0';
dir->entry.d_ino = dummy_ino++;
dir->entry.d_reclen = dir->next->cchName;
dir->entry.d_namlen = dir->next->cchName;
dir->entry.d_size = dir->next->cbFile;
dir->entry.d_attribute = dir->next->attrFile;
dir->entry.d_time = *(USHORT *)&dir->next->ftimeLastWrite;
dir->entry.d_date = *(USHORT *)&dir->next->fdateLastWrite;
switch (dir->fstype) {
case 'F': /* FAT */
case 'C': /* CDFS */
if (dir->next->attrFile & FILE_DIRECTORY)
strupr(dir->entry.d_name);
else
strlwr(dir->entry.d_name);
}
#if OS2 >= 2
dir->next = (FFBUF *)((BYTE *)dir->next + dir->next->oNextEntryOffset);
#else
dir->next = (FFBUF *)((BYTE *)dir->next->achName + dir->next->cchName + 1);
#endif
++dir->number;
++dir->index;
return &dir->entry;
}
long
telldir(DIR *dir)
{
return dir->number;
}
void
seekdir(DIR *dir, long off)
{
if (dir->number > off) {
char name[MAXPATHLEN+2];
Word rc;
DosFindClose(dir->handle);
strcpy(name, dir->name);
strcat(name, "*");
dir->handle = HDIR_CREATE;
dir->count = 32767;
#if OS2 >= 2
rc = DosFindFirst(name, &dir->handle, dir->attrmask,
dir->ffbuf, sizeof dir->ffbuf, &dir->count, FIL_STANDARD);
#else
rc = DosFindFirst((PSZ)name, &dir->handle, dir->attrmask,
(PFILEFINDBUF)dir->ffbuf, sizeof dir->ffbuf, &dir->count, 0);
#endif
switch (rc) {
default:
error(rc);
return;
case NO_ERROR:
case ERROR_NO_MORE_FILES:
;
}
dir->number = 0;
dir->index = 0;
dir->next = (FFBUF *)dir->ffbuf;
}
while (dir->number < off && readdir(dir))
;
}
void
closedir(DIR *dir)
{
DosFindClose(dir->handle);
free(dir);
}
/*****************************************************************************/
#ifdef TEST
main(int argc, char **argv)
{
int i;
DIR *dir;
struct dirent *ep;
for (i = 1; i < argc; ++i) {
dir = opendir(argv[i]);
if (!dir)
continue;
while (ep = readdir(dir))
if (strchr("\\/:", argv[i] [strlen(argv[i]) - 1]))
printf("%s%s\n", argv[i], ep->d_name);
else
printf("%s/%s\n", argv[i], ep->d_name);
closedir(dir);
}
return 0;
}
#endif
#endif /* OS2 */

View File

@@ -0,0 +1,94 @@
#ifndef __DIRENT_H__
#define __DIRENT_H__
/*
* @(#)msd_dir.h 1.4 87/11/06 Public Domain.
*
* A public domain implementation of BSD directory routines for
* MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
* August 1897
*
* Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks
* and returns 2 more pieces of information - file size & attribute.
* Plus a little reshuffling of some #define's positions December 1987
*
* Some modifications by Martin Junius 02-14-89
*
* AK900712
* AK910410 abs_path - make absolute path
*
*/
#ifdef __EMX__
#include <sys/param.h>
#else
#if defined(__IBMC__) || defined(__IBMCPP__)
#include <stdio.h>
#define MAXPATHLEN (FILENAME_MAX*4)
#define MAXNAMLEN FILENAME_MAX
#else
#include <param.h>
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* attribute stuff */
#ifndef A_RONLY
# define A_RONLY 0x01
# define A_HIDDEN 0x02
# define A_SYSTEM 0x04
# define A_LABEL 0x08
# define A_DIR 0x10
# define A_ARCHIVE 0x20
#endif
struct dirent {
#ifdef OS2 /* use the layout of EMX to avoid trouble */
int d_ino; /* Dummy */
int d_reclen; /* Dummy, same as d_namlen */
int d_namlen; /* length of name */
char d_name[MAXNAMLEN + 1];
unsigned long d_size;
unsigned short d_attribute; /* attributes (see above) */
unsigned short d_time; /* modification time */
unsigned short d_date; /* modification date */
#else
char d_name[MAXNAMLEN + 1]; /* garentee null termination */
char d_attribute; /* .. extension .. */
unsigned long d_size; /* .. extension .. */
#endif
};
typedef struct _dirdescr DIR;
/* the structs do not have to be defined here */
extern DIR *opendir(const char *);
extern DIR *openxdir(const char *, unsigned);
extern struct dirent *readdir(DIR *);
extern void seekdir(DIR *, long);
extern long telldir(DIR *);
extern void closedir(DIR *);
#define rewinddir(dirp) seekdir(dirp, 0L)
extern char * abs_path(const char *name, char *buffer, int len);
#ifndef S_IFMT
#define S_IFMT ( S_IFDIR | S_IFREG )
#endif
#ifndef S_ISDIR
#define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISREG
#define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG)
#endif
#ifdef __cplusplus
}
#endif
#endif

731
mozilla/config/os2/getopt.c Normal file
View File

@@ -0,0 +1,731 @@
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* NOTE!!! AIX requires this to be the first thing in the file.
Do not put ANYTHING before it! */
#if !defined (__GNUC__) && defined (_AIX)
#pragma alloca
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not __GNUC__ */
#if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__))))
#include <alloca.h>
#else
#ifndef _AIX
char *alloca ();
#endif
#endif /* alloca.h */
#endif /* not __GNUC__ */
#if !__STDC__ && !defined(const) && IN_GCC
#define const
#endif
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. */
#ifndef _NO_PROTO
#define _NO_PROTO
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#undef alloca
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
#else /* Not GNU C library. */
#if defined(__IBMC__) || defined(__IBMCPP__)
#include <stdlib.h>
#undef alloca
#define alloca _alloca
#else
#define __alloca alloca
#endif /* IBMCSet */
#endif /* GNU C library. */
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
long-named option. Because this is not POSIX.2 compliant, it is
being phased out. */
/* #define GETOPT_COMPAT */
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
to intersperse the options with the other arguments.
As `getopt' works, it permutes the elements of ARGV so that,
when it is done, all the options precede everything else. Thus
all application programs are extended to handle flexible argument order.
Setting the environment variable POSIXLY_CORRECT disables permutation.
Then the behavior is completely standard.
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "getopt.h"
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
char *optarg = 0;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
/* XXX 1003.2 says this must be 1 before any call. */
int optind = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
If this is zero, or a null string, it means resume the scan
by advancing to the next ARGV-element. */
static char *nextchar;
/* Callers store zero here to inhibit the error message
for unrecognized options. */
int opterr = 1;
/* Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
int optopt = '?';
/* Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
the default is REQUIRE_ORDER if the environment variable
POSIXLY_CORRECT is defined, PERMUTE otherwise.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
of the list of option characters.
PERMUTE is the default. We permute the contents of ARGV as we scan,
so that eventually all the non-options are at the end. This allows options
to be given in any order, even with programs that were not written to
expect this.
RETURN_IN_ORDER is an option available to programs that were written
to expect options and other ARGV-elements in any order and that care about
the ordering of the two. We describe each non-option ARGV-element
as if it were the argument of an option with character code 1.
Using `-' as the first character of the list of option characters
selects this mode of operation.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
static enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
#if defined(__GNU_LIBRARY__) || defined(__IBMC__) || defined(__IBMCPP__)
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
#define my_index strchr
#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n))
#else
/* Avoid depending on library functions or files
whose names are inconsistent. */
char *getenv ();
static char *
my_index (str, chr)
const char *str;
int chr;
{
while (*str)
{
if (*str == chr)
return (char *) str;
str++;
}
return 0;
}
static void
my_bcopy (from, to, size)
const char *from;
char *to;
int size;
{
int i;
for (i = 0; i < size; i++)
to[i] = from[i];
}
#endif /* GNU C library. */
/* Handle permutation of arguments. */
/* Describe the part of ARGV that contains non-options that have
been skipped. `first_nonopt' is the index in ARGV of the first of them;
`last_nonopt' is the index after the last of them. */
static int first_nonopt;
static int last_nonopt;
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
The other is elements [last_nonopt,optind), which contains all
the options processed since those non-options were skipped.
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
static void
exchange (char **argv)
{
int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *);
char **temp = (char **) __alloca (nonopts_size);
/* Interchange the two blocks of data in ARGV. */
my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size);
my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt],
(optind - last_nonopt) * sizeof (char *));
my_bcopy ((char *) temp,
(char *) &argv[first_nonopt + optind - last_nonopt],
nonopts_size);
/* Update records for the slots the non-options now occupy. */
first_nonopt += (optind - last_nonopt);
last_nonopt = optind;
}
/* Scan elements of ARGV (whose length is ARGC) for option characters
given in OPTSTRING.
If an element of ARGV starts with '-', and is not exactly "-" or "--",
then it is an option element. The characters of this element
(aside from the initial '-') are option characters. If `getopt'
is called repeatedly, it returns successively each of the option characters
from each of the option elements.
If `getopt' finds another option character, it returns that character,
updating `optind' and `nextchar' so that the next call to `getopt' can
resume the scan with the following option character or ARGV-element.
If there are no more option characters, `getopt' returns `EOF'.
Then `optind' is the index in ARGV of the first ARGV-element
that is not an option. (The ARGV-elements have been permuted
so that those that are not options now come last.)
OPTSTRING is a string containing the legitimate option characters.
If an option character is seen that is not listed in OPTSTRING,
return '?' after printing an error message. If you set `opterr' to
zero, the error message is suppressed but we still return '?'.
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
so the following text in the same ARGV-element, or the text of the following
ARGV-element, is returned in `optarg'. Two colons mean an option that
wants an optional arg; if there is text in the current ARGV-element,
it is returned in `optarg', otherwise `optarg' is set to zero.
If OPTSTRING starts with `-' or `+', it requests different methods of
handling the non-option ARGV-elements.
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
Long-named options begin with `--' instead of `-'.
Their names may be abbreviated as long as the abbreviation is unique
or is an exact match for some defined option. If they have an
argument, it follows the option name in the same ARGV-element, separated
from the option name by a `=', or else the in next ARGV-element.
When `getopt' finds a long-named option, it returns 0 if that option's
`flag' field is nonzero, the value of the option's `val' field
if the `flag' field is zero.
The elements of ARGV aren't really const, because we permute them.
But we pretend they're const in the prototype to be compatible
with other systems.
LONGOPTS is a vector of `struct option' terminated by an
element containing a name which is zero.
LONGIND returns the index in LONGOPT of the long-named option found.
It is only valid when a long-named option has been found by the most
recent call.
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
long-named options. */
int
_getopt_internal (int argc, char *const *argv, const char *optstring,
const struct option *longopts, int *longind, int long_only)
{
int option_index;
optarg = 0;
/* Initialize the internal data when the first call is made.
Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
non-option ARGV-elements is empty. */
if (optind == 0)
{
first_nonopt = last_nonopt = optind = 1;
nextchar = NULL;
/* Determine how to handle the ordering of options and nonoptions. */
if (optstring[0] == '-')
{
ordering = RETURN_IN_ORDER;
++optstring;
}
else if (optstring[0] == '+')
{
ordering = REQUIRE_ORDER;
++optstring;
}
else if (getenv ("POSIXLY_CORRECT") != NULL)
ordering = REQUIRE_ORDER;
else
ordering = PERMUTE;
}
if (nextchar == NULL || *nextchar == '\0')
{
if (ordering == PERMUTE)
{
/* If we have just processed some options following some non-options,
exchange them so that the options come first. */
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (last_nonopt != optind)
first_nonopt = optind;
/* Now skip any additional non-options
and extend the range of non-options previously skipped. */
while (optind < argc
&& (argv[optind][0] != '-' || argv[optind][1] == '\0')
#ifdef GETOPT_COMPAT
&& (longopts == NULL
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
#endif /* GETOPT_COMPAT */
)
optind++;
last_nonopt = optind;
}
/* Special ARGV-element `--' means premature end of options.
Skip it like a null option,
then exchange with previous non-options as if it were an option,
then skip everything else like a non-option. */
if (optind != argc && !strcmp (argv[optind], "--"))
{
optind++;
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange ((char **) argv);
else if (first_nonopt == last_nonopt)
first_nonopt = optind;
last_nonopt = argc;
optind = argc;
}
/* If we have done all the ARGV-elements, stop the scan
and back over any non-options that we skipped and permuted. */
if (optind == argc)
{
/* Set the next-arg-index to point at the non-options
that we previously skipped, so the caller will digest them. */
if (first_nonopt != last_nonopt)
optind = first_nonopt;
return EOF;
}
/* If we have come to a non-option and did not permute it,
either stop the scan or describe it to the caller and pass it by. */
if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
#ifdef GETOPT_COMPAT
&& (longopts == NULL
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
#endif /* GETOPT_COMPAT */
)
{
if (ordering == REQUIRE_ORDER)
return EOF;
optarg = argv[optind++];
return 1;
}
/* We have found another option-ARGV-element.
Start decoding its characters. */
nextchar = (argv[optind] + 1
+ (longopts != NULL && argv[optind][1] == '-'));
}
if (longopts != NULL
&& ((argv[optind][0] == '-'
&& (argv[optind][1] == '-' || long_only))
#ifdef GETOPT_COMPAT
|| argv[optind][0] == '+'
#endif /* GETOPT_COMPAT */
))
{
const struct option *p;
char *s = nextchar;
int exact = 0;
int ambig = 0;
const struct option *pfound = NULL;
int indfound;
while (*s && *s != '=')
s++;
/* Test all options for either exact match or abbreviated matches. */
for (p = longopts, option_index = 0; p->name;
p++, option_index++)
if (!strncmp (p->name, nextchar, s - nextchar))
{
if (s - nextchar == strlen (p->name))
{
/* Exact match found. */
pfound = p;
indfound = option_index;
exact = 1;
break;
}
else if (pfound == NULL)
{
/* First nonexact match found. */
pfound = p;
indfound = option_index;
}
else
/* Second nonexact match found. */
ambig = 1;
}
if (ambig && !exact)
{
if (opterr)
fprintf (stderr, "%s: option `%s' is ambiguous\n",
argv[0], argv[optind]);
nextchar += strlen (nextchar);
optind++;
return '?';
}
if (pfound != NULL)
{
option_index = indfound;
optind++;
if (*s)
{
/* Don't test has_arg with >, because some C compilers don't
allow it to be used on enums. */
if (pfound->has_arg)
optarg = s + 1;
else
{
if (opterr)
{
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
"%s: option `--%s' doesn't allow an argument\n",
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
"%s: option `%c%s' doesn't allow an argument\n",
argv[0], argv[optind - 1][0], pfound->name);
}
nextchar += strlen (nextchar);
return '?';
}
}
else if (pfound->has_arg == 1)
{
if (optind < argc)
optarg = argv[optind++];
else
{
if (opterr)
fprintf (stderr, "%s: option `%s' requires an argument\n",
argv[0], argv[optind - 1]);
nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : '?';
}
}
nextchar += strlen (nextchar);
if (longind != NULL)
*longind = option_index;
if (pfound->flag)
{
*(pfound->flag) = pfound->val;
return 0;
}
return pfound->val;
}
/* Can't find it as a long option. If this is not getopt_long_only,
or the option starts with '--' or is not a valid short
option, then it's an error.
Otherwise interpret it as a short option. */
if (!long_only || argv[optind][1] == '-'
#ifdef GETOPT_COMPAT
|| argv[optind][0] == '+'
#endif /* GETOPT_COMPAT */
|| my_index (optstring, *nextchar) == NULL)
{
if (opterr)
{
if (argv[optind][1] == '-')
/* --option */
fprintf (stderr, "%s: unrecognized option `--%s'\n",
argv[0], nextchar);
else
/* +option or -option */
fprintf (stderr, "%s: unrecognized option `%c%s'\n",
argv[0], argv[optind][0], nextchar);
}
nextchar = (char *) "";
optind++;
return '?';
}
}
/* Look at and handle the next option-character. */
{
char c = *nextchar++;
char *temp = my_index (optstring, c);
/* Increment `optind' when we start to process its last character. */
if (*nextchar == '\0')
++optind;
if (temp == NULL || c == ':')
{
if (opterr)
{
#if 0
if (c < 040 || c >= 0177)
fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
argv[0], c);
else
fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c);
#endif
}
optopt = c;
return '?';
}
if (temp[1] == ':')
{
if (temp[2] == ':')
{
/* This is an option that accepts an argument optionally. */
if (*nextchar != '\0')
{
optarg = nextchar;
optind++;
}
else
optarg = 0;
nextchar = NULL;
}
else
{
/* This is an option that requires an argument. */
if (*nextchar != '\0')
{
optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg,
we must advance to the next element now. */
optind++;
}
else if (optind == argc)
{
if (opterr)
{
#if 0
fprintf (stderr, "%s: option `-%c' requires an argument\n",
argv[0], c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: option requires an argument -- %c\n",
argv[0], c);
#endif
}
optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = '?';
}
else
/* We already incremented `optind' once;
increment it again when taking next ARGV-elt as argument. */
optarg = argv[optind++];
nextchar = NULL;
}
}
return c;
}
}
int
getopt (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
(int *) 0,
0);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#ifdef TEST
/* Compile with -DTEST to make an executable for use in testing
the above definition of `getopt'. */
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
c = getopt (argc, argv, "abc:d:0123456789");
if (c == EOF)
break;
switch (c)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */

129
mozilla/config/os2/getopt.h Normal file
View File

@@ -0,0 +1,129 @@
/* Declarations for getopt.
Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
#if __STDC__ || defined( XP_OS2_VACPP )
const char *name;
#else
char *name;
#endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#if __STDC__ || defined( XP_OS2_VACPP )
#if defined(__GNU_LIBRARY__) || defined( XP_OS2_VACPP )
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt ();
#endif /* not __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */
extern int getopt ();
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
#endif /* not __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _GETOPT_H */

View File

@@ -0,0 +1,62 @@
#!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.
#
#
#Input: [-d dir] foo1.java foo2.java
#Compares with: foo1.class foo2.class (if -d specified, checks in 'dir',
# otherwise assumes .class files in same directory as .java files)
#Returns: list of input arguments which are newer than corresponding class
#files (non-existant class files are considered to be real old :-)
#
$found = 1;
if ($ARGV[0] eq '-d') {
$classdir = $ARGV[1];
$classdir .= "/";
shift;
shift;
} else {
$classdir = "./";
}
foreach $filename (@ARGV) {
$classfilename = $classdir;
$classfilename .= $filename;
$classfilename =~ s/.java$/.class/;
# workaround to only build sun/io/* classes when necessary
# change the pathname of target file to be consistent
# with sun/io subdirectories
#
# sun/io was always getting rebuilt because the java files
# were split into subdirectories, but the package names
# remained the same. This was confusing outofdate.pl
#
$classfilename =~ s/sun\/io\/extended.\//sun\/io\//;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
$ctime,$blksize,$blocks) = stat($filename);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime,
$ctime,$blksize,$blocks) = stat($classfilename);
# print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n";
if ($mtime > $classmtime) {
print $filename, " ";
$found = 0;
}
}
print "\n";

232
mozilla/config/pathsub.c Normal file
View File

@@ -0,0 +1,232 @@
/* -*- 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 <assert.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef XP_OS2_VACPP
#include <unistd.h>
#endif
#include <sys/stat.h>
#include "pathsub.h"
#ifdef USE_REENTRANT_LIBC
#include <libc_r.h>
#endif
#ifdef XP_OS2_VACPP
#include <direct.h>
#include <io.h>
#include <sys\utime.h>
#include <sys\types.h>
#endif
#ifdef SUNOS4
#include "sunos4.h"
#endif
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 LAME_READDIR
#include <sys/param.h>
/*
** The static buffer in Unixware's readdir is too small.
*/
struct dirent *readdir(DIR *d)
{
static struct dirent *buf = NULL;
if(buf == NULL)
buf = (struct dirent *) malloc(sizeof(struct dirent) + MAXPATHLEN);
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(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);
}

55
mozilla/config/pathsub.h Normal file
View File

@@ -0,0 +1,55 @@
/* -*- 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.
*/
#ifndef pathsub_h___
#define pathsub_h___
/*
** Pathname subroutines.
**
** Brendan Eich, 8/29/95
*/
#include <limits.h>
#include <sys/types.h>
#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___ */

27
mozilla/config/pkg2dpth.pl Executable file
View File

@@ -0,0 +1,27 @@
#!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.
#
#
# Transform package paths to depths:
# foo/bar ==> ../..
#
# Why don't we need .. here?
$ARGV[0] =~ s@[^/\\]+@..@g;
print $ARGV[0]

View File

@@ -0,0 +1,34 @@
# -*- Mode: Makefile -*-
#
# 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.
#
#
# A pitifully inadequate tool for starting a port to a new platform.
#
OS_ARCH := $(subst /,_,$(shell uname -s))
OS_RELEASE := $(shell uname -r)
MK_FILE = $(OS_ARCH)$(OS_RELEASE).mk
all: $(MK_FILE)
$(MK_FILE): configure.sh
@rm -f $@
@$< $(OS_ARCH) $(OS_RELEASE) $@
clean:
rm -f $(MK_FILE) $(wildcard *.add)

537
mozilla/config/ports/configure.sh Executable file
View File

@@ -0,0 +1,537 @@
#!/bin/sh
#
# 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.
#
ARCH="$1"
RELEASE="$2"
MKFILE="$3"
BSDECHO=""
LIB_DIRS=""
MACROS=""
PATH="/usr/ccs/bin:/tools/ns/bin:/tools/contrib/bin:/usr/local/bin:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/bin/X11:/usr/etc:/usr/ucb:/usr/lpp/xlC/bin"
POSSIBLE_X_DIRS="/usr/X/lib /usr/X11R6/lib /usr/abiccs/lib/X11R5 /usr/X11/lib /usr/lib/X11 /usr/lib /lib"
SPECIAL=""
TMPFILE="foo.$$.c"
X_DIR=""
XFE_MKFILE="xfe_mfile.add"
export PATH
rm -f foo ${TMPFILE}
echo "Let's see what we've got to work with...."
if test "`echo -n blah`" != "-n blah"
then
BSDECHO="echo"
ECHO_FLAG="-n"
ENDER=""
else
ECHO_FLAG=""
ENDER="\c"
fi
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { }" >> ${TMPFILE}
cc -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -eq 0
then
CC="cc"
else
CC="gcc"
fi
echo "Compiler seems to be ${CC}...."
echo "Looking for various header files...."
echo ${ECHO_FLAG} "Do we have <stddef.h>....${ENDER}"
if test -f /usr/include/stddef.h
then
MACROS="${MACROS} -DHAVE_STDDEF_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <stdlib.h>....${ENDER}"
if test -f /usr/include/stdlib.h
then
MACROS="${MACROS} -DHAVE_STDLIB_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <model.h>....${ENDER}"
if test -f /usr/include/model.h
then
MACROS="${MACROS} -DHAVE_MODEL_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <bitypes.h>....${ENDER}"
if test -f /usr/include/bitypes.h
then
MACROS="${MACROS} -DHAVE_BITYPES_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <sys/bitypes.h>....${ENDER}"
if test -f /usr/include/sys/bitypes.h
then
MACROS="${MACROS} -DHAVE_SYS_BITYPES_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <sys/filio.h>....${ENDER}"
if test -f /usr/include/sys/filio.h
then
MACROS="${MACROS} -DHAVE_FILIO_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <sys/endian.h>....${ENDER}"
if test -f /usr/include/sys/endian.h
then
MACROS="${MACROS} -DSYS_ENDIAN_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <ntohl/endian.h> and/or <machine/endian.h>....${ENDER}"
if test -f /usr/include/ntohl/endian.h -o -f /usr/include/machine/endian.h
then
MACROS="${MACROS} -DNTOHL_ENDIAN_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <machine/endian.h>....${ENDER}"
if test -f /usr/include/machine/endian.h
then
MACROS="${MACROS} -DMACHINE_ENDIAN_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <sys/machine.h>....${ENDER}"
if test -f /usr/include/sys/machine.h
then
MACROS="${MACROS} -DSYS_MACHINE_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have <sys/byteorder.h>....${ENDER}"
if test -f /usr/include/sys/byteorder.h
then
MACROS="${MACROS} -DSYS_BYTEORDER_H"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have either <cdefs.h> or <sys/cdefs.h>....${ENDER}"
if test ! -f /usr/include/cdefs.h -a ! -f /usr/include/sys/cdefs.h
then
MACROS="${MACROS} -DNO_CDEFS_H"
echo " no"
else
echo " yes"
fi
#
# Obviously I have no idea what I _should_ be looking for here.... --briano.
#
echo "Trying to determine if this system is strict SYSV...."
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
if test -f /usr/include/sys/param.h
then
echo "#include <sys/param.h>" >> ${TMPFILE}
fi
echo "int main() {" >> ${TMPFILE}
echo "#if defined(SVR4) || defined(SYSV) || defined(__svr4) || defined(__svr4__) || defined(_SVR4) || defined(__SVR4) || defined(M_SYSV) || defined(_M_SYSV)" >> ${TMPFILE}
echo " return(0);" >> ${TMPFILE}
echo "#endif" >> ${TMPFILE}
echo "#if defined(BSD) || defined(bsd) || defined(__bsd) || defined(__bsd__) || defined(_BSD) || defined(__BSD)" >> ${TMPFILE}
echo " return(1);" >> ${TMPFILE}
echo "#endif" >> ${TMPFILE}
echo " return(2);" >> ${TMPFILE}
echo "}" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
./foo
case $? in
0) echo " -- Looks like SYSVR4...."
MACROS="${MACROS} -DSYSV -DSVR4 -D__svr4 -D__svr4__"
;;
1) echo " -- Looks like BSD...."
;;
2) echo " -- Can't tell. Could be either SYSV or BSD, or both...."
;;
esac
echo "Looking for various platform-specific quirks...."
echo ${ECHO_FLAG} "Do we have long long....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { long long x; }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DNO_LONG_LONG"
echo " no"
else
echo " yes"
fi
echo ${ECHO_FLAG} "Do we have signed long....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { signed long x; }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DNO_SIGNED"
echo " no"
else
echo " yes"
fi
echo ${ECHO_FLAG} "Do we have strerror()....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { (void *)strerror(666); }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -eq 0
then
SPECIAL="-DHAVE_STRERROR"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have lchown()....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { (void)lchown(\"/foo\",666,666); }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -eq 0
then
MACROS="${MACROS} -DHAVE_LCHOWN"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have memmove()....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { char s[32]; const char *s2 = \"diediedie\"; memmove(s,s2,32); }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DNO_MEMMOVE"
echo " no"
else
echo " yes"
fi
echo ${ECHO_FLAG} "Do we have alloca()....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
if test -f /usr/include/alloca.h
then
echo "#include <alloca.h>" > ${TMPFILE}
fi
echo "void main() { alloca(666); }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DNO_ALLOCA"
echo " no"
else
echo " yes"
fi
echo ${ECHO_FLAG} "Do we have regex()....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { (void *)regex(\"foo\",(char *)0); }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} -lgen >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DNO_REGEX"
echo " no"
else
echo " yes"
fi
echo ${ECHO_FLAG} "Do we have regcmp()....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { (void *)regcmp(\"foo\",\"barfoofrab\"); }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} -lgen >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DNO_REGCOMP"
echo " no"
else
echo " yes"
fi
echo ${ECHO_FLAG} "Do we have pgno_t....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { pgno_t foo = 0; }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DHAS_PGNO_T"
echo " yes"
else
echo " no"
fi
echo ${ECHO_FLAG} "Do we have IN_MULTICAST....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
if test -f /usr/include/types.h
then
echo "#include <types.h>" >> ${TMPFILE}
fi
if test -f /usr/include/sys/types.h
then
echo "#include <sys/types.h>" >> ${TMPFILE}
fi
if test -f /usr/include/netinet/in.h
then
echo "#include <netinet/in.h>" >> ${TMPFILE}
fi
if test -f /usr/include/linux/in.h
then
echo "#include <linux/in.h>" >> ${TMPFILE}
fi
if test -f /usr/include/sys/socket.h
then
echo "#include <sys/socket.h>" >> ${TMPFILE}
fi
echo "void main() {" >> ${TMPFILE}
echo "#ifndef IN_MULTICAST" >> ${TMPFILE}
echo "ERROR" >> ${TMPFILE}
echo "#endif" >> ${TMPFILE}
echo "}" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DNO_MULTICAST"
echo " no"
else
echo " yes"
fi
echo ${ECHO_FLAG} "Do we have tzname[]....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
if test -f /usr/include/time.h
then
echo "#include <time.h>" >> ${TMPFILE}
fi
if test -f /usr/include/sys/time.h
then
echo "#include <sys/time.h>" >> ${TMPFILE}
fi
echo "void main() { int foo = tzname[0]; }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DNO_TZNAME"
echo " no"
else
echo " yes"
fi
echo ${ECHO_FLAG} "Do we have realpath()....${ENDER}"
rm -f foo ${TMPFILE}
echo "#include <stdio.h>" > ${TMPFILE}
echo "void main() { const char *s1 = \"/foo/bar\"; char *s2; (void *)realpath(s1,s2); }" >> ${TMPFILE}
${CC} -o foo ${TMPFILE} >/dev/null 2>&1
if test $? -ne 0
then
MACROS="${MACROS} -DNEED_REALPATH"
echo " no"
else
echo " yes"
fi
rm -f foo ${TMPFILE}
echo ${ECHO_FLAG} "Do we have ranlib....${ENDER}"
ranlib >/dev/null 2>&1
if test $? -eq 0
then
RANLIB="ranlib"
echo " yes"
else
RANLIB="true"
echo " no"
fi
echo ${ECHO_FLAG} "Do we have xemacs....${ENDER}"
xemacs --version >/dev/null 2>&1
if test $? -eq 0
then
EMACS="xemacs"
echo " yes"
else
EMACS="true"
echo " no"
fi
echo "Generating ${MKFILE} file...."
if test -x /bin/echo -a -z "${BSDECHO}"
then
if test "`/bin/echo -n blah`" != "-n blah"
then
BSDECHO="/bin/echo"
fi
fi
if test -x /usr/ucb/echo -a -z "${BSDECHO}"
then
if test "`/usr/ucb/echo -n blah`" != "-n blah"
then
BSDECHO="/usr/ucb/echo"
fi
fi
if test -z "${BSDECHO}"
then
BSDECHO="\$(DIST)/bin/bsdecho"
fi
CPU_ARCH="`uname -m`"
case ${CPU_ARCH} in
000*)
CPU_ARCH="rs6000"
;;
9000*)
CPU_ARCH="hppa"
;;
IP* | RM[45]00 | R[45]000)
CPU_ARCH="mips"
;;
34* | i[3456]86* | i86pc)
CPU_ARCH="x86"
;;
sun4*)
CPU_ARCH="sparc"
;;
esac
for i in ${POSSIBLE_X_DIRS}
do
if test -d ${i}
then
LIB_DIRS="${LIB_DIRS} ${i}"
fi
done
if test ! -z "${LIB_DIRS}"
then
for i in ${LIB_DIRS}
do
if test -f ${i}/libX11.a -o -f ${i}/libX11.so
then
X_DIR="${i}"
break
fi
done
fi
rm -f ${MKFILE}
echo "######################################################################" > ${MKFILE}
echo "# Config stuff for ${ARCH}." >> ${MKFILE}
echo "######################################################################" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "######################################################################" >> ${MKFILE}
echo "# Version-independent" >> ${MKFILE}
echo "######################################################################" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "ARCH := `echo ${ARCH} | tr '[A-Z]' '[a-z]'`" >> ${MKFILE}
echo "CPU_ARCH := ${CPU_ARCH}" >> ${MKFILE}
echo "GFX_ARCH := x" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "CC = ${CC}" >> ${MKFILE}
echo "CCC =" >> ${MKFILE}
echo "BSDECHO = ${BSDECHO}" >> ${MKFILE}
echo "EMACS = ${EMACS}" >> ${MKFILE}
echo "RANLIB = ${RANLIB}" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "OS_INCLUDES = -I/usr/X11/include" >> ${MKFILE}
echo "G++INCLUDES =" >> ${MKFILE}
echo "LOC_LIB_DIR = ${X_DIR}" >> ${MKFILE}
echo "MOTIF =" >> ${MKFILE}
echo "MOTIFLIB = -lXm" >> ${MKFILE}
echo "OS_LIBS =" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "PLATFORM_FLAGS = -D`echo ${ARCH} | tr '[a-z]' '[A-Z]'`" >> ${MKFILE}
echo "MOVEMAIL_FLAGS = ${SPECIAL}" >> ${MKFILE}
echo "PORT_FLAGS = -DSW_THREADS ${MACROS}" >> ${MKFILE}
echo "PDJAVA_FLAGS =" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "OS_CFLAGS = \$(PLATFORM_FLAGS) \$(PORT_FLAGS) \$(MOVEMAIL_FLAGS)" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "######################################################################" >> ${MKFILE}
echo "# Version-specific stuff" >> ${MKFILE}
echo "######################################################################" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "######################################################################" >> ${MKFILE}
echo "# Overrides for defaults in config.mk (or wherever)" >> ${MKFILE}
echo "######################################################################" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "######################################################################" >> ${MKFILE}
echo "# Other" >> ${MKFILE}
echo "######################################################################" >> ${MKFILE}
echo "" >> ${MKFILE}
echo "ifdef SERVER_BUILD" >> ${MKFILE}
echo "STATIC_JAVA = yes" >> ${MKFILE}
echo "endif" >> ${MKFILE}
echo "Generating a default macro file (${XFE_MKFILE}) to be added to cmd/xfe/Makefile...."
rm -f ${XFE_MKFILE}
echo "" > ${XFE_MKFILE}
echo "########################################" >> ${XFE_MKFILE}
echo "# ${ARCH} ${RELEASE} ${CPU_ARCH}" >> ${XFE_MKFILE}
echo "ifeq (\$(OS_ARCH)\$(OS_RELEASE),${ARCH}${RELEASE})" >> ${XFE_MKFILE}
echo "OTHER_LIBS = -L${X_DIR} \$(MOTIFLIB) -lXt -lXmu -lXext -lX11 -lm \$(OS_LIBS)" >> ${XFE_MKFILE}
echo "endif" >> ${XFE_MKFILE}
echo "" >> ${XFE_MKFILE}
exit 0

View File

@@ -0,0 +1,28 @@
#! 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 "/ns/config/fastcwd.pl";
$cur = &fastcwd;
chdir($ARGV[0]);
$newcur = &fastcwd;
$newcurlen = length($newcur);
# Skip common separating / unless $newcur is "/"
$cur = substr($cur, $newcurlen + ($newcurlen > 1));
print $cur;

View File

@@ -0,0 +1,31 @@
#! 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.
#
unshift(@INC, '/usr/lib/perl');
unshift(@INC, '/usr/local/lib/perl');
require "fastcwd.pl";
$cur = &fastcwd;
chdir($ARGV[0]);
$newcur = &fastcwd;
$newcurlen = length($newcur);
# Skip common separating / unless $newcur is "/"
$cur = substr($cur, $newcurlen + ($newcurlen > 1));
print $cur;

514
mozilla/config/rules.mak Normal file
View File

@@ -0,0 +1,514 @@
# 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.
!if !defined(VERBOSE)
.SILENT:
!endif
#//------------------------------------------------------------------------
#//
#// This makefile contains all of the common rules shared by all other
#// makefiles.
#//
#//------------------------------------------------------------------------
!if !defined(CONFIG_RULES_MAK)
CONFIG_RULES_MAK=1
#//------------------------------------------------------------------------
#// Assumed variables by the manifest.
#//------------------------------------------------------------------------
!if !defined(PACKAGE)
PACKAGE=.
!endif # PACKAGE
!if !defined(JDK_GEN_DIR)
JDK_GEN_DIR=_gen
!endif
!if !defined(JDK_STUB_DIR)
JDK_STUB_DIR=_stubs
!endif
!if !defined(JMC_GEN_DIR)
!ifdef MOZ_JAVA
JMC_GEN_DIR=_jmc
!else
JMC_GEN_DIR=$(LOCAL_JMC_SUBDIR)
!endif
!endif
!if !defined(JRI_GEN_DIR)
JRI_GEN_DIR=_jri
!endif
MANIFEST_LEVEL=MACROS
!IF EXIST(manifest.mn) && !defined(IGNORE_MANIFEST)
!IF ["$(MOZ_SRC)\ns\config\mantomak.exe manifest.mn manifest.mnw"] == 0
!INCLUDE <manifest.mnw>
!ELSE
!ERROR ERROR: Unable to generate manifest.mnw from manifest.mn
!ENDIF
!ENDIF
#//------------------------------------------------------------------------
#// Make sure that JDIRS is set after the manifest file is included
#// and before the rules for JDIRS get generated. We cannot put this line
#// in the makefile.win after including rules.mak as the rules would already
#// be generated based on JDIRS set in manifest.mn. We cannot put in ifdefs in
#// manifest.mn too I was told.
#//------------------------------------------------------------------------
!ifdef JDIRS
JDIRS=$(JDIRS) $(JSCD)
!if "$(STAND_ALONE_JAVA)" == "1"
JDIRS=$(JDIRS) $(SAJDIRS)
!endif
!endif
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#// All public win16 headers go to a single directory
#// due to compiler limitations.
#//------------------------------------------------------------------------
MODULE=win16
!endif # 16
OBJS=$(OBJS) $(C_OBJS) $(CPP_OBJS)
include <$(DEPTH)/config/config.mak>
#//------------------------------------------------------------------------
#//
#// Specify a default target if non was set...
#//
#//------------------------------------------------------------------------
!ifndef TARGETS
TARGETS=$(PROGRAM) $(LIBRARY) $(DLL)
!endif
!ifndef MAKE_ARGS
#MAKE_ARGS=all
!endif
all::
$(NMAKE) -f makefile.win export
$(NMAKE) -f makefile.win libs
$(NMAKE) -f makefile.win install
#//------------------------------------------------------------------------
#//
#// Setup tool flags for the appropriate type of objects being built
#// (either DLL or EXE)
#//
#//------------------------------------------------------------------------
!if "$(MAKE_OBJ_TYPE)" == "DLL"
CFLAGS=$(DLL_CFLAGS) $(CFLAGS)
LFLAGS=$(DLL_LFLAGS) $(LFLAGS)
OS_LIBS=$(DLL_LIBS) $(OS_LIBS)
!else
CFLAGS=$(EXE_CFLAGS) $(CFLAGS)
LFLAGS=$(EXE_LFLAGS) $(LFLAGS)
OS_LIBS=$(EXE_LIBS) $(OS_LIBS)
!endif
#//------------------------------------------------------------------------
#//
#// Prepend the "object directory" to any public make variables.
#// PDBFILE - File containing debug info
#// RESFILE - Compiled resource file
#// MAPFILE - MAP file for an executable
#//
#//------------------------------------------------------------------------
!ifdef PDBFILE
PDBFILE=.\$(OBJDIR)\$(PDBFILE)
!else
PDBFILE=NONE
!endif
!ifdef RESFILE
RESFILE=.\$(OBJDIR)\$(RESFILE)
!endif
!ifdef MAPFILE
MAPFILE=.\$(OBJDIR)\$(MAPFILE)
!endif
!ifdef DIRS
#//------------------------------------------------------------------------
#//
#// Rule to recursively make all subdirectories specified by the DIRS target
#//
#//------------------------------------------------------------------------
$(DIRS)::
@echo +++ make: %MAKE_ARGS% in $(MAKEDIR)\$@
@cd $@
@$(NMAKE) -f makefile.win %%MAKE_ARGS%%
@cd $(MAKEDIR)
!endif # DIRS
#//------------------------------------------------------------------------
#//
#// Created directories
#//
#//------------------------------------------------------------------------
$(JAVA_DESTPATH):
!if "$(AWT_11)" == "1"
-mkdir $(XPDIST:/=\)\classes11
!else
-mkdir $(XPDIST:/=\)\classes
!endif
$(JAVA_DESTPATH)\$(PACKAGE): $(JAVA_DESTPATH)
!if "$(AWT_11)" == "1"
-mkdir $(XPDIST:/=\)\classes11\$(PACKAGE:/=\)
!else
-mkdir $(XPDIST:/=\)\classes\$(PACKAGE:/=\)
!endif
$(JMCSRCDIR):
-mkdir $(JMCSRCDIR)
$(XPDIST)\public\$(MODULE):
-mkdir $(XPDIST:/=\)\public\$(MODULE:/=\)
!ifdef IDL_GEN
#//------------------------------------------------------------------------
#//
#// IDL Stuff
#//
#//------------------------------------------------------------------------
idl::
@echo +++ make: Starting osagent
@start $(DEPTH)\modules\iiop\tools\win32\osagent
@echo +++ make: idl2java $(IDL_GEN)
@type <<cmd.cfg
$(IDL2JAVA_FLAGS) $(IDL_GEN)
<<
@$(IDL2JAVA_PROG) -argfile cmd.cfg
@del cmd.cfg
!endif # IDL_GEN
TMPDIR=$(MOZ_SRC)\tmp
$(TMPDIR):
-mkdir $(TMPDIR)
!ifdef JDIRS
!ifdef MOZ_JAVA
#//------------------------------------------------------------------------
#//
#// Rule to recursively make all subdirectories specified by the JDIRS target
#//
#//------------------------------------------------------------------------
export:: $(JAVA_DESTPATH) $(JDIRS)
$(JDIRS):: $(JAVA_DESTPATH) $(TMPDIR)
!if defined(NO_CAFE)
$(JDIRS)::
@echo +++ make: building package: $@
@echo $(JAVAC_PROG) $(JAVAC_FLAGS) > $(TMPDIR)\javac.cfg
-@$(DEPTH)\config\buildpkg $(TMPDIR)\javac.cfg $@
@$(RM) $(TMPDIR)\javac.cfg
# @$(DEPTH)\config\buildpkg $@ $(MOZ_SRC)\ns\dist\classes
!else
# compile using symantec cafe's super-speedy compiler!
$(JDIRS)::
@echo +++ make: building package $@
-@mkdir $(MOZ_SRC)\ns\dist\classes\$@ 2> NUL
$(MOZ_TOOLS)\bin\sj -classpath $(JAVA_DESTPATH);$(JAVA_SOURCEPATH) \
-d $(JAVA_DESTPATH) $(JAVAC_OPTIMIZER) $@\*.java
!endif # NO_CAFE
clobber::
-for %g in ($(JDIRS)) do $(RM_R) $(XPDIST:/=\)/classes/%g
!endif # MOZ_JAVA
!endif # JDIRS
!if defined(INSTALL_FILE_LIST) && defined(INSTALL_DIR)
#//------------------------------------------------------------------------
#//
#// Rule to install the files specified by the INSTALL_FILE_LIST variable
#// into the directory specified by the INSTALL_DIR variable
#//
#//------------------------------------------------------------------------
!if "$(MOZ_BITS)" == "16"
#//------------------------------------------------------------------------
#// All public win16 headers go to a single directory
#// due to compiler limitations.
#//------------------------------------------------------------------------
INSTALL_DIR=$(PUBLIC)\win16
!endif # 16
INSTALL_FILES: $(INSTALL_FILE_LIST)
!$(MAKE_INSTALL) $** $(INSTALL_DIR)
!endif # INSTALL_FILES
!ifdef LIBRARY_NAME
LIBRARY=$(OBJDIR)\$(LIBRARY_NAME)$(LIBRARY_SUFFIX).lib
!endif
#//------------------------------------------------------------------------
#//
#// Global rules...
#//
#//------------------------------------------------------------------------
#//
#// Set the MAKE_ARGS variable to indicate the target being built... This is used
#// when processing subdirectories via the $(DIRS) rule
#//
clean::
@set MAKE_ARGS=$@
clobber::
@set MAKE_ARGS=$@
clobber_all::
@set MAKE_ARGS=$@
export::
@set MAKE_ARGS=$@
libs::
@set MAKE_ARGS=$@
install::
@set MAKE_ARGS=$@
mangle::
@set MAKE_ARGS=$@
unmangle::
@set MAKE_ARGS=$@
depend::
@set MAKE_ARGS=$@
#//------------------------------------------------------------------------
#// DEPEND
#//------------------------------------------------------------------------
MAKEDEP=$(MOZ_TOOLS)\makedep.exe
MAKEDEPFILE=.\$(OBJDIR:/=\)\make.dep
MAKEDEPDETECT=$(OBJS)
MAKEDEPDETECT=$(MAKEDEPDETECT: =)
MAKEDEPDETECT=$(MAKEDEPDETECT: =)
!if !defined(NODEPEND) && "$(MAKEDEPDETECT)" != ""
depend:: $(OBJDIR)
@echo $(MAKEDEP) -s -o $(LINCS) $(OBJS)
$(MAKEDEP) -s -o $(MAKEDEPFILE) @<<
$(LINCS)
$(OBJS)
<<
!endif
!IF EXIST($(MAKEDEPFILE))
!INCLUDE <$(MAKEDEPFILE)>
!ENDIF
export:: $(DIRS)
libs:: $(DIRS) $(LIBRARY)
install:: $(DIRS)
depend:: $(DIRS)
mangle:: $(DIRS)
$(MAKE_MANGLE)
unmangle:: $(DIRS)
-$(MAKE_UNMANGLE)
#//------------------------------------------------------------------------
#//
#// Rule to create the object directory (if necessary)
#//
#//------------------------------------------------------------------------
$(OBJDIR):
@echo +++ make: Creating directory: $(OBJDIR)
echo.
-mkdir $(OBJDIR)
#//------------------------------------------------------------------------
#//
#// Include the makefile for building the various targets...
#//
#//------------------------------------------------------------------------
include <$(DEPTH)/config/obj.inc>
include <$(DEPTH)/config/exe.inc>
include <$(DEPTH)/config/dll.inc>
include <$(DEPTH)/config/lib.inc>
include <$(DEPTH)/config/java.inc>
#//------------------------------------------------------------------------
#//
#// JMC
#//
#// JSRCS .java files to be compiled (.java extension included)
#//
#//------------------------------------------------------------------------
!if defined(MOZ_JAVA)
!if defined(JSRCS)
JSRCS_DEPS = $(JAVA_DESTPATH) $(JAVA_DESTPATH)\$(PACKAGE) $(TMPDIR)
# Can't get moz cafe to compile a single file
!if defined(NO_CAFE)
export:: $(JSRCS_DEPS)
@echo +++ make: building package: $(PACKAGE)
$(MOZ_TOOLS)\perl5\perl.exe $(MOZ_SRC)\ns\config\outofdate.pl \
-d $(JAVA_DESTPATH)\$(PACKAGE) $(JSRCS) >> $(TMPDIR)\javac.cfg
-$(JAVAC_PROG) -argfile $(TMPDIR)\javac.cfg
@$(RM) $(TMPDIR)\javac.cfg
!else
# compile using symantec cafe's super-speedy compiler!
export:: $(JSRC_DEPS)
@echo +++ make: building package: $(PACKAGE)
@echo -d $(JAVA_DESTPATH) $(JAVAC_OPTIMIZER) \
-classpath $(JAVA_DESTPATH);$(JAVA_SOURCEPATH) > $(TMPDIR)\javac.cfg
@$(MOZ_TOOLS)\perl5\perl $(MOZ_SRC)\ns\config\sj.pl \
$(JAVA_DESTPATH)\$(PACKAGE)\ $(TMPDIR)\javac.cfg <<
$(JSRCS)
<<
!endif #NO_CAFE
clobber::
-for %g in ($(JSRCS:.java=.class)) do $(RM) $(XPDIST:/=\)/classes/$(PACKAGE:/=\)/%g
!endif # JSRCS
#//------------------------------------------------------------------------
#//
#// JMC
#//
#// JMC_EXPORT .class files to be copied from XPDIST/classes/PACKAGE to
#// XPDIST/jmc (without the .class extension)
#//
#//------------------------------------------------------------------------
!if defined(JMC_EXPORT)
export:: $(JMCSRCDIR)
for %g in ($(JMC_EXPORT)) do $(MAKE_INSTALL:/=\) $(JAVA_DESTPATH)\$(PACKAGE:/=\)\%g.class $(JMCSRCDIR)
clobber::
-for %f in ($(JMC_EXPORT)) do $(RM) $(JMCSRCDIR:/=\)\%f.class
!endif # JMC_EXPORT
!endif # MOZ_JAVA
#//------------------------------------------------------------------------
#//
#// JMC
#//
#// JMC_GEN Names of classes to be run through JMC
#// Generated .h and .c files go to JMC_GEN_DIR
#//
#//------------------------------------------------------------------------
!if defined(MOZ_JAVA)
!if defined(JMC_GEN)
export:: $(JMC_HEADERS)
# Don't delete them if they don't compile (makes it hard to debug)
.PRECIOUS: $(JMC_HEADERS) $(JMC_STUBS)
# They may want to generate/compile the stubs
!if defined(CCJMC)
{$(JMC_GEN_DIR)\}.c{$(OBJDIR)\}.obj:
@$(CC) @<<$(CFGFILE)
-c $(CFLAGS)
-I. -I$(JMC_GEN_DIR)
-Fd$(PDBFILE)
-Fo.\$(OBJDIR)\
$(JMC_GEN_DIR)\$(*B).c
<<KEEP
export:: $(JMC_STUBS) $(OBJDIR) $(JMC_OBJS)
!endif # CCJMC
!endif # JMC_GEN
!endif # MOZ_JAVA
#//------------------------------------------------------------------------
#//
#// JMC
#//
#// EXPORTS Names of headers to be copied to MODULE
#//
#//------------------------------------------------------------------------
!if defined(EXPORTS)
export:: $(XPDIST)\public\$(MODULE)
for %f in ($(EXPORTS)) do $(MAKE_INSTALL:/=\) %f $(XPDIST:/=\)\public\$(MODULE:/=\)
clobber::
-for %g in ($(EXPORTS)) do $(RM) $(XPDIST:/=\)\public\$(MODULE:/=\)\%g
!endif # EXPORTS
#//------------------------------------------------------------------------
#// These rules must follow all lines that define the macros they use
#//------------------------------------------------------------------------
!ifdef MOZ_JAVA
GARBAGE = $(JMC_GEN_DIR) $(JMC_HEADERS) $(JMC_STUBS) \
$(JDK_STUB_DIR) $(JRI_GEN_DIR) $(JDK_GEN_DIR)
!endif
clean:: $(DIRS)
-$(RM) $(OBJS) $(NOSUCHFILE) NUL 2> NUL
clobber:: $(DIRS)
-$(RM_R) $(GARBAGE) $(OBJDIR) 2> NUL
clobber_all:: $(DIRS)
-$(RM_R) *.OBJ $(TARGETS) $(GARBAGE) $(OBJDIR) 2> NUL
MANIFEST_LEVEL=RULES
!IF EXIST(manifest.mnw) && !defined(IGNORE_MANIFEST)
!INCLUDE <manifest.mnw>
!ENDIF
!if "$(MOZ_BITS)"=="32"
CFLAGS = $(CFLAGS) -DNO_JNI_STUBS
!endif
!endif # CONFIG_RULES_MAK

757
mozilla/config/rules.mk Normal file
View File

@@ -0,0 +1,757 @@
#
# 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.
#
################################################################################
#
# We now use a 3-pass build system. This needs to be re-thought....
#
# Pass 1. export - Create generated headers and stubs. Publish public headers
# to dist/<arch>/include.
#
# Pass 2. libs - Create libraries. Publish libraries to dist/<arch>/lib.
#
# Pass 3. install - Create programs. Publish them to dist/<arch>/bin.
#
# 'gmake' will build each of these properly, but 'gmake -jN' will break (need
# to do each pass explicitly when using -j).
#
# Parameters to this makefile (set these before including):
#
# 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_NAME -- 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)
#
################################################################################
#
# Common rules used by lots of makefiles...
#
ifndef NS_CONFIG_MK
include $(DEPTH)/config/config.mk
endif
ifdef PROGRAM
PROGRAM := $(addprefix $(OBJDIR)/, $(PROGRAM))
endif
ifndef LIBRARY
ifdef LIBRARY_NAME
LIBRARY := lib$(LIBRARY_NAME).$(LIB_SUFFIX)
endif
endif
ifdef LIBRARY
ifdef XP_OS2_VACPP
ifndef DEF_FILE
DEF_FILE := $(LIBRARY:.lib=.def)
endif
endif
LIBRARY := $(addprefix $(OBJDIR)/, $(LIBRARY))
ifdef MKSHLIB
ifdef XP_OS2_VACPP
SHARED_LIBRARY := $(LIBRARY:.lib=.dll)
MAPS := $(LIBRARY:.lib=.map)
else
ifeq ($(OS_ARCH),WINNT)
SHARED_LIBRARY := $(LIBRARY:.lib=.dll)
else
ifeq ($(OS_ARCH),HP-UX)
SHARED_LIBRARY := $(LIBRARY:.a=.sl)
else
ifeq ($(OS_ARCH),FreeBSD)
SHARED_LIBRARY := $(LIBRARY:.a=.so.1.0)
else
ifeq ($(OS_ARCH)$(OS_RELEASE),SunOS4.1)
SHARED_LIBRARY := $(LIBRARY:.a=.so.1.0)
else
ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
SHARED_LIBRARY := $(LIBRARY:.a=)_shr.a
else
SHARED_LIBRARY := $(LIBRARY:.a=.so)
endif
endif
endif
endif
endif
endif
endif
endif
ifndef TARGETS
TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
endif
ifndef OBJS
OBJS = $(JRI_STUB_CFILES) $(addsuffix .o, $(JMC_GEN)) $(CSRCS:.c=.o) $(CPPSRCS:.cpp=.o) $(ASFILES:.s=.o)
endif
OBJS := $(addprefix $(OBJDIR)/, $(OBJS))
ifdef REQUIRES
MODULE_PREINCLUDES = $(addprefix -I$(XPDIST)/public/, $(REQUIRES))
endif
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
ifdef DLL
DLL := $(addprefix $(OBJDIR)/, $(DLL))
ifeq ($(OS_ARCH),WINNT)
LIB := $(addprefix $(OBJDIR)/, $(LIB))
endif
endif
MAKE_OBJDIR = mkdir $(OBJDIR)
else
define MAKE_OBJDIR
if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi
endef
endif
ifndef OS2_IMPLIB
LIBOBJS := $(addprefix \", $(OBJS))
LIBOBJS := $(addsuffix \", $(LIBOBJS))
endif
ifndef PACKAGE
PACKAGE = .
endif
ifdef MOZ_JAVA
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 gts_tmp_*) \
$(wildcard $(JAVA_DESTPATH)/$(PACKAGE)/*.class)
else
ALL_TRASH = $(TARGETS) $(OBJS) $(OBJDIR) LOGS TAGS $(GARBAGE) \
$(NOSUCHFILE) \
$(JMC_STUBS) \
so_locations \
_gen _stubs $(wildcard gts_tmp_*)
endif
ifdef MOZ_JAVA
ifdef JDIRS
ALL_TRASH += $(addprefix $(JAVA_DESTPATH)/,$(JDIRS))
endif
endif
ifdef MOZ_JAVA
JMC_SUBDIR = _jmc
else
JMC_SUBDIR = $(LOCAL_JMC_SUBDIR)
endif
ifdef NSBUILDROOT
JDK_GEN_DIR = $(XPDIST)/_gen
JMC_GEN_DIR = $(XPDIST)/$(JMC_SUBDIR)
JRI_GEN_DIR = $(XPDIST)/_jri
JDK_STUB_DIR = $(XPDIST)/_stubs
else
JDK_GEN_DIR = _gen
JMC_GEN_DIR = $(JMC_SUBDIR)
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 DIRS
LOOP_OVER_DIRS = \
@for d in $(DIRS); do \
if test -d $$d; then \
set $(EXIT_ON_ERROR); \
echo "cd $$d; $(MAKE) $@"; \
oldDir=`pwd`; \
cd $$d; $(MAKE) $@; cd $$oldDir; \
set +e; \
else \
echo "Skipping non-directory $$d..."; \
fi; \
$(CLICK_STOPWATCH); \
done
endif
################################################################################
all:: export libs install
#
# Maybe this should be done in config/Makefile so it only happens once...?
#
TARGETS += tweak_nspr
#
# Since the NSPR folks won't help, we'll fix things the sneaky way.
#
tweak_nspr:
@(cd $(DEPTH)/nsprpub/config; \
if test -f UNIX.mk.orig; then rm -f UNIX.mk; mv UNIX.mk.orig UNIX.mk; fi; \
mv UNIX.mk UNIX.mk.orig; \
awk '/^OBJDIR_NAME[ ]*=/ { \
printf("OBJDIR_NAME\t= %s%s%s%s%s%s.OBJ\n","$(OS_CONFIG)","$(OS_VERSION)","$(PROCESSOR_ARCHITECTURE)","$(COMPILER)","$(IMPL_STRATEGY)","$(OBJDIR_TAG)"); next} {print}' UNIX.mk.orig > UNIX.mk)
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
export::
+$(LOOP_OVER_DIRS)
libs install:: $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(MAPS)
ifdef LIBRARY
$(INSTALL) -m 444 $(LIBRARY) $(DIST)/lib
endif
ifdef MAPS
$(INSTALL) -m 444 $(MAPS) $(DIST)/bin
endif
ifdef SHARED_LIBRARY
$(INSTALL) -m 555 $(SHARED_LIBRARY) $(DIST)/bin
endif
ifdef PROGRAM
$(INSTALL) -m 444 $(PROGRAM) $(DIST)/bin
endif
+$(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)
alltags:
rm -f TAGS
find . -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' \) -print | xargs etags -a
$(PROGRAM): $(OBJS)
@$(MAKE_OBJDIR)
ifdef XP_OS2_VACPP
$(LINK) -FREE -OUT:$@ $(LDFLAGS) $(OS_LFLAGS) $(OBJS) $(EXTRA_LIBS) -MAP:$(@:.exe=.map) $(OS_LIBS) $(DEF_FILE)
else
ifeq ($(OS_ARCH),WINNT)
$(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
else
$(CCF) -o $@ $(OBJS) $(LDFLAGS)
endif
endif
ifneq ($(OS_ARCH),OS2)
$(LIBRARY): $(OBJS) $(LOBJS)
@$(MAKE_OBJDIR)
rm -f $@
$(AR) $(OBJS) $(LOBJS)
$(RANLIB) $@
else
ifdef XP_OS2_VACPP
ifdef OS2_IMPLIB
$(LIBRARY): $(OBJS) $(DEF_FILE)
@$(MAKE_OBJDIR)
rm -f $@
$(IMPLIB) $@ $(DEF_FILE)
$(RANLIB) $@
else
$(LIBRARY): $(OBJS)
@$(MAKE_OBJDIR)
rm -f $@
$(AR) $(LIBOBJS),,
$(RANLIB) $@
endif
endif
endif
ifneq ($(OS_ARCH),OS2)
$(SHARED_LIBRARY): $(OBJS) $(LOBJS)
@$(MAKE_OBJDIR)
rm -f $@
$(MKSHLIB) -o $@ $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS)
chmod +x $@
else
ifdef XP_OS2_VACPP
$(SHARED_LIBRARY): $(OBJS) $(DEF_FILE)
@$(MAKE_OBJDIR)
rm -f $@
$(LINK_DLL) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
chmod +x $@
endif
endif
ifeq ($(OS_ARCH),WINNT)
$(DLL): $(OBJS) $(EXTRA_LIBS)
@$(MAKE_OBJDIR)
rm -f $@
$(LINK_DLL) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS)
endif
ifdef XP_OS2_VACPP
@$(MAKE_OBJDIR)
rm -f $@
$(LINK_DLL) $(OBJS) $(EXTRA_LIBS) $(OS_LIBS)
endif
$(OBJDIR)/%: %.c
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH),WINNT)
$(CC) -Fo$@ -c $(CFLAGS) $*.c
else
ifndef XP_OS2_VACPP
$(CCF) $(LDFLAGS) -o $@ $*.c
else
$(CC) -Fo$@ -c $(CFLAGS) $*.c
endif
endif
$(OBJDIR)/%.o: %.c
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH),WINNT)
$(CC) -Fo$@ -c $(CFLAGS) $*.c
else
ifndef XP_OS2_VACPP
$(CC) -o $@ -c $(CFLAGS) $*.c
else
$(CC) -Fo$@ -c $(CFLAGS) $*.c
endif
endif
$(OBJDIR)/%.o: %.s
@$(MAKE_OBJDIR)
$(AS) -o $@ $(ASFLAGS) -c $*.s
$(OBJDIR)/%.o: %.S
@$(MAKE_OBJDIR)
$(AS) -o $@ $(ASFLAGS) -c $*.S
$(OBJDIR)/%: %.cpp
@$(MAKE_OBJDIR)
$(CCC) -o $@ $(CFLAGS) $*.c $(LDFLAGS)
#
# Please keep the next two rules in sync.
#
$(OBJDIR)/%.o: %.cc
@$(MAKE_OBJDIR)
$(CCC) -o $@ -c $(CFLAGS) $*.cc
$(OBJDIR)/%.o: %.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
ifndef XP_OS2_VACPP
$(CCC) -o $@ -c $(CFLAGS) $*.cpp
else
$(CCC) -Fo$@ -c $(CFLAGS) $*.cpp
endif
endif
endif #STRICT_CPLUSPLUS_SUFFIX
%.i: %.cpp
$(CCC) -C -E $(CFLAGS) $< > $*.i
%.i: %.c
$(CC) -C -E $(CFLAGS) $< > $*.i
%: %.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
################################################################################
### JSRCS -- for compiling java files
ifneq ($(JSRCS),)
ifdef MOZ_JAVA
export:: $(JAVA_DESTPATH) $(JAVA_DESTPATH)/$(PACKAGE)
list=`$(PERL) $(DEPTH)/config/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 $(XPDIST)/classes/$(PACKAGE)/*.class
endif
endif
#
# JDIRS -- like JSRCS, except you can give a list of directories and it will
# compile all the out-of-date java files in those directories.
#
# NOTE: recursing through these can speed things up, but they also cause
# some builds to run out of memory
#
ifdef JDIRS
ifdef MOZ_JAVA
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) $(DEPTH)/config/outofdate.pl $(PERLARG) \
-d $(JAVA_DESTPATH)/$(PACKAGE) $$files`; \
if test "$${list}x" != "x"; then \
echo Building all java files in $$d; \
echo $(JAVAC) $$list; \
$(JAVAC) $$list; \
fi; \
set +e; \
else \
echo "Skipping non-directory $$d..."; \
fi; \
$(CLICK_STOPWATCH); \
done
endif
endif
#
# JDK_GEN -- for generating "old style" native methods
#
# Generate JDK Headers and Stubs into the '_gen' and '_stubs' directory
#
ifneq ($(JDK_GEN),)
ifdef MOZ_JAVA
ifdef NSBUILDROOT
INCLUDES += -I$(JDK_GEN_DIR) -I$(XPDIST)
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)
ifdef MOZ_GENMAC
@if test ! -d $(DEPTH)/lib/mac/Java/; then \
echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \
echo "!!! This allows us to automatically update generated files for the mac."; \
echo "!!! If you see any modified files there, please check them in."; \
fi
@echo Generating/Updating JDK headers for the Mac
$(JAVAH) -mac -d $(DEPTH)/lib/mac/Java/_gen $(JDK_PACKAGE_CLASSES)
@echo Generating/Updating JDK stubs for the Mac
$(JAVAH) -mac -stubs -d $(DEPTH)/lib/mac/Java/_stubs $(JDK_PACKAGE_CLASSES)
endif
endif # MOZ_JAVA
endif
#
# JRI_GEN -- for generating JRI native methods
#
# Generate JRI Headers and Stubs into the 'jri' directory
#
ifneq ($(JRI_GEN),)
ifdef MOZ_JAVA
ifdef NSBUILDROOT
INCLUDES += -I$(JRI_GEN_DIR) -I$(XPDIST)
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)
ifdef MOZ_GENMAC
@if test ! -d $(DEPTH)/lib/mac/Java/; then \
echo "!!! You need to have a ns/lib/mac/Java directory checked out."; \
echo "!!! This allows us to automatically update generated files for the mac."; \
echo "!!! If you see any modified files there, please check them in."; \
fi
@echo Generating/Updating JRI headers for the Mac
$(JAVAH) -jri -mac -d $(DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
@echo Generating/Updating JRI stubs for the Mac
$(JAVAH) -jri -mac -stubs -d $(DEPTH)/lib/mac/Java/_jri $(JRI_PACKAGE_CLASSES)
endif
endif # MOZ_JAVA
endif
#
# JMC_EXPORT -- for declaring which java classes are to be exported for jmc
#
ifneq ($(JMC_EXPORT),)
ifdef MOZ_JAVA
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 # MOZ_JAVA
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.
ifdef MOZ_JAVA
JMC_HEADERS = $(patsubst %,$(JMC_GEN_DIR)/%.h,$(JMC_GEN))
JMC_STUBS = $(patsubst %,$(JMC_GEN_DIR)/%.c,$(JMC_GEN))
JMC_OBJS = $(patsubst %,$(OBJDIR)/%.o,$(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%.o: $(JMC_GEN_DIR)/M%.h $(JMC_GEN_DIR)/M%.c
@$(MAKE_OBJDIR)
ifdef XP_OS2_VACPP
$(CC) -Fo$@ -c $(CFLAGS) $(JMC_GEN_DIR)/M$*.c
else
$(CC) -o $@ -c $(CFLAGS) $(JMC_GEN_DIR)/M$*.c
endif
export:: $(JMC_HEADERS) $(JMC_STUBS)
endif # MOZ_JAVA
endif
#
# Copy each element of EXPORTS to $(XPDIST)/public/$(MODULE)/
#
ifneq ($(EXPORTS),)
$(XPDIST)/public/$(MODULE)::
@if test ! -d $@; then \
echo Creating $@; \
rm -rf $@; \
$(NSINSTALL) -D $@; \
fi
export:: $(EXPORTS) $(XPDIST)/public/$(MODULE)
$(INSTALL) -m 444 $(EXPORTS) $(XPDIST)/public/$(MODULE)
endif
################################################################################
-include $(DEPENDENCIES)
ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
# Can't use sed because of its 4000-char line length limit, so resort to perl
.DEFAULT:
@$(PERL) -e ' \
open(MD, "< $(DEPENDENCIES)"); \
while (<MD>) { \
if (m@ \.*/*$< @) { \
$$found = 1; \
last; \
} \
} \
if ($$found) { \
print "Removing stale dependency $< from $(DEPENDENCIES)\n"; \
seek(MD, 0, 0); \
$$tmpname = "$(OBJDIR)/fix.md" . $$$$; \
open(TMD, "> " . $$tmpname); \
while (<MD>) { \
s@ \.*/*$< @ @; \
if (!print TMD "$$_") { \
unlink(($$tmpname)); \
exit(1); \
} \
} \
close(TMD); \
if (!rename($$tmpname, "$(DEPENDENCIES)")) { \
unlink(($$tmpname)); \
} \
} elsif ("$<" ne "$(DEPENDENCIES)") { \
print "$(MAKE): *** No rule to make target $<. Stop.\n"; \
exit(1); \
}'
endif
#############################################################################
# X dependency system
#############################################################################
ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
$(MKDEPENDENCIES)::
@$(MAKE_OBJDIR)
touch $(MKDEPENDENCIES)
$(MKDEPEND) -p$(OBJDIR_NAME)/ -o'.o' -f$(MKDEPENDENCIES) $(INCLUDES) $(CSRCS) $(CPPSRCS)
$(MKDEPEND)::
cd $(MKDEPEND_DIR); $(MAKE)
ifdef OBJS
depend:: $(MKDEPEND) $(MKDEPENDENCIES)
else
depend::
endif
+$(LOOP_OVER_DIRS)
dependclean::
rm -f $(MKDEPENDENCIES)
+$(LOOP_OVER_DIRS)
-include $(OBJDIR)/depend.mk
endif
#############################################################################
-include $(MY_RULES)
#
# This speeds up gmake's processing if these files don't exist.
#
$(MY_CONFIG) $(MY_RULES):
@touch $@
#
# Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
# or in $(MY_RULES)
#
ifdef ETAGS
ifneq ($(CSRCS)$(HEADERS),)
all:: TAGS
TAGS:: $(CSRCS) $(CPPSRCS) $(HEADERS)
$(ETAGS) $(CSRCS) $(CPPSRCS) $(HEADERS)
endif
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 .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 $(OBJDIR) $(DIRS)

89
mozilla/config/sj.pl Executable file
View File

@@ -0,0 +1,89 @@
#!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.
#
#
# Input: output_class_dir argfile javafilelist
#
$classdir = $ARGV[0];
$argfile = $ARGV[1];
$filelist = $ARGV[2];
shift;
$sjcmd = $ENV{'MOZ_TOOLS'} . '\bin\sj.exe';
open(FL, "<$filelist" ) || die "can't open $filelist for reading";
while( <FL> ){
# print;
@java_files = (@java_files, split(/[ \t\n]/));
}
close (FL);
open(FL, "<$argfile" ) || die "can't open $argfile for reading";
while( <FL> ){
chop;
$args .= $_;
}
close (FL);
print "Java Files: @java_files\n";
# compile as many java files as we can in one invocation
# given the limitations of the command line
foreach $filename (@java_files) {
$classfilename = $classdir;
$classfilename .= $filename;
$classfilename =~ s/.java$/.class/;
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
$ctime,$blksize,$blocks) = stat($filename);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$classmtime,
$ctime,$blksize,$blocks) = stat($classfilename);
# print $filename, " ", $mtime, ", ", $classfilename, " ", $classmtime, "\n";
if ($mtime > $classmtime) {
# are we too big?
$len += length($filename);
if( $len >= 512 ) {
print "$sjcmd $args $outofdate\n";
$status = system "$sjcmd $args $outofdate";
if( $status != 0 ) {
exit( $status / 256 );
}
$outofdate = "";
$len = length($filename);
}
$outofdate .= $filename;
$outofdate .= " ";
}
}
if( length($outofdate) > 0 ) {
print "$sjcmd $args $outofdate\n";
$status = system "$sjcmd $args $outofdate";
if( $status != 0 ) {
exit( $status / 256 );
}
} else {
print "Files are up to date.\n";
}
print "\n";

18
mozilla/config/true.bat Normal file
View File

@@ -0,0 +1,18 @@
@echo off
rem The contents of this file are subject to the Netscape Public License
rem Version 1.0 (the "NPL"); you may not use this file except in
rem compliance with the NPL. You may obtain a copy of the NPL at
rem http://www.mozilla.org/NPL/
rem
rem Software distributed under the NPL is distributed on an "AS IS" basis,
rem WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
rem for the specific language governing rights and limitations under the
rem NPL.
rem
rem The Initial Developer of this code under the NPL is Netscape
rem Communications Corporation. Portions created by Netscape are
rem Copyright (C) 1998 Netscape Communications Corporation. All Rights
rem Reserved.
@echo on
@echo off

105
mozilla/config/xmversion.sh Executable file
View File

@@ -0,0 +1,105 @@
#!/bin/sh
#
# 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.
#
##############################################################################
##
## Name: xmversion.sh - a fast way to get a motif lib's version
##
## Description: Print the major version number for motif libs on the
## system that executes the script. Can be tweaked to output
## more info. (such as cmd line args to print major/minor
## version numbers). Currently prints only the major number.
##
## Also, more checks need to be added for more platforms.
## Currently this script is only usefull in the Linux Universe
## where there are a many versions of motif.
##
## Author: Ramiro Estrugo <ramiro@netscape.com>
##
##############################################################################
# The string build into the motif libs
MOTIF_VERSION_STRING="Motif Version"
# Make motif 1.x the default
MOTIF_DEFAULT_VERSION=1
# Reasonable defaults for motif lib locations
MOTIF_LIB_DIR=/usr/lib
MOTIF_STATIC_LIB=libXm.a
MOTIF_SHARED_LIB=libXm.so
os=`uname`
case `uname`
in
Linux)
case `uname -m`
in
ppc)
MOTIF_LIB_DIR=/usr/local/motif-1.2.4/lib
;;
i386|i486|i586|i686)
MOTIF_LIB_DIR=/usr/X11R6/lib
;;
esac
;;
SunOS)
case `uname -r`
in
5.3|5.4|5.5.1|5.6)
MOTIF_LIB_DIR=/usr/dt/lib
;;
esac
;;
HP-UX)
MOTIF_LIB_DIR=/usr/lib/Motif1.2
MOTIF_SHARED_LIB=libXm.sl
;;
AIX)
MOTIF_LIB_DIR=/usr/lib
MOTIF_SHARED_LIB=libXm.a
;;
esac
# Look for the shared one first
MOTIF_LIB=
if [ -f $MOTIF_LIB_DIR/$MOTIF_SHARED_LIB ]
then
MOTIF_LIB=$MOTIF_LIB_DIR/$MOTIF_SHARED_LIB
else
if [ -f $MOTIF_LIB_DIR/$MOTIF_STATIC_LIB ]
then
MOTIF_LIB=$MOTIF_LIB_DIR/$MOTIF_STATIC_LIB
else
echo $MOTIF_DEFAULT_VERSION
exit
fi
fi
VERSION=`strings $MOTIF_LIB | grep "Motif Version" | awk '{ print $3;}'`
MAJOR=`echo $VERSION | awk -F"." '{ print $1; }'`
echo $MAJOR

121
mozilla/makefile.win Normal file
View File

@@ -0,0 +1,121 @@
# 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.
#//------------------------------------------------------------------------
#//
#// Makefile to build the NS tree
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of NS
#//
#//------------------------------------------------------------------------
DEPTH=.
#//------------------------------------------------------------------------
#//
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
#// (these must come before the common makefiles are included)
#//
#// DIRS - There are subdirectories to process
#//
#// netcast needs to be before sun-java so marimba.* package is available
#// to netscape.netcast.* - spider
#//------------------------------------------------------------------------
!ifdef NO_SECURITY
SECDIR=
!else
SECDIR=security
!endif
DISTDIRS=$(NSPRDIR) dbm $(SECDIR) xpcom
!if "$(WATCOM)" != ""
XTRADIRS = $(DISTDIRS)
!endif
!if "$(MOZ_BITS)" == "32"
DIRS_JSD = js\jsd
XTRADIRS = $(DISTDIRS)
!endif
!ifndef NO_SECURITY
CORECONF=coreconf
!else
CORECONF=
!endif
DIRS = $(CORECONF) $(XTRADIRS) include jpeg modules\zlib \
!ifdef MOZ_NETCAST
netcast \
!endif
sun-java \
!ifdef MOZ_LDAP
ldap \
!endif
!ifdef MOZ_JAVA
ifc js nav-java \
!else
nav-java js \
!endif
!ifdef MOZ_IFC_TOOLS
ifc\tools \
!endif
!ifdef MOZ_JAVA
$(DIRS_JSD) \
!endif
lib modules cmd
!if "$(STAND_ALONE_JAVA)" == "1"
!if "$(OS_TARGET)" == "WINNT"
#// When we build stand alone java with OS_TARGET == WINNT for
#// nspr20, we do a gmake separately outside of makefile.win
#// hence no NSPRDIR - sudu
DIRS=jpeg modules\zlib sun-java ifc js ifc\tools sun-java\java
!else
DIRS=$(NSPRDIR) jpeg modules\zlib sun-java ifc js ifc\tools sun-java\java
!endif
!endif
!ifdef NSWINDBGMALLOC
LLFLAGS= $(LLFLAGS) \
/EXPORT:malloc=ns_malloc \
/EXPORT:realloc=ns_realloc \
/EXPORT:calloc=ns_calloc \
/EXPORT:free=ns_free \
/EXPORT:_strdup=ns_strdup
!endif
!ifdef SERVER_BUILD
LLIBS=$(DIST)/lib/httpdlw.lib $(DIST)/lib/libsjboot.lib
!endif
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
include <$(DEPTH)\config\rules.mak>
#LCFLAGS=-D_USE_PR_DEBUG_MEMORY $(LCFLAGS)
clobber_all::
cd $(MOZ_SRC)\ns
-rd /s /q dist

View File

@@ -1,38 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = \
public \
memcache \
filecache \
mgr \
build \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@@ -1,33 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..
DIRS= \
public \
mgr \
memcache \
filecache \
build \
$(NULL)
include <$(DEPTH)\config\rules.mak>

View File

@@ -1,54 +0,0 @@
#
# 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 = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = nkcache
LIBRARY_NAME = nkcache
IS_COMPONENT = 1
CPPSRCS = nsNetDataCacheModule.cpp
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/libnkcachemgr_s.a \
$(DIST)/lib/libnkfilecache_s.a \
$(DIST)/lib/libnkmemcache_s.a \
$(DIST)/lib/libmozdbm_s.a \
$(DIST)/lib/libxpcomio_s.a \
$(NULL)
LOCAL_INCLUDES = \
-I$(DEPTH)/netwerk/cache/memcache \
-I$(DEPTH)/netwerk/cache/filecache \
-I$(DEPTH)/netwerk/cache/mgr \
$(NULL)
EXTRA_DSO_LDOPTS = \
$(MKSHLIB_FORCE_ALL) \
$(SHARED_LIBRARY_LIBS) \
$(MKSHLIB_UNFORCE_ALL) \
$(NULL)
include $(topsrcdir)/config/rules.mk
$(LIBRARY) $(SHARED_LIBRARY): $(SHARED_LIBRARY_LIBS) Makefile

View File

@@ -1,51 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
DEPTH=..\..\..
MODULE=nkcache
MAKE_OBJ_TYPE=DLL
DLLNAME=nkcache
DLL=.\$(OBJDIR)\$(DLLNAME).dll
CPP_OBJS= \
.\$(OBJDIR)\nsNetDataCacheModule.obj \
$(NULL)
LLIBS= \
$(DIST)\lib\nkcachemgr_s.lib \
$(DIST)\lib\nkfilecache_s.lib \
$(DIST)\lib\nkmemcache_s.lib \
$(DIST)\lib\dbm32.lib \
$(DIST)\lib\xpcom.lib \
$(LIBNSPR)
INCS = $(INCS) \
-I$(DEPTH)\netwerk\cache\memcache \
-I$(DEPTH)\netwerk\cache\filecache \
-I$(DEPTH)\netwerk\cache\mgr \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib

View File

@@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
*/
#include "nsCOMPtr.h"
#include "nsIModule.h"
#include "nscore.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIGenericFactory.h"
#include "nsINetDataCache.h"
#include "nsINetDataCacheManager.h"
#include "nsMemCacheCID.h"
#include "nsMemCache.h"
#include "nsNetDiskCache.h"
#include "nsNetDiskCacheCID.h"
#include "nsCacheManager.h"
// Factory method to create a new nsMemCache instance. Used
// by nsNetDataCacheModule
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMemCache, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNetDiskCache, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCacheManager, Init)
static nsModuleComponentInfo components[] = {
{ "Memory Cache", NS_MEM_CACHE_FACTORY_CID, NS_NETWORK_MEMORY_CACHE_PROGID, nsMemCacheConstructor },
{ "File Cache", NS_NETDISKCACHE_CID, NS_NETWORK_FILE_CACHE_PROGID, nsNetDiskCacheConstructor },
{ "Cache Manager",NS_CACHE_MANAGER_CID, NS_NETWORK_CACHE_MANAGER_PROGID,nsCacheManagerConstructor }
};
NS_IMPL_NSGETMODULE("Network Data Cache", components)

View File

@@ -1,56 +0,0 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla Communicator.
#
# The Initial Developer of the Original Code is Intel Corp.
# Portions created by Intel Corp. are
# Copyright (C) 1999, 1999 Intel Corp. All
# Rights Reserved.
#
# Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
# Carl Wong <carl.wong@intel.com>
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = nkcache
LIBRARY_NAME = nkfilecache_s
REQUIRES = nspr dbm
EXTRA_DSO_LDOPTS += -L$(DIST)/lib -lmozdbm_s
EXPORTS=nsNetDiskCacheCID.h
CPPSRCS = \
nsDBAccessor.cpp\
nsDBEnumerator.cpp \
nsNetDiskCache.cpp \
nsDiskCacheRecord.cpp \
nsDiskCacheRecordChannel.cpp \
$(NULL)
EXTRA_LIBS = $(NSPR_LIBS)
# we don't want the shared lib, but we want to force the creation of a
# static lib.
override NO_SHARED_LIB=1
override NO_STATIC_LIB=
include $(topsrcdir)/config/rules.mk

View File

@@ -1,351 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is Intel Corp.
* Portions created by Intel Corp. are
* Copyright (C) 1999, 1999 Intel Corp. All
* Rights Reserved.
*
* Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
* Carl Wong <carl.wong@intel.com>
*/
// FUR - Add overall description comment here
#include "nsDBAccessor.h"
#include "nscore.h"
#include "prtypes.h"
#include "plhash.h"
#include "nsCRT.h"
#include "nsAutoLock.h"
nsDBAccessor::nsDBAccessor() :
mDB(0) ,
mSessionID(0) ,
mSessionCntr(0)
{
NS_INIT_REFCNT();
}
nsDBAccessor::~nsDBAccessor()
{
printf(" ~nsDBAccessor\n") ;
Shutdown() ;
}
//
// Implement nsISupports methods
//
NS_IMPL_ISUPPORTS(nsDBAccessor, NS_GET_IID(nsIDBAccessor))
///////////////////////////////////////////////////////////
// nsIDBAccessor methods
NS_IMETHODIMP
nsDBAccessor::Init(nsIFileSpec* dbfile)
{
// FUR - lock not needed
m_Lock = PR_NewLock() ;
if(!m_Lock)
return NS_ERROR_OUT_OF_MEMORY ;
char* dbname ;
// this should cover all platforms.
dbfile->GetNativePath(&dbname) ;
// FUR - how is page size chosen ? It's worth putting a comment
// in here about the possible usefulness of tuning these parameters
HASHINFO hash_info = {
16*1024 , /* bucket size */
0 , /* fill factor */
0 , /* number of elements */
0 , /* bytes to cache */
0 , /* hash function */
0} ; /* byte order */
// FUR - lock not needed
nsAutoLock lock(m_Lock) ;
mDB = dbopen(dbname,
O_RDWR | O_CREAT ,
0600 ,
DB_HASH ,
& hash_info) ;
// FUR - does dbname have to be free'ed ?
if(!mDB)
return NS_ERROR_FAILURE ;
// set mSessionID
// FUR - Why the +1 ? (No need for key to be NUL-terminated string.)
PRUint32 len = PL_strlen(SessionKey)+1 ;
DBT db_key, db_data ;
db_key.data = NS_CONST_CAST(char*, SessionKey) ;
db_key.size = len ;
int status = (*mDB->get)(mDB, &db_key, &db_data, 0) ;
if(status == -1) {
NS_ERROR("ERROR: failed get session id in database.") ;
return NS_ERROR_FAILURE ;
}
if(status == 0) {
// get the last session id
PRInt16 *old_ID = NS_STATIC_CAST(PRInt16*, db_data.data) ;
if(*old_ID < ini_sessionID) {
NS_ERROR("ERROR: Bad Session ID in database, corrupted db.") ;
return NS_ERROR_FAILURE ;
}
// FUR - need to comment out all printfs, or turn them into PR_LOG statements
printf("found previous session, id = %d\n", *old_ID) ;
mSessionID = *old_ID + 1 ;
}
else if(status == 1) {
// must be a new db
mSessionID = ini_sessionID ;
}
db_data.data = NS_REINTERPRET_CAST(void*, &mSessionID) ;
db_data.size = sizeof(PRInt16) ;
// store the new session id
status = (*mDB->put)(mDB, &db_key, &db_data, 0) ;
if(status == 0) {
(*mDB->sync)(mDB, 0) ;
return NS_OK ;
}
else {
NS_ERROR("reset session ID failure.") ;
return NS_ERROR_FAILURE ;
}
}
NS_IMETHODIMP
nsDBAccessor::Shutdown(void)
{
if(mDB) {
(*mDB->sync)(mDB, 0) ;
(*mDB->close)(mDB) ;
mDB = nsnull ;
}
// FUR - locks not necessary
if(m_Lock)
PR_DestroyLock(m_Lock);
return NS_OK ;
}
NS_IMETHODIMP
nsDBAccessor::Get(PRInt32 aID, void** anEntry, PRUint32 *aLength)
{
if(!anEntry)
return NS_ERROR_NULL_POINTER ;
*anEntry = nsnull ;
*aLength = 0 ;
NS_ASSERTION(mDB, "no database") ;
// Lock the db
nsAutoLock lock(m_Lock) ;
DBT db_key, db_data ;
db_key.data = NS_REINTERPRET_CAST(void*, &aID) ;
db_key.size = sizeof(PRInt32) ;
int status = 0 ;
status = (*mDB->get)(mDB, &db_key, &db_data, 0) ;
if(status == 0) {
*anEntry = db_data.data ;
*aLength = db_data.size ;
return NS_OK ;
}
else if(status == 1)
return NS_OK ;
else
return NS_ERROR_FAILURE ;
}
NS_IMETHODIMP
nsDBAccessor::Put(PRInt32 aID, void* anEntry, PRUint32 aLength)
{
NS_ASSERTION(mDB, "no database") ;
// Lock the db
nsAutoLock lock(m_Lock) ;
DBT db_key, db_data ;
db_key.data = NS_REINTERPRET_CAST(void*, &aID) ;
db_key.size = sizeof(PRInt32) ;
db_data.data = anEntry ;
db_data.size = aLength ;
if(0 == (*mDB->put)(mDB, &db_key, &db_data, 0)) {
// FUR - I would avoid unnecessary sync'ing for performance's
// sake. Maybe you could limit sync to max rate of, say, once
// every few seconds by keeping track of last sync time, using PR_Now().
(*mDB->sync)(mDB, 0) ;
return NS_OK ;
}
else {
// FUR - Try to avoid using NS_ERROR unless error is unrecoverable and serious
NS_ERROR("ERROR: Failed to put anEntry into db.\n") ;
return NS_ERROR_FAILURE ;
}
}
/*
* It's more important to remove the id->metadata entry first since
* key->id mapping is just a reference
*/
NS_IMETHODIMP
nsDBAccessor::Del(PRInt32 aID, void* anEntry, PRUint32 aLength)
{
NS_ASSERTION(mDB, "no database") ;
// FUR - no locks necessary
// Lock the db
nsAutoLock lock(m_Lock) ;
DBT db_key ;
// delete recordID->metadata
db_key.data = NS_REINTERPRET_CAST(void*, &aID) ;
db_key.size = sizeof(PRInt32) ;
PRInt32 status = -1 ;
status = (*mDB->del)(mDB, &db_key, 0) ;
if(-1 == status) {
// FUR - no printf's, use PR_LOG, NS_WARNING, or NS_ASSERTION, as the situation warrants
printf(" delete error\n") ;
return NS_ERROR_FAILURE ;
}
// delete key->recordID
db_key.data = anEntry ;
db_key.size = aLength ;
status = (*mDB->del)(mDB, &db_key, 0) ;
if(-1 == status) {
// FUR - no printf's
printf(" delete error\n") ;
return NS_ERROR_FAILURE ;
}
// FUR - Defer sync ? See above
(*mDB->sync)(mDB, 0) ;
return NS_OK ;
}
NS_IMETHODIMP
nsDBAccessor::GetID(const char* key, PRUint32 length, PRInt32* aID)
{
NS_ASSERTION(mDB, "no database") ;
// Lock the db
nsAutoLock lock(m_Lock) ;
DBT db_key, db_data ;
db_key.data = NS_CONST_CAST(char*, key) ;
db_key.size = length ;
int status = (*mDB->get)(mDB, &db_key, &db_data, 0) ;
if(status == 0) {
// found recordID
*aID = *(NS_REINTERPRET_CAST(PRInt32*, db_data.data)) ;
return NS_OK ;
}
else if(status == 1) {
// create a new one
PRInt32 id = 0 ;
id = mSessionID << 16 | mSessionCntr++ ;
// add new id into mDB
db_data.data = NS_REINTERPRET_CAST(void*, &id) ;
db_data.size = sizeof(PRInt32) ;
status = (*mDB->put)(mDB, &db_key, &db_data, 0) ;
if(status != 0) {
NS_ERROR("updating db failure.") ;
return NS_ERROR_FAILURE ;
}
// FUR - defer sync ?
(*mDB->sync)(mDB, 0) ;
*aID = id ;
return NS_OK ;
}
else {
NS_ERROR("ERROR: keydb failure.") ;
return NS_ERROR_FAILURE ;
}
}
NS_IMETHODIMP
nsDBAccessor::EnumEntry(void** anEntry, PRUint32* aLength, PRBool bReset)
{
if(!anEntry)
return NS_ERROR_NULL_POINTER ;
*anEntry = nsnull ;
*aLength = 0 ;
NS_ASSERTION(mDB, "no database") ;
PRUint32 flag ;
if(bReset)
flag = R_FIRST ;
else
flag = R_NEXT ;
// Lock the db
nsAutoLock lock(m_Lock) ;
DBT db_key, db_data ;
// FUR - +1 unnecessary ?
PRUint32 len = PL_strlen(SessionKey)+1 ;
int status ;
do {
status = (*mDB->seq)(mDB, &db_key, &db_data, flag) ;
flag = R_NEXT ;
if(status == -1)
return NS_ERROR_FAILURE ;
// get next if it's a key->recordID
if(db_key.size > sizeof(PRInt32) && db_data.size == sizeof(PRInt32))
continue ;
// get next if it's a sessionID entry
if(db_key.size == len && db_data.size == sizeof(PRInt16))
continue ;
// recordID is always 32 bits long
if(db_key.size == sizeof(PRInt32))
break ;
} while(!status) ;
if (0 == status) {
*anEntry = db_data.data ;
*aLength = db_data.size ;
}
return NS_OK ;
}

View File

@@ -1,68 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is Intel Corp.
* Portions created by Intel Corp. are
* Copyright (C) 1999, 1999 Intel Corp. All
* Rights Reserved.
*
* Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
* Carl Wong <carl.wong@intel.com>
*/
// FUR - Add overall description comment here
#ifndef _NSIDBACCESSOR_H_
#define _NSIDBACCESSOR_H_
#include "nsIDBAccessor.h"
#include "mcom_db.h"
// bogus string for the key of session id
// FUR - suggest "SK" instead of "^^"
static const char * const SessionKey = "^^" ;
// initial session id number
static const PRInt16 ini_sessionID = 0xff ;
class nsDBAccessor : public nsIDBAccessor
{
public:
NS_DECL_ISUPPORTS
nsDBAccessor() ;
virtual ~nsDBAccessor() ;
NS_IMETHOD Init(nsIFileSpec* dbfile) ;
NS_IMETHOD Shutdown(void) ;
NS_IMETHOD Put(PRInt32 aID, void* anEntry, PRUint32 aLength) ;
NS_IMETHOD Get(PRInt32 aID, void** anEntry, PRUint32 *aLength) ;
NS_IMETHOD Del(PRInt32 aID, void* anEntry, PRUint32 aLength) ;
NS_IMETHOD GetID(const char* key, PRUint32 length, PRInt32* aID) ;
NS_IMETHOD EnumEntry(void* *anEntry, PRUint32* aLength, PRBool bReset) ;
protected:
private:
DB * mDB ;
PRInt16 mSessionID ;
PRInt16 mSessionCntr ;
PRLock * m_Lock ;
} ;
#endif // _NSIDBACCESSOR_H_

View File

@@ -1,97 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is Intel Corp.
* Portions created by Intel Corp. are
* Copyright (C) 1999, 1999 Intel Corp. All
* Rights Reserved.
*
* Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
* Carl Wong <carl.wong@intel.com>
*/
// FUR - Add overall description comment here
#include "nsDBEnumerator.h"
#include "nsDiskCacheRecord.h"
nsDBEnumerator::nsDBEnumerator(nsIDBAccessor* aDB, nsNetDiskCache* aCache) :
m_DB(aDB) ,
m_DiskCache(aCache) ,
tempEntry(0) ,
tempEntry_length(0) ,
m_CacheEntry(0) ,
bReset(PR_TRUE)
{
NS_INIT_REFCNT();
}
nsDBEnumerator::~nsDBEnumerator()
{
// printf(" ~nsDBEnumerator()\n") ;
NS_IF_RELEASE(m_CacheEntry) ;
}
//
// Implement nsISupports methods
//
NS_IMPL_ISUPPORTS(nsDBEnumerator, NS_GET_IID(nsIEnumerator))
/////////////////////////////////////////////////////////////////
// nsISimpleEnumerator methods
NS_IMETHODIMP
nsDBEnumerator::HasMoreElements(PRBool *_retval)
{
*_retval = PR_FALSE ;
m_DB->EnumEntry(&tempEntry, &tempEntry_length, bReset) ;
bReset = PR_FALSE ;
if(tempEntry && tempEntry_length != 0)
*_retval = PR_TRUE ;
return NS_OK ;
}
// this routine does not create a new item by itself
// Rather it reuses the item inside the object. So if you need to use the
// item later, you have to
// create a new item specifically, using copy constructor or some other dup
// function. And don't forget to release it after you're done
//
NS_IMETHODIMP
nsDBEnumerator::GetNext(nsISupports **_retval)
{
if(!m_CacheEntry) {
m_CacheEntry = new nsDiskCacheRecord(m_DB, m_DiskCache) ;
if(m_CacheEntry)
NS_ADDREF(m_CacheEntry) ;
else
return NS_ERROR_OUT_OF_MEMORY ;
}
if(!_retval)
return NS_ERROR_NULL_POINTER ;
*_retval = nsnull ;
nsresult rv = m_CacheEntry->RetrieveInfo(tempEntry, tempEntry_length) ;
if(NS_FAILED(rv))
return rv ;
*_retval = NS_STATIC_CAST(nsISupports*, m_CacheEntry) ;
NS_ADDREF(*_retval) ; // all good getter addref
return NS_OK ;
}

View File

@@ -1,61 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is Intel Corp.
* Portions created by Intel Corp. are
* Copyright (C) 1999, 1999 Intel Corp. All
* Rights Reserved.
*
* Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
* Carl Wong <carl.wong@intel.com>
*/
// FUR - Add overall description comment here
#ifndef _NS_DBENUMERATOR_H_
#define _NS_DBENUMERATOR_H_
#include "nsISimpleEnumerator.h"
#include "nsINetDataCacheRecord.h"
#include "nsIDBAccessor.h"
#include "nsCOMPtr.h"
#include "nsNetDiskCache.h"
#include "nsDiskCacheRecord.h"
class nsCachedDiskData ; /* forward decl */
class nsDBEnumerator : public nsISimpleEnumerator {
public:
NS_DECL_ISUPPORTS
// FUR can use NS_DECL_NSISIMPLEENUMERATOR here
/* boolean HasMoreElements (); */
NS_IMETHOD HasMoreElements(PRBool *_retval) ;
/* nsISupports GetNext (); */
NS_IMETHOD GetNext(nsISupports **_retval) ;
nsDBEnumerator(nsIDBAccessor* aDB, nsNetDiskCache* aCache) ;
virtual ~nsDBEnumerator() ;
// FUR all members should be prefixed by 'm', e.g. mbReset
private:
nsCOMPtr<nsIDBAccessor> m_DB ;
nsCOMPtr<nsNetDiskCache> m_DiskCache ;
void * tempEntry ;
PRUint32 tempEntry_length ;
nsDiskCacheRecord* m_CacheEntry ;
PRBool bReset ;
};
#endif // _NS_DBENUMERATOR_H_

View File

@@ -1,451 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is Intel Corp.
* Portions created by Intel Corp. are
* Copyright (C) 1999, 1999 Intel Corp. All
* Rights Reserved.
*
* Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
* Carl Wong <carl.wong@intel.com>
*/
#include "nsDiskCacheRecord.h"
#include "nsINetDataDiskCache.h"
#include "nsNetDiskCacheCID.h"
#include "nsDiskCacheRecordChannel.h"
#include "nsFileStream.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIProtocolHandler.h"
#include "nsIIOService.h"
#include "nsIAllocator.h"
#include "plstr.h"
#include "prprf.h"
#include "prmem.h"
#include "prlog.h"
#include "prtypes.h"
#include "netCore.h"
#include "nsDBAccessor.h"
#if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN)
ERROR! Must have a byte order
#endif
#ifdef IS_LITTLE_ENDIAN
#define COPY_INT32(_a,_b) memcpy(_a, _b, sizeof(int32))
#else
#define COPY_INT32(_a,_b) /* swap */ \
do { \
((char *)(_a))[0] = ((char *)(_b))[3]; \
((char *)(_a))[1] = ((char *)(_b))[2]; \
((char *)(_a))[2] = ((char *)(_b))[1]; \
((char *)(_a))[3] = ((char *)(_b))[0]; \
} while(0)
#endif
nsDiskCacheRecord::nsDiskCacheRecord(nsIDBAccessor* db, nsNetDiskCache* aCache) :
mKey(0) ,
mKeyLength(0) ,
mRecordID(0) ,
mMetaData(0) ,
mMetaDataLength(0) ,
mDB(db) ,
mInfo(0) ,
mInfoSize(0) ,
mNumChannels(0) ,
mDiskCache(aCache)
{
NS_INIT_REFCNT();
}
// mem alloced. so caller should do free() on key.
NS_IMETHODIMP
nsDiskCacheRecord::Init(const char* key, PRUint32 length)
{
NS_NewFileSpec(getter_AddRefs(mFile));
if(!mFile)
return NS_ERROR_OUT_OF_MEMORY ;
// copy key
mKeyLength = length ;
mKey = NS_STATIC_CAST(char*, nsAllocator::Alloc(mKeyLength*sizeof(char))) ;
if(!mKey)
return NS_ERROR_OUT_OF_MEMORY ;
memcpy(mKey, key, length) ;
// get RecordID
// FUR!! Another disk access ? If called from GetCachedData, ID is already known
mDB->GetID(key, length, &mRecordID) ;
// FUR - check for GetID failure
// setup the file name
nsCOMPtr<nsIFileSpec> dbFolder ;
mDiskCache->GetDiskCacheFolder(getter_AddRefs(dbFolder)) ;
nsresult rv = mFile->FromFileSpec(dbFolder) ;
if(NS_FAILED(rv))
return NS_ERROR_FAILURE ;
// dir is a hash result of mRecordID%32, hope it's enough
char filename[9], dirName[3] ;
// FUR!! - should the format string be "%.02x". How does this work !?
PR_snprintf(dirName, 3, "%.2x", (((PRUint32)mRecordID) % 32)) ;
mFile->AppendRelativeUnixPath(dirName) ;
// FUR!! - should the format string be "%.08x". How does this work !?
PR_snprintf(filename, 9, "%.8x", mRecordID) ;
mFile->AppendRelativeUnixPath(filename) ;
return NS_OK ;
}
nsDiskCacheRecord::~nsDiskCacheRecord()
{
// printf(" ~nsDiskCacheRecord()\n") ;
if(mKey)
nsAllocator::Free(mKey) ;
if(mMetaData)
nsAllocator::Free(mMetaData) ;
}
//
// Implement nsISupports methods
//
NS_IMPL_ISUPPORTS(nsDiskCacheRecord, NS_GET_IID(nsINetDataCacheRecord))
///////////////////////////////////////////////////////////////////////
// nsINetDataCacheRecord methods
// yes, mem alloced on *_retval.
NS_IMETHODIMP
nsDiskCacheRecord::GetKey(PRUint32 *length, char** _retval)
{
if(!_retval)
return NS_ERROR_NULL_POINTER ;
*length = mKeyLength ;
*_retval = NS_STATIC_CAST(char*, nsAllocator::Alloc(mKeyLength*sizeof(char))) ;
if(!*_retval)
return NS_ERROR_OUT_OF_MEMORY ;
memcpy(*_retval, mKey, mKeyLength) ;
return NS_OK ;
}
NS_IMETHODIMP
nsDiskCacheRecord::GetRecordID(PRInt32* aRecordID)
{
*aRecordID = mRecordID ;
return NS_OK ;
}
// yes, mem alloced on *_retval.
NS_IMETHODIMP
nsDiskCacheRecord::GetMetaData(PRUint32 *length, char **_retval)
{
if(!_retval)
return NS_ERROR_NULL_POINTER ;
// always null the return value first.
*_retval = nsnull ;
*length = mMetaDataLength ;
if(mMetaDataLength) {
*_retval = NS_STATIC_CAST(char*, nsAllocator::Alloc(mMetaDataLength*sizeof(char))) ;
if(!*_retval)
return NS_ERROR_OUT_OF_MEMORY ;
memcpy(*_retval, mMetaData, mMetaDataLength) ;
}
return NS_OK ;
}
NS_IMETHODIMP
nsDiskCacheRecord::SetMetaData(PRUint32 length, const char* data)
{
// set the mMetaData
mMetaDataLength = length ;
if(mMetaData)
nsAllocator::Free(mMetaData) ;
mMetaData = NS_STATIC_CAST(char*, nsAllocator::Alloc(mMetaDataLength*sizeof(char))) ;
if(!mMetaData) {
return NS_ERROR_OUT_OF_MEMORY ;
}
memcpy(mMetaData, data, length) ;
// Generate mInfo
nsresult rv = GenInfo() ;
if(NS_FAILED(rv))
return rv ;
// write through into mDB
rv = mDB->Put(mRecordID, mInfo, mInfoSize) ;
// FUR - mInfo leaking ?
return rv ;
}
NS_IMETHODIMP
nsDiskCacheRecord::GetStoredContentLength(PRUint32 *aStoredContentLength)
{
return mFile->GetFileSize(aStoredContentLength) ;
}
// untill nsIFileSpec::Truncate() is in, we have to do all this ugly stuff
NS_IMETHODIMP
nsDiskCacheRecord::SetStoredContentLength(PRUint32 aStoredContentLength)
{
PRUint32 len = 0 ;
nsresult rv = mFile->GetFileSize(&len) ;
if(NS_FAILED(rv))
return rv ;
if(len < aStoredContentLength)
{
NS_ERROR("Error: can not set filesize to something bigger than itself.\n") ;
return NS_ERROR_FAILURE ;
}
else
return mFile->Truncate(aStoredContentLength) ;
}
NS_IMETHODIMP
nsDiskCacheRecord::Delete(void)
{
if(mNumChannels)
return NS_ERROR_NOT_AVAILABLE ;
PRUint32 len ;
mFile->GetFileSize(&len) ;
nsFileSpec cache_file ;
nsresult rv = mFile->GetFileSpec(&cache_file) ;
if(NS_FAILED(rv))
return NS_ERROR_FAILURE ;
cache_file.Delete(PR_TRUE) ;
// updata the storage size
mDiskCache->m_StorageInUse -= len ;
rv = mDB->Del(mRecordID, mKey, mKeyLength) ;
if(NS_FAILED(rv))
return NS_ERROR_FAILURE ;
else
return NS_OK ;
}
NS_IMETHODIMP
nsDiskCacheRecord::GetFilename(nsIFileSpec * *aFilename)
{
if(!aFilename)
return NS_ERROR_NULL_POINTER ;
*aFilename = mFile ;
NS_ADDREF(*aFilename) ;
return NS_OK ;
}
NS_IMETHODIMP
nsDiskCacheRecord::NewChannel(nsILoadGroup *loadGroup, nsIChannel **_retval)
{
nsDiskCacheRecordChannel* channel = new nsDiskCacheRecordChannel(this, loadGroup) ;
if(!channel)
return NS_ERROR_OUT_OF_MEMORY ;
nsresult rv = channel->Init() ;
if(NS_FAILED(rv))
return rv ;
NS_ADDREF(channel) ;
*_retval = NS_STATIC_CAST(nsIChannel*, channel) ;
return NS_OK ;
}
//////////////////////////////////////////////////////////////////////////
// nsDiskCacheRecord methods
// file name is represented by a url string. I hope this would be more
// generic
nsresult
nsDiskCacheRecord::GenInfo()
{
if(mInfo)
nsAllocator::Free(mInfo) ;
char* file_url=nsnull ;
PRUint32 name_len ;
mFile->GetURLString(&file_url) ;
name_len = PL_strlen(file_url)+1 ;
mInfoSize = sizeof(PRUint32) ; // checksum for mInfoSize
mInfoSize += sizeof(PRInt32) ; // RecordID
mInfoSize += sizeof(PRUint32) ; // key length
mInfoSize += mKeyLength ; // key
mInfoSize += sizeof(PRUint32) ; // metadata length
mInfoSize += mMetaDataLength ; // metadata
mInfoSize += sizeof(PRUint32) ; // filename length
mInfoSize += name_len ; // filename
void* newInfo = nsAllocator::Alloc(mInfoSize*sizeof(char)) ;
if(!newInfo) {
return NS_ERROR_OUT_OF_MEMORY ;
}
// copy the checksum mInfoSize
char* cur_ptr = NS_STATIC_CAST(char*, newInfo) ;
COPY_INT32(cur_ptr, &mInfoSize) ;
cur_ptr += sizeof(PRUint32) ;
// copy RecordID
COPY_INT32(cur_ptr, &mRecordID) ;
cur_ptr += sizeof(PRInt32) ;
// copy key length
COPY_INT32(cur_ptr, &mKeyLength) ;
cur_ptr += sizeof(PRUint32) ;
// copy key
memcpy(cur_ptr, mKey, mKeyLength) ;
cur_ptr += mKeyLength ;
// copy metadata length
COPY_INT32(cur_ptr, &mMetaDataLength) ;
cur_ptr += sizeof(PRUint32) ;
// copy metadata
memcpy(cur_ptr, mMetaData, mMetaDataLength) ;
cur_ptr += mMetaDataLength ;
// copy file name length
COPY_INT32(cur_ptr, &name_len) ;
cur_ptr += sizeof(PRUint32) ;
// copy file name
memcpy(cur_ptr, file_url, name_len) ;
cur_ptr += name_len ;
PR_ASSERT(cur_ptr == NS_STATIC_CAST(char*, newInfo) + mInfoSize);
mInfo = newInfo ;
return NS_OK ;
}
/*
* This Method suppose to get all the info from the db record
* and set them to accroding members. the original values
* will all be overwritten. only minimal error checking is performed.
*/
NS_IMETHODIMP
nsDiskCacheRecord::RetrieveInfo(void* aInfo, PRUint32 aInfoLength)
{
// reset everything
if(mInfo) {
nsAllocator::Free(mInfo) ;
mInfo = nsnull ;
}
if(mKey) {
nsAllocator::Free(mKey) ;
mKey = nsnull ;
}
if(mMetaData) {
nsAllocator::Free(mMetaData) ;
mMetaData = nsnull ;
}
char * cur_ptr = NS_STATIC_CAST(char*, aInfo) ;
char* file_url ;
PRUint32 name_len ;
// set mInfoSize
COPY_INT32(&mInfoSize, cur_ptr) ;
cur_ptr += sizeof(PRUint32) ;
// check this at least
if(mInfoSize != aInfoLength)
return NS_ERROR_FAILURE ;
// set mRecordID
COPY_INT32(&mRecordID, cur_ptr) ;
cur_ptr += sizeof(PRInt32) ;
// set mKeyLength
COPY_INT32(&mKeyLength, cur_ptr) ;
cur_ptr += sizeof(PRUint32) ;
// set mKey
mKey = NS_STATIC_CAST(char*, nsAllocator::Alloc(mKeyLength*sizeof(char))) ;
if(!mKey)
return NS_ERROR_OUT_OF_MEMORY ;
memcpy(mKey, cur_ptr, mKeyLength) ;
cur_ptr += mKeyLength ;
PRInt32 id ;
mDB->GetID(mKey, mKeyLength, &id) ;
NS_ASSERTION(id==mRecordID, "\t ++++++ bad record, somethings wrong\n") ;
// set mMetaDataLength
COPY_INT32(&mMetaDataLength, cur_ptr) ;
cur_ptr += sizeof(PRUint32) ;
// set mMetaData
mMetaData = NS_STATIC_CAST(char*, nsAllocator::Alloc(mMetaDataLength*sizeof(char))) ;
if(!mMetaData)
return NS_ERROR_OUT_OF_MEMORY ;
memcpy(mMetaData, cur_ptr, mMetaDataLength) ;
cur_ptr += mMetaDataLength ;
// get mFile name length
COPY_INT32(&name_len, cur_ptr) ;
cur_ptr += sizeof(PRUint32) ;
// get mFile native name
file_url = NS_STATIC_CAST(char*, nsAllocator::Alloc(name_len*sizeof(char))) ;
if(!file_url)
return NS_ERROR_OUT_OF_MEMORY ;
memcpy(file_url, cur_ptr, name_len) ;
cur_ptr += name_len ;
PR_ASSERT(cur_ptr == NS_STATIC_CAST(char*, aInfo) + mInfoSize);
// create mFile if Init() isn't called
if(!mFile) {
NS_NewFileSpec(getter_AddRefs(mFile));
if(!mFile)
return NS_ERROR_OUT_OF_MEMORY ;
}
// setup mFile
mFile->SetURLString(file_url) ;
return NS_OK ;
}

View File

@@ -1,70 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is Intel Corp.
* Portions created by Intel Corp. are
* Copyright (C) 1999, 1999 Intel Corp. All
* Rights Reserved.
*
* Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
* Carl Wong <carl.wong@intel.com>
*/
#ifndef _NET_CACHEDDISKDATA_H_
#define _NET_CACHEDDISKDATA_H_
#include "nsINetDataCacheRecord.h"
#include "nsCOMPtr.h"
#include "nsIDBAccessor.h"
#include "prtypes.h"
#include "nsILoadGroup.h"
#include "nsIFileChannel.h"
#include "nsNetDiskCache.h"
class nsDiskCacheRecord : public nsINetDataCacheRecord
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSINETDATACACHERECORD
protected:
nsDiskCacheRecord(nsIDBAccessor* db, nsNetDiskCache* aCache) ;
virtual ~nsDiskCacheRecord() ;
NS_IMETHOD RetrieveInfo(void* aInfo, PRUint32 aInfoLength) ;
NS_IMETHOD Init(const char* key, PRUint32 length) ;
nsresult GenInfo(void) ;
private:
char* mKey ;
PRUint32 mKeyLength ;
PRInt32 mRecordID ;
char* mMetaData ;
PRUint32 mMetaDataLength ;
nsCOMPtr<nsIFileSpec> mFile ;
nsCOMPtr<nsIDBAccessor> mDB ;
void* mInfo ;
PRUint32 mInfoSize ;
PRUint32 mNumChannels ;
nsCOMPtr<nsNetDiskCache> mDiskCache ;
friend class nsDiskCacheRecordChannel ;
friend class nsDBEnumerator ;
friend class nsNetDiskCache ;
} ;
#endif // _NET_CACHEDDISKDATA_H_

View File

@@ -1,392 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is Intel Corp.
* Portions created by Intel Corp. are
* Copyright (C) 1999, 1999 Intel Corp. All
* Rights Reserved.
*
* Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
* Carl Wong <carl.wong@intel.com>
*/
#include "nsDiskCacheRecordChannel.h"
//#include "nsFileTransport.h"
#include "nsIIOService.h"
#include "nsIServiceManager.h"
#include "nsIOutputStream.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
// This is copied from nsMemCacheChannel, We should consolidate these two.
class WriteStreamWrapper : public nsIOutputStream
{
public:
WriteStreamWrapper(nsDiskCacheRecordChannel* aChannel,
nsIOutputStream *aBaseStream) ;
virtual ~WriteStreamWrapper() ;
static nsresult
Create(nsDiskCacheRecordChannel* aChannel, nsIOutputStream *aBaseStream, nsIOutputStream* *aWrapper) ;
NS_DECL_ISUPPORTS
NS_DECL_NSIBASESTREAM
NS_DECL_NSIOUTPUTSTREAM
private:
nsDiskCacheRecordChannel* mChannel;
nsCOMPtr<nsIOutputStream> mBaseStream;
} ;
// implement nsISupports
NS_IMPL_ISUPPORTS(WriteStreamWrapper, NS_GET_IID(nsIOutputStream))
WriteStreamWrapper::WriteStreamWrapper(nsDiskCacheRecordChannel* aChannel,
nsIOutputStream *aBaseStream)
: mChannel(aChannel), mBaseStream(aBaseStream)
{
NS_INIT_REFCNT();
NS_ADDREF(mChannel);
}
WriteStreamWrapper::~WriteStreamWrapper()
{
NS_RELEASE(mChannel);
}
nsresult
WriteStreamWrapper::Create(nsDiskCacheRecordChannel*aChannel, nsIOutputStream *aBaseStream, nsIOutputStream* * aWrapper)
{
WriteStreamWrapper *wrapper = new WriteStreamWrapper(aChannel, aBaseStream);
if (!wrapper) return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(wrapper);
*aWrapper = wrapper;
return NS_OK;
}
NS_IMETHODIMP
WriteStreamWrapper::Write(const char *aBuffer, PRUint32 aCount, PRUint32 *aNumWritten)
{
*aNumWritten = 0;
nsresult rv = mBaseStream->Write(aBuffer, aCount, aNumWritten);
mChannel->NotifyStorageInUse(*aNumWritten);
return rv;
}
NS_IMETHODIMP
WriteStreamWrapper::Flush()
{
return mBaseStream->Flush();
}
NS_IMETHODIMP
WriteStreamWrapper::Close()
{
return mBaseStream->Close();
}
nsDiskCacheRecordChannel::nsDiskCacheRecordChannel(nsDiskCacheRecord *aRecord,
nsILoadGroup *aLoadGroup)
: mRecord(aRecord) ,
mLoadGroup(aLoadGroup)
{
NS_INIT_REFCNT() ;
mRecord->mNumChannels++ ;
}
nsDiskCacheRecordChannel::~nsDiskCacheRecordChannel()
{
mRecord->mNumChannels-- ;
}
// FUR!!
//
// I know that I gave conflicting advice on the issue of file
// transport versus file protocol handler, but I thought that the
// last word was that we would use the raw transport, when I wrote:
//
// > I just thought of an argument for the other side of the coin, i.e. the
// > benefit of *not* reusing the file protocol handler: On the Mac, it's
// > expensive to convert from a string URL to an nsFileSpec, because the Mac
// > is brain-dead and scans every directory on the path to the file. It's
// > cheaper to create a nsFileSpec for a cache file by combining a single,
// > static nsFileSpec that corresponds to the cache directory with the
// > relative path to the cache file (using nsFileSpec's operator +). This
// > operation is optimized on the Mac to avoid the scanning operation.
//
// The Mac guys will eat us alive if we do path string to nsFileSpec
// conversions for every cache file we open.
nsresult
nsDiskCacheRecordChannel::Init(void)
{
char* urlStr ;
mRecord->mFile->GetURLString(&urlStr) ;
nsresult rv ;
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = serv->NewChannel("load", // XXX what should this be?
urlStr,
nsnull, // no base uri
mLoadGroup,
nsnull, // no eventsink getter
0,
nsnull, // no original URI
0,
0,
getter_AddRefs(mFileTransport));
return rv ;
}
nsresult
nsDiskCacheRecordChannel::NotifyStorageInUse(PRInt32 aBytesUsed)
{
return mRecord->mDiskCache->m_StorageInUse += aBytesUsed ;
}
// implement nsISupports
NS_IMPL_ISUPPORTS(nsDiskCacheRecordChannel, NS_GET_IID(nsIChannel))
// implement nsIRequest
NS_IMETHODIMP
nsDiskCacheRecordChannel::IsPending(PRBool *aIsPending)
{
*aIsPending = PR_FALSE ;
if(!mFileTransport)
return NS_OK ;
return mFileTransport->IsPending(aIsPending) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::Cancel(void)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->Cancel() ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::Suspend(void)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->Suspend() ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::Resume(void)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->Resume() ;
}
// implement nsIChannel
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetURI(nsIURI * *aURI)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->GetURI(aURI) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::OpenInputStream(PRUint32 aStartPosition,
PRInt32 aReadCount,
nsIInputStream* *aResult)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->OpenInputStream(aStartPosition,
aReadCount,
aResult) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::OpenOutputStream(PRUint32 startPosition,
nsIOutputStream* *aResult)
{
nsresult rv ;
NS_ENSURE_ARG(aResult) ;
nsCOMPtr<nsIOutputStream> outputStream ;
PRUint32 oldLength ;
mRecord->GetStoredContentLength(&oldLength) ;
if(startPosition < oldLength) {
NotifyStorageInUse(startPosition - oldLength) ;
// we should truncate the file at here.
rv = mRecord->SetStoredContentLength(startPosition) ;
if(NS_FAILED(rv)) {
printf(" failed to truncate\n") ;
return rv ;
}
}
rv = mFileTransport->OpenOutputStream(startPosition, getter_AddRefs(outputStream)) ;
if(NS_FAILED(rv)) return rv ;
return WriteStreamWrapper::Create(this, outputStream, aResult) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::AsyncOpen(nsIStreamObserver *observer,
nsISupports *ctxt)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->AsyncOpen(observer, ctxt) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::AsyncRead(PRUint32 aStartPosition,
PRInt32 aReadCount,
nsISupports *aContext,
nsIStreamListener *aListener)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->AsyncRead(aStartPosition ,
aReadCount ,
aContext ,
aListener) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::AsyncWrite(nsIInputStream *fromStream,
PRUint32 startPosition,
PRInt32 writeCount,
nsISupports *ctxt,
nsIStreamObserver *observer)
{
/*
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->AsyncWrite(fromStream,
startPosition,
writeCount,
ctxt,
observer) ;
*/
// I can't do this since the write is not monitored, and I won't be
// able to updata the storage.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetLoadAttributes(nsLoadFlags *aLoadAttributes)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->GetLoadAttributes(aLoadAttributes) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::SetLoadAttributes(nsLoadFlags aLoadAttributes)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->SetLoadAttributes(aLoadAttributes) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetContentType(char * *aContentType)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->GetContentType(aContentType) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetContentLength(PRInt32 *aContentLength)
{
if(!mFileTransport)
return NS_ERROR_FAILURE ;
return mFileTransport->GetContentLength(aContentLength) ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetOwner(nsISupports* *aOwner)
{
*aOwner = mOwner.get() ;
NS_IF_ADDREF(*aOwner) ;
return NS_OK ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::SetOwner(nsISupports* aOwner)
{
mOwner = aOwner ;
return NS_OK ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetOriginalURI(nsIURI* *aURI)
{
// FUR - might need to implement this - not sure
return NS_ERROR_NOT_IMPLEMENTED ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
{
// Not required to be implemented, since it is implemented by cache manager
NS_ASSERTION(0, "nsDiskCacheRecordChannel method unexpectedly called");
return NS_OK ;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
{
// Not required to be implemented, since it is implemented by cache manager
NS_ASSERTION(0, "nsDiskCacheRecordChannel method unexpectedly called");
return NS_OK;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
{
// Not required to be implemented, since it is implemented by cache manager
NS_ASSERTION(0, "nsDiskCacheRecordChannel method unexpectedly called");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDiskCacheRecordChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
{
// Not required to be implemented, since it is implemented by cache manager
NS_ASSERTION(0, "nsDiskCacheRecordChannel method unexpectedly called");
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@@ -1,65 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is Intel Corp.
* Portions created by Intel Corp. are
* Copyright (C) 1999, 1999 Intel Corp. All
* Rights Reserved.
*
* Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
* Carl Wong <carl.wong@intel.com>
*/
#ifndef _ns_DiskCacheRecordChannel_h_
#define _ns_DiskCacheRecordChannel_h_
#include "nsIChannel.h"
#include "nsCOMPtr.h"
#include "nsDiskCacheRecord.h"
/*
* This class is plagiarized from nsMemCacheChannel
*/
class nsDiskCacheRecordChannel : public nsIChannel
{
public:
nsDiskCacheRecordChannel(nsDiskCacheRecord *aRecord, nsILoadGroup *aLoadGroup);
virtual ~nsDiskCacheRecordChannel() ;
// Declare nsISupports methods
NS_DECL_ISUPPORTS
// Declare nsIRequest methods
NS_DECL_NSIREQUEST
// Declare nsIChannel methods
NS_DECL_NSICHANNEL
nsresult Init(void) ;
private:
nsresult NotifyStorageInUse(PRInt32 aBytesUsed) ;
nsCOMPtr<nsDiskCacheRecord> mRecord ;
nsCOMPtr<nsILoadGroup> mLoadGroup ;
nsCOMPtr<nsISupports> mOwner ;
nsCOMPtr<nsIChannel> mFileTransport ;
friend class WriteStreamWrapper ;
} ;
#endif // _ns_DiskCacheRecordChannel_h_

View File

@@ -1,60 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator.
*
* The Initial Developer of the Original Code is Intel Corp.
* Portions created by Intel Corp. are
* Copyright (C) 1999, 1999 Intel Corp. All
* Rights Reserved.
*
* Contributor(s): Yixiong Zou <yixiong.zou@intel.com>
* Carl Wong <carl.wong@intel.com>
*/
#ifndef _NS_IDBACCESSOR_H_
#define _NS_IDBACCESSOR_H_
#include "nsISupports.h"
#include "nsIFileSpec.h"
// nsIDBAccessorIID {6AADD4D0-7785-11d3-87FE-000629D01344}
#define NS_IDBACCESSOR_IID \
{ 0x6aadd4d0, 0x7785, 0x11d3, \
{0x87, 0xfe, 0x0, 0x6, 0x29, 0xd0, 0x13, 0x44}}
// nsDBAccessorCID {6AADD4D1-7785-11d3-87FE-000629D01344}
#define NS_DBACCESSOR_CID \
{ 0x6aadd4d1, 0x7785, 0x11d3, \
{ 0x87, 0xfe, 0x0, 0x6, 0x29, 0xd0, 0x13, 0x44 }}
class nsIDBAccessor : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDBACCESSOR_IID)
NS_IMETHOD Init(nsIFileSpec* DBFile) = 0 ;
NS_IMETHOD Shutdown(void) = 0 ;
NS_IMETHOD Put(PRInt32 aID, void* anEntry, PRUint32 aLength) = 0 ;
NS_IMETHOD Get(PRInt32 aID, void** anEntry, PRUint32 *aLength) = 0 ;
NS_IMETHOD Del(PRInt32 aID, void* anEntry, PRUint32 aLength) = 0 ;
NS_IMETHOD GetID(const char* key, PRUint32 length, PRInt32* aID) = 0 ;
NS_IMETHOD EnumEntry(void* *anEntry, PRUint32* aLength, PRBool bReset) = 0 ;
} ;
#endif // _NS_IDBACCESSOR_H_

Some files were not shown because too many files have changed in this diff Show More