/[jscoverage]/trunk/js/rules.mk
ViewVC logotype

Contents of /trunk/js/rules.mk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 399 - (show annotations)
Tue Dec 9 03:37:47 2008 UTC (10 years, 10 months ago) by siliconforks
File size: 5828 byte(s)
Use SpiderMonkey from Firefox 3.1b2.

1 # -*- Mode: makefile -*-
2 #
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 #
6 # The contents of this file are subject to the Mozilla Public License Version
7 # 1.1 (the "License"); you may not use this file except in compliance with
8 # the License. You may obtain a copy of the License at
9 # http://www.mozilla.org/MPL/
10 #
11 # Software distributed under the License is distributed on an "AS IS" basis,
12 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 # for the specific language governing rights and limitations under the
14 # License.
15 #
16 # The Original Code is Mozilla Communicator client code, released
17 # March 31, 1998.
18 #
19 # The Initial Developer of the Original Code is
20 # Netscape Communications Corporation.
21 # Portions created by the Initial Developer are Copyright (C) 1998-1999
22 # the Initial Developer. All Rights Reserved.
23 #
24 # Contributor(s):
25 # Michael Ang <mang@subcarrier.org>
26 #
27 # Alternatively, the contents of this file may be used under the terms of
28 # either of the GNU General Public License Version 2 or later (the "GPL"),
29 # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 # in which case the provisions of the GPL or the LGPL are applicable instead
31 # of those above. If you wish to allow use of your version of this file only
32 # under the terms of either the GPL or the LGPL, and not to allow others to
33 # use your version of this file under the terms of the MPL, indicate your
34 # decision by deleting the provisions above and replace them with the notice
35 # and other provisions required by the GPL or the LGPL. If you do not delete
36 # the provisions above, a recipient may use your version of this file under
37 # the terms of any one of the MPL, the GPL or the LGPL.
38 #
39 # ***** END LICENSE BLOCK *****
40
41 #
42 # JSRef GNUmake makefile rules
43 #
44
45 ifdef USE_MSVC
46 LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CPPFILES:.cpp=.obj))
47 PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CPPFILES:.cpp=.obj))
48 else
49 LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CPPFILES:.cpp=.o))
50 LIB_OBJS += $(addprefix $(OBJDIR)/, $(LIB_ASFILES:.s=.o))
51 PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CPPFILES:.cpp=.o))
52 endif
53
54 CPPFILES = $(LIB_CPPFILES) $(PROG_CPPFILES)
55 OBJS = $(LIB_OBJS) $(PROG_OBJS)
56
57 ifdef USE_MSVC
58 # TARGETS = $(LIBRARY) # $(PROGRAM) not supported for MSVC yet
59 TARGETS += $(SHARED_LIBRARY) $(PROGRAM) # it is now
60 else
61 TARGETS += $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
62 endif
63
64 all:
65 +$(LOOP_OVER_PREDIRS)
66 ifneq "$(strip $(TARGETS))" ""
67 $(MAKE) -f Makefile.ref $(TARGETS)
68 endif
69 +$(LOOP_OVER_DIRS)
70
71 $(OBJDIR)/%: %.cpp
72 @$(MAKE_OBJDIR)
73 $(CXX) -o $@ $(CFLAGS) $(OPTIMIZER) $< $(LDFLAGS)
74
75 # This rule must come before the rule with no dep on header
76 $(OBJDIR)/%.o: %.cpp %.h
77 @$(MAKE_OBJDIR)
78 $(CXX) -o $@ -c $(CFLAGS) $(OPTIMIZER) $<
79
80 $(OBJDIR)/jsinterp.o: jsinterp.cpp jsinterp.h
81 @$(MAKE_OBJDIR)
82 $(CXX) -o $@ -c $(CFLAGS) $(INTERP_OPTIMIZER) jsinterp.cpp
83
84 $(OBJDIR)/jsbuiltins.o: jsbuiltins.cpp jsinterp.h
85 @$(MAKE_OBJDIR)
86 $(CXX) -o $@ -c $(CFLAGS) $(BUILTINS_OPTIMIZER) jsbuiltins.cpp
87
88 $(OBJDIR)/%.o: %.cpp
89 @$(MAKE_OBJDIR)
90 $(CXX) -o $@ -c $(CFLAGS) $(OPTIMIZER) $<
91
92 $(OBJDIR)/%.o: %.s
93 @$(MAKE_OBJDIR)
94 $(AS) -o $@ $(ASFLAGS) $<
95
96 # This rule must come before rule with no dep on header
97 $(OBJDIR)/%.obj: %.cpp %.h
98 @$(MAKE_OBJDIR)
99 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(OPTIMIZER) $<
100
101 $(OBJDIR)/jsinterp.obj: jsinterp.cpp jsinterp.h
102 @$(MAKE_OBJDIR)
103 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(INTERP_OPTIMIZER) jsinterp.cpp
104
105 $(OBJDIR)/jsbuiltins.obj: jsbuiltins.cpp jsinterp.h
106 @$(MAKE_OBJDIR)
107 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(BUILTINS_OPTIMIZER) jsbuiltins.cpp
108
109 $(OBJDIR)/%.obj: %.cpp
110 @$(MAKE_OBJDIR)
111 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(OPTIMIZER) $<
112
113 $(OBJDIR)/js.obj: js.cpp
114 @$(MAKE_OBJDIR)
115 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(OPTIMIZER) $<
116
117 ifeq ($(OS_ARCH),OS2)
118 $(LIBRARY): $(LIB_OBJS)
119 $(AR) $@ $? $(AR_OS2_SUFFIX)
120 $(RANLIB) $@
121 else
122 ifdef USE_MSVC
123 $(SHARED_LIBRARY): $(LIB_OBJS)
124 link.exe $(LIB_LINK_FLAGS) /base:0x61000000 $(OTHER_LIBS) \
125 /out:"$@" /pdb:none\
126 /implib:"$(OBJDIR)/$(@F:.dll=.lib)" $^
127 else
128 $(LIBRARY): $(LIB_OBJS)
129 $(AR) rv $@ $?
130 $(RANLIB) $@
131
132 $(SHARED_LIBRARY): $(LIB_OBJS)
133 $(MKSHLIB) -o $@ $(LIB_OBJS) $(LDFLAGS) $(OTHER_LIBS)
134 endif
135 endif
136
137 # Java stuff
138 $(CLASSDIR)/$(OBJDIR)/$(JARPATH)/%.class: %.java
139 mkdir -p $(@D)
140 $(JAVAC) $(JAVAC_FLAGS) $<
141
142 define MAKE_OBJDIR
143 if test ! -d $(@D); then rm -rf $(@D); mkdir -p $(@D); fi
144 endef
145
146 ifdef DIRS
147 LOOP_OVER_DIRS = \
148 @for d in $(DIRS); do \
149 if test -d $$d; then \
150 set -e; \
151 echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \
152 cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \
153 set +e; \
154 else \
155 echo "Skipping non-directory $$d..."; \
156 fi; \
157 done
158 endif
159
160 ifdef PREDIRS
161 LOOP_OVER_PREDIRS = \
162 @for d in $(PREDIRS); do \
163 if test -d $$d; then \
164 set -e; \
165 echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \
166 cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \
167 set +e; \
168 else \
169 echo "Skipping non-directory $$d..."; \
170 fi; \
171 done
172 endif
173
174 export:
175 +$(LOOP_OVER_PREDIRS)
176 mkdir -p $(DIST)/include $(DIST)/$(LIBDIR) $(DIST)/bin
177 ifneq "$(strip $(HFILES))" ""
178 $(CP) $(HFILES) $(DIST)/include
179 endif
180 ifneq "$(strip $(LIBRARY))" ""
181 $(CP) $(LIBRARY) $(DIST)/$(LIBDIR)
182 endif
183 ifneq "$(strip $(JARS))" ""
184 $(CP) $(JARS) $(DIST)/$(LIBDIR)
185 endif
186 ifneq "$(strip $(SHARED_LIBRARY))" ""
187 $(CP) $(SHARED_LIBRARY) $(DIST)/$(LIBDIR)
188 endif
189 ifneq "$(strip $(PROGRAM))" ""
190 $(CP) $(PROGRAM) $(DIST)/bin
191 endif
192 +$(LOOP_OVER_DIRS)
193
194 clean:
195 +$(LOOP_OVER_PREDIRS)
196 rm -rf $(OBJS) $(GARBAGE)
197
198 clobber:
199 +$(LOOP_OVER_PREDIRS)
200 rm -rf $(OBJS) $(TARGETS) $(DEPENDENCIES) $(GARBAGE)
201 if test -d $(OBJDIR); then rmdir $(OBJDIR); fi
202
203 tar:
204 tar cvf $(TARNAME) $(TARFILES)
205 gzip $(TARNAME)
206

  ViewVC Help
Powered by ViewVC 1.1.24