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_CFILES:.c=.obj))
47
PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.obj))
49
LIB_OBJS = $(addprefix $(OBJDIR)/, $(LIB_CFILES:.c=.o))
50
LIB_OBJS += $(addprefix $(OBJDIR)/, $(LIB_ASFILES:.s=.o))
51
PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.o))
54
CFILES = $(LIB_CFILES) $(PROG_CFILES)
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
$(CC) -o $@ $(CFLAGS) $*.c $(LDFLAGS)
75
# This rule must come before the rule with no dep on header
76
$(OBJDIR)/%.o: %.c %.h
78
$(CC) -o $@ -c $(CFLAGS) $*.c
83
$(CC) -o $@ -c $(CFLAGS) $*.c
87
$(AS) -o $@ $(ASFLAGS) $*.s
89
# This rule must come before rule with no dep on header
90
$(OBJDIR)/%.obj: %.c %.h
92
$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $*.c
96
$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $*.c
98
$(OBJDIR)/js.obj: js.c
100
$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $<
102
ifeq ($(OS_ARCH),OS2)
103
$(LIBRARY): $(LIB_OBJS)
104
$(AR) $@ $? $(AR_OS2_SUFFIX)
108
$(SHARED_LIBRARY): $(LIB_OBJS)
109
link.exe $(LIB_LINK_FLAGS) /base:0x61000000 $(OTHER_LIBS) \
111
/implib:"$(OBJDIR)/$(@F:.dll=.lib)" $^
113
$(LIBRARY): $(LIB_OBJS)
117
$(SHARED_LIBRARY): $(LIB_OBJS)
118
$(MKSHLIB) -o $@ $(LIB_OBJS) $(LDFLAGS) $(OTHER_LIBS)
123
$(CLASSDIR)/$(OBJDIR)/$(JARPATH)/%.class: %.java
125
$(JAVAC) $(JAVAC_FLAGS) $<
128
if test ! -d $(@D); then rm -rf $(@D); mkdir -p $(@D); fi
133
@for d in $(DIRS); do \
134
if test -d $$d; then \
136
echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \
137
cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \
140
echo "Skipping non-directory $$d..."; \
146
LOOP_OVER_PREDIRS = \
147
@for d in $(PREDIRS); do \
148
if test -d $$d; then \
150
echo "cd $$d; $(MAKE) -f Makefile.ref $@"; \
151
cd $$d; $(MAKE) -f Makefile.ref $@; cd ..; \
154
echo "Skipping non-directory $$d..."; \
160
+$(LOOP_OVER_PREDIRS)
161
mkdir -p $(DIST)/include $(DIST)/$(LIBDIR) $(DIST)/bin
162
ifneq "$(strip $(HFILES))" ""
163
$(CP) $(HFILES) $(DIST)/include
165
ifneq "$(strip $(LIBRARY))" ""
166
$(CP) $(LIBRARY) $(DIST)/$(LIBDIR)
168
ifneq "$(strip $(JARS))" ""
169
$(CP) $(JARS) $(DIST)/$(LIBDIR)
171
ifneq "$(strip $(SHARED_LIBRARY))" ""
172
$(CP) $(SHARED_LIBRARY) $(DIST)/$(LIBDIR)
174
ifneq "$(strip $(PROGRAM))" ""
175
$(CP) $(PROGRAM) $(DIST)/bin
181
@cd fdlibm; $(MAKE) -f Makefile.ref clean
184
rm -rf $(OBJS) $(TARGETS) $(DEPENDENCIES)
185
@cd fdlibm; $(MAKE) -f Makefile.ref clobber
188
gcc -MM $(CFLAGS) $(LIB_CFILES)
191
tar cvf $(TARNAME) $(TARFILES)