# # The contents of this file are subject to the AOLserver Public License # Version 1.1 (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at # http://aolserver.com/. # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. # # The Original Code is AOLserver Code and related documentation # distributed by AOL. # # The Initial Developer of the Original Code is America Online, # Inc. Portions created by AOL are Copyright (C) 1999 America Online, # Inc. All Rights Reserved. # # Alternatively, the contents of this file may be used under the terms # of the GNU General Public License (the "GPL"), in which case the # provisions of GPL are applicable instead of those above. If you wish # to allow use of your version of this file only under the terms of the # GPL and not to allow others to use your version of this file under the # License, indicate your decision by deleting the provisions above and # replace them with the notice and other provisions required by the GPL. # If you do not delete the provisions above, a recipient may use your # version of this file under either the License or the GPL. # # # $Header: /cvsroot/aolserver/aolserver/include/ns.mak.in,v 1.5 2006/06/27 17:00:55 jgdavidson Exp $ # # ns.mak.in -- # # Makefile include for AOLserver modules, libraries, and programs. Variables to set # before including this file include: # # AOLSERVER AOLserver install directory # DLL Root name of dynamic library (without lib prefix or extension) # OBJS List of library object files (required with DLL) # DLLINIT Dynamic library entry point # DLLLIBS Extra dynamic library link libraries # MOD Name of module # MODOBJS List of module object files (required with MOD) # MODINIT Module entry point # MODLIBS Extra module link libraries # PGM Name of executable program # PGMOBJS List of program object files (required with PGM) # PGMLIBS Extra program link libraries # HDRS Header files which objects depend on # INSTALL Extra install directive(s) # CLEAN Extra clean directive(s) # # At least one of PGM, MOD, or DLL must be defined. # # See ../nsd/Makefile and ../nsdb/Makefile for examples. # # # Install directories. # AOLSERVER = /usr/local/aolserver TCLSH = /usr/local/bin/tclsh8.4-threads INSTBIN = $(AOLSERVER)/bin INSTLIB = $(AOLSERVER)/lib INSTINC = $(AOLSERVER)/include INSTTCL = $(AOLSERVER)/modules/tcl INSTSRV = $(AOLSERVER)/servers/server1 INSTSRVMOD = $(INSTSRV)/modules INSTSRVPAG = $(INSTSRV)/pages SH = /bin/sh # # Compiler and linker options. # LIBEXT = .dylib LDLIB = $(CC) -dynamiclib -install_name $(INSTLIB)/$(DLLBIN) LDSO = $(CC) -bundle CCRFLAG = LDRFLAG = CCRPATH += LDRPATH += CC = $(PURIFY) cc CFLAGS_DEBUG = -g CFLAGS_OPTIMIZE = -Os CFLAGS_WARNING = -Wall -Wno-implicit-int -fno-strict-aliasing CFLAGS_INCLUDE = -I$(INCDIR) -I/usr/local/include/tcl8.4 CFLAGS_EXTRA = -fno-common -O -pipe -pipe DEFS = -DNO_CONST -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DHAVE_PTHREAD_ATTR_SETSTACKSIZE=1 -DHAVE_PTHREAD_ATFORK=1 -DTCL_THREADS=1 -DHAVE_COREFOUNDATION=1 -DMAC_OSX_TCL=1 -DTCL_WIDE_INT_TYPE=long\ long -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_STRTOLL=1 -DHAVE_STRTOULL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_GETPWUID_R_5=1 -DHAVE_GETPWUID_R=1 -DHAVE_GETPWNAM_R_5=1 -DHAVE_GETPWNAM_R=1 -DHAVE_GETGRGID_R_5=1 -DHAVE_GETGRGID_R=1 -DHAVE_GETGRNAM_R_5=1 -DHAVE_GETGRNAM_R=1 -DHAVE_MTSAFE_GETHOSTBYNAME=1 -DHAVE_MTSAFE_GETHOSTBYADDR=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_GMTIME_R=1 -DHAVE_LOCALTIME_R=1 -DHAVE_TM_GMTOFF=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_PUTENV_THAT_COPIES=1 -DHAVE_LANGINFO=1 -DHAVE_COPYFILE_H=1 -DHAVE_COPYFILE=1 -DHAVE_LIBKERN_OSATOMIC_H=1 -DHAVE_OSSPINLOCKLOCK=1 -DHAVE_PTHREAD_ATFORK=1 -DUSE_VFORK=1 -DTCL_DEFAULT_ENCODING=\"utf-8\" -DTCL_LOAD_FROM_MEMORY=1 -DHAVE_AVAILABILITYMACROS_H=1 -DHAVE_FTS=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_FILIO_H=1 -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_TIMEGM=1 -DHAVE_DRAND48=1 -DHAVE_RANDOM=1 -DHAVE__NSGETENVIRON=1 -DUSE_DLSHL=1 -DHAVE_GETADDRINFO=1 -DHAVE_GETNAMEINFO=1 CFLAGS += $(CFLAGS_OPTIMIZE) $(CFLAGS_WARNING) $(CFLAGS_EXTRA) $(CFLAGS_INCLUDE) $(DEFS) ifndef SRCDIR UTILS = $(AOLSERVER)/bin LIBS += -L$(AOLSERVER)/lib -lnsd -lnsthread INCDIR = $(AOLSERVER)/include else UTILS = $(SRCDIR)/util INCDIR = $(SRCDIR)/include ifneq (nsthread,$(DLL)) ifneq (nsd,$(DLL)) ifneq (nsthreadtest,$(PGM)) LIBS += -L$(SRCDIR)/nsd -lnsd endif endif LIBS += -L$(SRCDIR)/nsthread -lnsthread endif endif LIBS += -L/usr/local/lib -ltcl8.4-threads -pthread -framework CoreFoundation CCLIBS = $(LIBS) -prebind -headerpad_max_install_names -Wl,-search_paths_first # # Shell utilities. # RANLIB = ranlib MAKEALL = $(TCLSH) $(UTILS)/nsmakeall.tcl RM = $(TCLSH) $(UTILS)/nsremove.tcl INST = $(TCLSH) $(UTILS)/nsinstall.tcl INSTMAN = $(SH) $(UTILS)/nsinstall-man.sh -v -s INSTALL_SH = $(UTILS)/install-sh -c INSTALL_DATA = $(INSTALL_SH) -m 644 # # Platform-specific options. # uname = $(shell uname -a) # Solaris 2.6+ ifneq (,$(findstring SunOS,$(uname))) ifneq (,$(findstring 5.6,$(uname))) LIBS+=-lthread -lposix4 else LIBS+=-lrt endif endif # Mac OS X ifneq (,$(findstring Darwin,$(uname))) LDFLAGS += -O -pipe -pipe endif # Add dynamic library entry point flags. ifdef DLLINIT ifneq (,$(findstring Darwin,$(uname))) INIT = _$(DLLINIT) LDLIB += -init _$(INIT) else INIT = _ns_init endif endif ifdef MOD DLL = $(MOD) MODBIN = $(MOD).so BUILD += $(MODBIN) INSTALL += install-mod CLEAN += clean-mod ifdef MODINIT MODSRC = $(INCDIR)/nsmodinit.c MODOBJ = $(MOD)_modinit.o MODOBJS += $(MODOBJ) endif endif ifdef DLL DLLBIN = lib$(DLL)$(LIBEXT) DLLLIB = lib$(DLL).a OBJS += $(UNIXOBJS) ifdef DLLINIT LIBSRC = $(INCDIR)/nslibinit.c LIBOBJ = $(DLL)_libinit.o endif BUILD += $(DLLLIB) $(DLLBIN) INSTALL += install-dll CLEAN += clean-dll MODLIBS += -L. -l$(DLL) PGMLIBS += -L. -l$(DLL) endif ifdef PGM BUILD += $(PGM) INSTALL += install-pgm CLEAN += clean-pgm endif ifdef MAN INSTALL += install-man install-html endif all build: $(BUILD) install: $(INSTALL) clean: $(CLEAN) $(DLLBIN): $(OBJS) $(LIBOBJ) $(RM) $(DLLBIN) $(LDLIB) $(LDFLAGS) -o $(DLLBIN) $(OBJS) $(LIBOBJ) \ $(DLLLIBS) $(LIBS) $(DLLLIB): $(OBJS) $(AR) rv $(DLLLIB) $(OBJS) $(RANLIB) $(DLLLIB) $(MODBIN): $(MODOBJS) $(DLLBIN) $(RM) $(MODBIN) $(LDSO) $(LDFLAGS) -o $(MODBIN) $(MODOBJS) $(MODLIBS) $(LIBS) $(MODOBJ): $(MODSRC) $(CC) $(CFLAGS) -DNS_MODINIT=$(MODINIT) -c -o $(MODOBJ) $(MODSRC) $(LIBOBJ): $(LIBSRC) $(CC) $(CFLAGS) -DNS_INIT=$(INIT) -DNS_LIBINIT=$(DLLINIT) -c -o $(LIBOBJ) $(LIBSRC) $(PGM): $(PGMOBJS) $(DLLLIB) $(DLLBIN) $(RM) $(PGM) $(CC) $(LDFLAGS) -o $(PGM) $(PGMOBJS) \ $(PGMLIBS) $(CCLIBS) $(MODOBJS) $(OBJS) $(PGMOBJS): $(HDRS) $(INCDIR)/ns.h $(INCDIR)/nsthread.h install-mod: $(MODBIN) $(INST) -d $(INSTBIN) -e $(MODBIN) install-dll: $(DLLBIN) $(INST) -d $(INSTLIB) -e $(DLLBIN) $(INST) -d $(INSTLIB) $(DLLLIB) $(RANLIB) $(INSTLIB)/$(DLLLIB) install-pgm: $(PGM) $(INST) -d $(INSTBIN) -e $(PGM) install-man: for i in $(MAN); do \ $(INSTMAN) $$i $(AOLSERVER)/man; \ done install-html: for i in $(MAN); do \ $(INSTMAN) -h $$i $(AOLSERVER)/html; \ done clean-mod: $(RM) $(MODBIN) $(MODOBJS) clean-dll: $(RM) $(DLLBIN) $(DLLLIB) $(OBJS) $(LIBOBJ) clean-pgm: $(RM) $(PGM) $(PGMOBJS) .PHONY: clean-mod clean-dll clean-pgm install-man1 install-man3 install-mann