michael@0: # michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: #! gmake michael@0: michael@0: MOD_DEPTH = .. michael@0: topsrcdir = @top_srcdir@ michael@0: srcdir = @srcdir@ michael@0: VPATH = @srcdir@ michael@0: michael@0: include $(MOD_DEPTH)/config/autoconf.mk michael@0: michael@0: include $(topsrcdir)/config/config.mk michael@0: michael@0: ifeq ($(OS_TARGET), WIN16) michael@0: OS_CFLAGS = $(OS_EXE_CFLAGS) michael@0: endif michael@0: michael@0: michael@0: DIRS = michael@0: michael@0: CSRCS = \ michael@0: httpget.c \ michael@0: tail.c \ michael@0: $(NULL) michael@0: michael@0: ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) michael@0: PROG_SUFFIX = .exe michael@0: else michael@0: PROG_SUFFIX = michael@0: endif michael@0: michael@0: PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) michael@0: michael@0: TARGETS = $(PROGS) michael@0: michael@0: INCLUDES = -I$(dist_includedir) michael@0: michael@0: NSPR_VERSION = 3 michael@0: michael@0: # Setting the variables LDOPTS and LIBPR. We first initialize michael@0: # them to the default values, then adjust them for some platforms. michael@0: LDOPTS = -L$(dist_libdir) michael@0: LIBPR = -lnspr$(NSPR_VERSION) michael@0: LIBPLC = -lplc$(NSPR_VERSION) michael@0: michael@0: ifeq ($(OS_ARCH), WINNT) michael@0: ifeq ($(OS_TARGET), WIN16) michael@0: LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib michael@0: LIBPLC= $(dist_libdir)/plc$(NSPR_VERSION).lib michael@0: else michael@0: LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO michael@0: LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX) michael@0: LIBPLC= $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX) michael@0: endif michael@0: endif michael@0: michael@0: ifeq ($(OS_ARCH),OS2) michael@0: LDOPTS += -Zomf -Zlinker /PM:VIO michael@0: endif michael@0: michael@0: ifneq ($(OS_ARCH), WINNT) michael@0: PWD = $(shell pwd) michael@0: endif michael@0: michael@0: ifeq ($(OS_ARCH), IRIX) michael@0: LDOPTS += -rpath $(PWD)/$(dist_libdir) michael@0: endif michael@0: michael@0: ifeq ($(OS_ARCH), OSF1) michael@0: LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread michael@0: endif michael@0: michael@0: ifeq ($(OS_ARCH), HP-UX) michael@0: LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) michael@0: endif michael@0: michael@0: # AIX michael@0: ifeq ($(OS_ARCH),AIX) michael@0: LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib michael@0: LIBPR = -lnspr$(NSPR_VERSION)_shr michael@0: LIBPLC = -lplc$(NSPR_VERSION)_shr michael@0: endif michael@0: michael@0: # Solaris michael@0: ifeq ($(OS_ARCH), SunOS) michael@0: ifdef NS_USE_GCC michael@0: LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir) michael@0: else michael@0: LDOPTS += -R $(PWD)/$(dist_libdir) michael@0: endif michael@0: michael@0: # SunOS 5.5 needs to link with -lpthread, even though we already michael@0: # linked with this system library when we built libnspr.so. michael@0: ifeq ($(OS_RELEASE), 5.5) michael@0: ifdef USE_PTHREADS michael@0: EXTRA_LIBS = -lpthread michael@0: endif michael@0: endif michael@0: endif # SunOS michael@0: michael@0: ifeq ($(OS_ARCH), SCOOS) michael@0: # SCO Unix needs to link against -lsocket again even though we michael@0: # already linked with these system libraries when we built libnspr.so. michael@0: EXTRA_LIBS = -lsocket michael@0: # This hardcodes in the executable programs the directory to find michael@0: # libnspr.so etc. at program startup. Equivalent to the -R or -rpath michael@0: # option for ld on other platforms. michael@0: export LD_RUN_PATH = $(PWD)/$(dist_libdir) michael@0: endif michael@0: michael@0: ##################################################### michael@0: # michael@0: # The rules michael@0: # michael@0: ##################################################### michael@0: michael@0: include $(topsrcdir)/config/rules.mk michael@0: michael@0: AIX_PRE_4_2 = 0 michael@0: ifeq ($(OS_ARCH),AIX) michael@0: ifneq ($(OS_RELEASE),4.2) michael@0: ifneq ($(USE_PTHREADS), 1) michael@0: #AIX_PRE_4_2 = 1 michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: ifeq ($(AIX_PRE_4_2),1) michael@0: michael@0: # AIX releases prior to 4.2 need a special two-step linking hack michael@0: # in order to both override the system select() and be able to michael@0: # get at the original system select(). michael@0: # michael@0: # We use a pattern rule in ns/nspr20/config/rules.mk to generate michael@0: # the .$(OBJ_SUFFIX) file from the .c source file, then do the michael@0: # two-step linking hack below. michael@0: michael@0: $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) michael@0: @$(MAKE_OBJDIR) michael@0: rm -f $@ $(AIX_TMP) michael@0: $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a michael@0: $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) michael@0: rm -f $(AIX_TMP) michael@0: michael@0: else michael@0: michael@0: # All platforms that are not AIX pre-4.2. michael@0: michael@0: $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) michael@0: @$(MAKE_OBJDIR) michael@0: ifeq ($(OS_ARCH), WINNT) michael@0: ifeq ($(OS_TARGET),WIN16) michael@0: echo system windows >w16link michael@0: echo option map >>w16link michael@0: echo option stack=10K >>w16link michael@0: echo option heapsize=32K >>w16link michael@0: echo debug $(DEBUGTYPE) all >>w16link michael@0: echo name $@ >>w16link michael@0: echo file >>w16link michael@0: echo $< >>w16link michael@0: echo library >>w16link michael@0: echo $(LIBPR), >>w16link michael@0: echo $(LIBPLC), >>w16link michael@0: echo winsock.lib >>w16link michael@0: wlink @w16link. michael@0: else michael@0: link $(LDOPTS) $< $(LIBPR) $(LIBPLC) ws2_32.lib -out:$@ michael@0: endif michael@0: else michael@0: ifeq ($(OS_ARCH),OS2) michael@0: $(LINK) $(LDOPTS) $< $(LIBPR) $(LIBPLC) $(OS_LIBS) $(EXTRA_LIBS) -o $@ michael@0: else michael@0: $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPLC) $(EXTRA_LIBS) -o $@ michael@0: endif michael@0: endif michael@0: endif michael@0: michael@0: export:: $(TARGETS) michael@0: clean:: michael@0: rm -f $(TARGETS) michael@0: