| 1 |
# |
| 2 |
# This Source Code Form is subject to the terms of the Mozilla Public |
| 3 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 |
|
| 6 |
#! gmake |
| 7 |
|
| 8 |
MOD_DEPTH = .. |
| 9 |
topsrcdir = @top_srcdir@ |
| 10 |
srcdir = @srcdir@ |
| 11 |
VPATH = @srcdir@ |
| 12 |
|
| 13 |
include $(MOD_DEPTH)/config/autoconf.mk |
| 14 |
|
| 15 |
include $(topsrcdir)/config/config.mk |
| 16 |
|
| 17 |
DIRS = |
| 18 |
|
| 19 |
CSRCS = \ |
| 20 |
httpget.c \ |
| 21 |
tail.c \ |
| 22 |
$(NULL) |
| 23 |
|
| 24 |
ifeq (,$(filter-out WINNT,$(OS_ARCH))) |
| 25 |
PROG_SUFFIX = .exe |
| 26 |
else |
| 27 |
PROG_SUFFIX = |
| 28 |
endif |
| 29 |
|
| 30 |
PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) |
| 31 |
|
| 32 |
TARGETS = $(PROGS) |
| 33 |
|
| 34 |
INCLUDES = -I$(dist_includedir) |
| 35 |
|
| 36 |
NSPR_VERSION = 3 |
| 37 |
|
| 38 |
# Setting the variables LDOPTS and LIBPR. We first initialize |
| 39 |
# them to the default values, then adjust them for some platforms. |
| 40 |
LDOPTS = -L$(dist_libdir) |
| 41 |
LIBPR = -lnspr$(NSPR_VERSION) |
| 42 |
LIBPLC = -lplc$(NSPR_VERSION) |
| 43 |
|
| 44 |
ifeq ($(OS_ARCH), WINNT) |
| 45 |
LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO |
| 46 |
LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX) |
| 47 |
LIBPLC= $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX) |
| 48 |
endif |
| 49 |
|
| 50 |
ifneq ($(OS_ARCH), WINNT) |
| 51 |
PWD = $(shell pwd) |
| 52 |
endif |
| 53 |
|
| 54 |
ifeq ($(OS_ARCH), HP-UX) |
| 55 |
LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) |
| 56 |
endif |
| 57 |
|
| 58 |
# AIX |
| 59 |
ifeq ($(OS_ARCH),AIX) |
| 60 |
LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib |
| 61 |
LIBPR = -lnspr$(NSPR_VERSION)_shr |
| 62 |
LIBPLC = -lplc$(NSPR_VERSION)_shr |
| 63 |
endif |
| 64 |
|
| 65 |
# Solaris |
| 66 |
ifeq ($(OS_ARCH), SunOS) |
| 67 |
ifdef NS_USE_GCC |
| 68 |
LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir) |
| 69 |
else |
| 70 |
LDOPTS += -R $(PWD)/$(dist_libdir) |
| 71 |
endif |
| 72 |
|
| 73 |
# SunOS 5.5 needs to link with -lpthread, even though we already |
| 74 |
# linked with this system library when we built libnspr.so. |
| 75 |
ifeq ($(OS_RELEASE), 5.5) |
| 76 |
ifdef USE_PTHREADS |
| 77 |
EXTRA_LIBS = -lpthread |
| 78 |
endif |
| 79 |
endif |
| 80 |
endif # SunOS |
| 81 |
|
| 82 |
ifeq ($(OS_ARCH), SCOOS) |
| 83 |
# SCO Unix needs to link against -lsocket again even though we |
| 84 |
# already linked with these system libraries when we built libnspr.so. |
| 85 |
EXTRA_LIBS = -lsocket |
| 86 |
# This hardcodes in the executable programs the directory to find |
| 87 |
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath |
| 88 |
# option for ld on other platforms. |
| 89 |
export LD_RUN_PATH = $(PWD)/$(dist_libdir) |
| 90 |
endif |
| 91 |
|
| 92 |
##################################################### |
| 93 |
# |
| 94 |
# The rules |
| 95 |
# |
| 96 |
##################################################### |
| 97 |
|
| 98 |
include $(topsrcdir)/config/rules.mk |
| 99 |
|
| 100 |
AIX_PRE_4_2 = 0 |
| 101 |
ifeq ($(OS_ARCH),AIX) |
| 102 |
ifneq ($(OS_RELEASE),4.2) |
| 103 |
ifneq ($(USE_PTHREADS), 1) |
| 104 |
#AIX_PRE_4_2 = 1 |
| 105 |
endif |
| 106 |
endif |
| 107 |
endif |
| 108 |
|
| 109 |
ifeq ($(AIX_PRE_4_2),1) |
| 110 |
|
| 111 |
# AIX releases prior to 4.2 need a special two-step linking hack |
| 112 |
# in order to both override the system select() and be able to |
| 113 |
# get at the original system select(). |
| 114 |
# |
| 115 |
# We use a pattern rule in ns/nspr20/config/rules.mk to generate |
| 116 |
# the .$(OBJ_SUFFIX) file from the .c source file, then do the |
| 117 |
# two-step linking hack below. |
| 118 |
|
| 119 |
$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) |
| 120 |
@$(MAKE_OBJDIR) |
| 121 |
rm -f $@ $(AIX_TMP) |
| 122 |
$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a |
| 123 |
$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) |
| 124 |
rm -f $(AIX_TMP) |
| 125 |
|
| 126 |
else |
| 127 |
|
| 128 |
# All platforms that are not AIX pre-4.2. |
| 129 |
|
| 130 |
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) |
| 131 |
@$(MAKE_OBJDIR) |
| 132 |
ifeq ($(OS_ARCH), WINNT) |
| 133 |
link $(LDOPTS) $< $(LIBPR) $(LIBPLC) ws2_32.lib -out:$@ |
| 134 |
else |
| 135 |
$(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPLC) $(EXTRA_LIBS) -o $@ |
| 136 |
endif |
| 137 |
endif |
| 138 |
|
| 139 |
export:: $(TARGETS) |
| 140 |
clean:: |
| 141 |
rm -f $(TARGETS) |
| 142 |
|