Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
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 | CSRCS = \ |
michael@0 | 18 | arena.c \ |
michael@0 | 19 | base64t.c \ |
michael@0 | 20 | getopt.c \ |
michael@0 | 21 | string.c |
michael@0 | 22 | |
michael@0 | 23 | ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH))) |
michael@0 | 24 | CSRCS += arena.c |
michael@0 | 25 | endif |
michael@0 | 26 | |
michael@0 | 27 | ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH))) |
michael@0 | 28 | PROG_SUFFIX = .exe |
michael@0 | 29 | else |
michael@0 | 30 | PROG_SUFFIX = |
michael@0 | 31 | endif |
michael@0 | 32 | |
michael@0 | 33 | PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) |
michael@0 | 34 | |
michael@0 | 35 | TARGETS = $(PROGS) $(OBJS) |
michael@0 | 36 | |
michael@0 | 37 | INCLUDES = -I$(dist_includedir) |
michael@0 | 38 | |
michael@0 | 39 | # Setting the variables LDOPTS and LIBPR. We first initialize |
michael@0 | 40 | # them to the default values, then adjust them for some platforms. |
michael@0 | 41 | LDOPTS = -L$(dist_libdir) |
michael@0 | 42 | LIBPR = -lnspr$(MOD_MAJOR_VERSION) |
michael@0 | 43 | LIBPLC = -lplc$(MOD_MAJOR_VERSION) |
michael@0 | 44 | LIBPLDS = -lplds$(MOD_MAJOR_VERSION) |
michael@0 | 45 | |
michael@0 | 46 | ifeq (,$(filter-out WINCE WINNT, $(OS_ARCH))) |
michael@0 | 47 | LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO |
michael@0 | 48 | ifeq (,$(filter-out WIN95 WINCE WINMO, $(OS_TARGET))) |
michael@0 | 49 | LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) |
michael@0 | 50 | LIBPLC= $(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) |
michael@0 | 51 | LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) |
michael@0 | 52 | else |
michael@0 | 53 | LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) |
michael@0 | 54 | LIBPLC= $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) |
michael@0 | 55 | LIBPLDS= $(dist_libdir)/libplds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) |
michael@0 | 56 | endif |
michael@0 | 57 | endif |
michael@0 | 58 | |
michael@0 | 59 | ifeq ($(OS_ARCH),OS2) |
michael@0 | 60 | LDOPTS += -Zomf -Zlinker /PM:VIO |
michael@0 | 61 | endif |
michael@0 | 62 | |
michael@0 | 63 | ifneq ($(OS_ARCH), WINNT) |
michael@0 | 64 | PWD = $(shell pwd) |
michael@0 | 65 | endif |
michael@0 | 66 | |
michael@0 | 67 | ifeq ($(OS_ARCH), IRIX) |
michael@0 | 68 | LDOPTS += -rpath $(PWD)/$(dist_libdir) |
michael@0 | 69 | endif |
michael@0 | 70 | |
michael@0 | 71 | ifeq ($(OS_ARCH), Linux) |
michael@0 | 72 | ifeq ($(OS_RELEASE), 1.2) |
michael@0 | 73 | EXTRA_LIBS = -ldl |
michael@0 | 74 | else |
michael@0 | 75 | LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir) |
michael@0 | 76 | ifeq ($(USE_PTHREADS),1) |
michael@0 | 77 | EXTRA_LIBS = -lpthread |
michael@0 | 78 | endif |
michael@0 | 79 | endif |
michael@0 | 80 | endif |
michael@0 | 81 | |
michael@0 | 82 | ifeq (,$(filter-out OpenBSD,$(OS_ARCH))) |
michael@0 | 83 | ifeq ($(USE_PTHREADS),1) |
michael@0 | 84 | EXTRA_LIBS = -lpthread |
michael@0 | 85 | endif |
michael@0 | 86 | endif |
michael@0 | 87 | |
michael@0 | 88 | ifeq ($(OS_ARCH), OSF1) |
michael@0 | 89 | LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread |
michael@0 | 90 | endif |
michael@0 | 91 | |
michael@0 | 92 | ifeq ($(OS_ARCH), HP-UX) |
michael@0 | 93 | LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) |
michael@0 | 94 | endif |
michael@0 | 95 | |
michael@0 | 96 | # AIX |
michael@0 | 97 | ifeq ($(OS_ARCH),AIX) |
michael@0 | 98 | LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib |
michael@0 | 99 | LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr |
michael@0 | 100 | LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr |
michael@0 | 101 | endif |
michael@0 | 102 | |
michael@0 | 103 | # Solaris |
michael@0 | 104 | ifeq ($(OS_ARCH), SunOS) |
michael@0 | 105 | ifdef NS_USE_GCC |
michael@0 | 106 | LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir) |
michael@0 | 107 | else |
michael@0 | 108 | LDOPTS += -R $(PWD)/$(dist_libdir) |
michael@0 | 109 | endif |
michael@0 | 110 | |
michael@0 | 111 | # SunOS 5.5 needs to link with -lpthread, even though we already |
michael@0 | 112 | # linked with this system library when we built libnspr.so. |
michael@0 | 113 | ifeq ($(OS_RELEASE), 5.5) |
michael@0 | 114 | ifdef USE_PTHREADS |
michael@0 | 115 | EXTRA_LIBS = -lpthread |
michael@0 | 116 | endif |
michael@0 | 117 | endif |
michael@0 | 118 | endif # SunOS |
michael@0 | 119 | |
michael@0 | 120 | ##################################################### |
michael@0 | 121 | # |
michael@0 | 122 | # The rules |
michael@0 | 123 | # |
michael@0 | 124 | ##################################################### |
michael@0 | 125 | |
michael@0 | 126 | include $(topsrcdir)/config/rules.mk |
michael@0 | 127 | |
michael@0 | 128 | AIX_PRE_4_2 = 0 |
michael@0 | 129 | ifeq ($(OS_ARCH),AIX) |
michael@0 | 130 | ifneq ($(OS_RELEASE),4.2) |
michael@0 | 131 | ifneq ($(USE_PTHREADS), 1) |
michael@0 | 132 | #AIX_PRE_4_2 = 1 |
michael@0 | 133 | endif |
michael@0 | 134 | endif |
michael@0 | 135 | endif |
michael@0 | 136 | |
michael@0 | 137 | ifeq ($(AIX_PRE_4_2),1) |
michael@0 | 138 | |
michael@0 | 139 | # AIX releases prior to 4.2 need a special two-step linking hack |
michael@0 | 140 | # in order to both override the system select() and be able to |
michael@0 | 141 | # get at the original system select(). |
michael@0 | 142 | # |
michael@0 | 143 | # We use a pattern rule in ns/nspr20/config/rules.mk to generate |
michael@0 | 144 | # the .$(OBJ_SUFFIX) file from the .c source file, then do the |
michael@0 | 145 | # two-step linking hack below. |
michael@0 | 146 | |
michael@0 | 147 | $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) |
michael@0 | 148 | @$(MAKE_OBJDIR) |
michael@0 | 149 | rm -f $@ $(AIX_TMP) |
michael@0 | 150 | $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a |
michael@0 | 151 | $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) |
michael@0 | 152 | rm -f $(AIX_TMP) |
michael@0 | 153 | |
michael@0 | 154 | else |
michael@0 | 155 | |
michael@0 | 156 | # All platforms that are not AIX pre-4.2. |
michael@0 | 157 | |
michael@0 | 158 | $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) |
michael@0 | 159 | @$(MAKE_OBJDIR) |
michael@0 | 160 | |
michael@0 | 161 | ifeq ($(OS_ARCH), WINNT) |
michael@0 | 162 | link $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) ws2_32.lib -out:$@ |
michael@0 | 163 | else |
michael@0 | 164 | ifeq ($(OS_ARCH), WINCE) |
michael@0 | 165 | $(LD) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) ws2.lib -out:$@ |
michael@0 | 166 | else |
michael@0 | 167 | ifeq ($(OS_ARCH),OS2) |
michael@0 | 168 | $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) |
michael@0 | 169 | else |
michael@0 | 170 | $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@ |
michael@0 | 171 | endif |
michael@0 | 172 | endif |
michael@0 | 173 | endif |
michael@0 | 174 | endif |
michael@0 | 175 | |
michael@0 | 176 | export:: $(TARGETS) |
michael@0 | 177 | clean:: |
michael@0 | 178 | rm -f $(TARGETS) |