1 # -*- Mode: makefile -*-
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
16 # The Original Code is Mozilla Communicator client code, released
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.
25 # Michael Ang <mang@subcarrier.org>
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.
39 # ***** END LICENSE BLOCK *****
42 # JSRef GNUmake makefile rules
46 LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CPPFILES:.cpp=.obj))
47 PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CPPFILES:.cpp=.obj))
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))
54 CPPFILES = $(LIB_CPPFILES) $(PROG_CPPFILES)
55 OBJS = $(LIB_OBJS) $(PROG_OBJS)
58 # TARGETS = $(LIBRARY) # $(PROGRAM) not supported for MSVC yet
59 TARGETS += $(SHARED_LIBRARY) $(PROGRAM) # it is now
61 TARGETS += $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM)
66 ifneq "$(strip $(TARGETS))" ""
67 $(MAKE) -f Makefile.ref $(TARGETS)
73 $(CXX) -o $@ $(CFLAGS) $(OPTIMIZER) $< $(LDFLAGS)
75 # This rule must come before the rule with no dep on header
76 $(OBJDIR)/%.o: %.cpp %.h
78 $(CXX) -o $@ -c $(CFLAGS) $(OPTIMIZER) $<
80 $(OBJDIR)/jsinterp.o: jsinterp.cpp jsinterp.h
82 $(CXX) -o $@ -c $(CFLAGS) $(INTERP_OPTIMIZER) jsinterp.cpp
84 $(OBJDIR)/jsbuiltins.o: jsbuiltins.cpp jsinterp.h
86 $(CXX) -o $@ -c $(CFLAGS) $(BUILTINS_OPTIMIZER) jsbuiltins.cpp
90 $(CXX) -o $@ -c $(CFLAGS) $(OPTIMIZER) $<
94 $(AS) -o $@ $(ASFLAGS) $<
96 # This rule must come before rule with no dep on header
97 $(OBJDIR)/%.obj: %.cpp %.h
99 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(OPTIMIZER) $<
101 $(OBJDIR)/jsinterp.obj: jsinterp.cpp jsinterp.h
103 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(INTERP_OPTIMIZER) jsinterp.cpp
105 $(OBJDIR)/jsbuiltins.obj: jsbuiltins.cpp jsinterp.h
107 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(BUILTINS_OPTIMIZER) jsbuiltins.cpp
109 $(OBJDIR)/%.obj: %.cpp
111 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $(OPTIMIZER) $<
113 $(OBJDIR)/js.obj: js.cpp
115 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(OPTIMIZER) $<
117 ifeq ($(OS_ARCH),OS2)
118 $(LIBRARY): $(LIB_OBJS)
119 $(AR) $@ $? $(AR_OS2_SUFFIX)
123 $(SHARED_LIBRARY): $(LIB_OBJS)
124 link.exe $(LIB_LINK_FLAGS) /base:0x61000000 $(OTHER_LIBS) \
126 /implib:"$(OBJDIR)/$(@F:.dll=.lib)" $^
128 $(LIBRARY): $(LIB_OBJS)
132 $(SHARED_LIBRARY): $(LIB_OBJS)
133 $(MKSHLIB) -o $@ $(LIB_OBJS) $(LDFLAGS) $(OTHER_LIBS)
138 $(CLASSDIR)/$(OBJDIR)/$(JARPATH)/%.class: %.java
140 $(JAVAC) $(JAVAC_FLAGS) $<
143 if test ! -d $(@D); then rm -rf $(@D); mkdir -p $(@D); fi
148 @for d in $(DIRS); do \
149 if test -d $$d; then \
151 echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \
152 cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \
155 echo "Skipping non-directory $$d..."; \
161 LOOP_OVER_PREDIRS = \
162 @for d in $(PREDIRS); do \
163 if test -d $$d; then \
165 echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \
166 cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \
169 echo "Skipping non-directory $$d..."; \
175 +$(LOOP_OVER_PREDIRS)
176 mkdir -p $(DIST)/include $(DIST)/$(LIBDIR) $(DIST)/bin
177 ifneq "$(strip $(HFILES))" ""
178 $(CP) $(HFILES) $(DIST)/include
180 ifneq "$(strip $(LIBRARY))" ""
181 $(CP) $(LIBRARY) $(DIST)/$(LIBDIR)
183 ifneq "$(strip $(JARS))" ""
184 $(CP) $(JARS) $(DIST)/$(LIBDIR)
186 ifneq "$(strip $(SHARED_LIBRARY))" ""
187 $(CP) $(SHARED_LIBRARY) $(DIST)/$(LIBDIR)
189 ifneq "$(strip $(PROGRAM))" ""
190 $(CP) $(PROGRAM) $(DIST)/bin
195 +$(LOOP_OVER_PREDIRS)
196 rm -rf $(OBJS) $(GARBAGE)
199 +$(LOOP_OVER_PREDIRS)
200 rm -rf $(OBJS) $(TARGETS) $(DEPENDENCIES) $(GARBAGE)
201 if test -d $(OBJDIR); then rmdir $(OBJDIR); fi
204 tar cvf $(TARNAME) $(TARFILES)