source: trunk/third/mozilla/js/src/rules.mk @ 18860

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