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