# Makefile for analog 5.32
# Please read docs/Readme.html, or http://www.analog.cx/
# This is a general Unix-like Makefile: Makefiles for other OS's can be found
#   in the "build" directory.
CC = wcl386     # which compiler to use: eg cc, acc, gcc. NB Different
#                    compilers need different CFLAGS, e.g., -O instead of -O2.
MAKE = wmake -u # which "make" to use
CFLAGS =        # options, e.g. for optimisation or ANSI compilation.
#                 HP/UX cc needs CFLAGS = -Aa (HP/UX 9) or -Ae (HP/UX 10)
#                 BeOS needs CFLAGS = -O2 -Wl,-L/boot/home/config/lib
#                 BS2000/OSD needs CFLAGS = -XLLML -XLLMK
#                 NeXTSTEP needs CFLAGS = -O2 -pipe -no-precomp
DEFS =          # any combination of -DNOPIPES -DNODNS -DNODIRENT -DNOGLOB ...
#                 ... -DNOOPEN -DNOFOLLOW -DNOALARM -DNOGRAPHICS -DNOGMTIME ...
#                 ... -DEBCDIC -DUSE_PLAIN_SETJMP ...
#                 ... -DHAVE_GD -DHAVE_ZLIB -DHAVE_PCRE ...
#                 ... -DNEED_STRCMP -DNEED_MEMMOVE -DNEED_STRTOUL ...
#                 ... -DNEED_DIFFTIME -DHAVE_ADDR_T -DNEED_FLOATINGPOINT_H
#                 All the options are explained at the bottom of this file.
#
#                 Solaris 2 (SunOS 5+) might need DEFS = -DNEED_STRCMP
#                 SunOS 4 usually needs...
#   DEFS = -DNEED_MEMMOVE -DNEED_STRTOUL -DNEED_DIFFTIME -DNEED_FLOATINGPOINT_H
#                 64-bit Solaris and Tru64 version 5+ need DEFS = -DHAVE_ADDR_T
#                 SCO OpenServer 5 needs DEFS = -DPATH_MAX=2048
#                 BeOS 5.0.3 or below needs DEFS = -DNODNS
#                 DYNIX/ptx needs DEFS = -D_SOCKET_VERSION=11
#                 MPE/iX needs DEFS = -D_POSIX_SOURCE -D_SOCKET_SOURCE
#
OS = OS2     # Operating system: UNIX, DOS, WIN32, MAC, OS2, OSX, VMS
#                   RISCOS, BEOS, NEXTSTEP, MPEIX, BS2000, AS400, OS390
#LIBS = -lm  # extra libraries needed; most platforms (but not OS X or BeOS)
#               need -lm LAST
#             if you defined HAVE_GD above you also need -lgd -lpng -ljpeg -lz
#             if you defined HAVE_ZLIB above you also need -lz
#             if you defined HAVE_PCRE above you also need -lpcre
#        Also Solaris 2 (SunOS 5+) needs LIBS = -lnsl -lm
#             SCO Unix needs LIBS = -lsocket -lm
#             IRIX needs LIBS = -lc -lm
#             Windows compilers probably need LIBS = -lwsock32 -lm
#             BeOS 5.0.3 or below needs LIBS = -lnet -lglob; 5.0.4 or above
#             needs LIBS = -lbind -lglob; and install libglob from BeBits.com
#             OS/2 with EMX needs LIBS = -lsocket -lm
#             BS2000/OSD needs LIBS = -lsocket -lm
#             MPE/iX needs LIBS = -lsocket -lm
#             SVR4 needs LIBS = -lsocket -lnsl -lm
#             DYNIX/ptx needs LIBS = -L/usr/lib/bsd-socket -lsocket -lnsl -lm
PROGRAM = analog.exe
TARGET = analog
OBJS = alias.obj analog.obj cache.obj dates.obj globals.obj hash.obj init.obj init2.obj \
        input.obj macinput.obj macstuff.obj output.obj output2.obj process.obj settings.obj \
        sort.obj tree.obj utils.obj win32.obj
SUBDIRS = libgd libpng pcre zlib
SUBDIROBJS = libgd/gd.obj  libgd/gd_io.obj libgd/gd_io_file.obj libgd/gd_png.obj \
        libgd/gdfontf.obj libgd/gdfonts.obj libgd/gdtables.obj \
        libpng/png.obj libpng/pngerror.obj libpng/pngmem.obj libpng/pngset.obj \
        libpng/pngtrans.obj libpng/pngwio.obj libpng/pngwrite.obj \
        libpng/pngwtran.obj libpng/pngwutil.obj pcre/pcre.obj \
        zlib/adler32.obj zlib/compress.obj zlib/crc32.obj zlib/deflate.obj \
        zlib/gzio.obj zlib/infblock.obj zlib/infcodes.obj zlib/inffast.obj \
        zlib/inflate.obj zlib/inftrees.obj zlib/infutil.obj zlib/trees.obj \
        zlib/uncompr.obj zlib/zutil.obj
HEADERS = anlghead.h anlghea2.h anlghea3.h anlghea4.h macdir.h \
        pcre/pcre.h libgd/gd.h libgd/gdfontf.h libgd/gdfonts.h
ALLCFLAGS = $(CFLAGS) $(DEFS) -d$(OS) -dNOGLOB
ALLOBJS = $(OBJS) $(SUBDIROBJS)
$(PROGRAM): $(OBJS) $(SUBDIRS) $(HEADERS) Makefile
#        $(CC) $(CFLAGS) /fe=$(TARGET) -l=OS2V2 $(ALLOBJS) $(LIBS)
	*wlink name $(TARGET) SYS os2v2 OPTION CASEEXACT @analog.lk32
        @echo "***"
        @echo "***IMPORTANT: You must read the licence before using analog"
        @echo "***"
# There doesn't seem to be a good way to write all these rules in a generic
# form that works for all "make" programs
libgd : .SYMBOLIC
        cd libgd
	$(MAKE) "CC=$(CC)" "ALLCFLAGS=$(ALLCFLAGS)"
	cd ..
libpng : .SYMBOLIC
        cd libpng
	$(MAKE) "CC=$(CC)" "ALLCFLAGS=$(ALLCFLAGS)"
	cd ..
pcre : .SYMBOLIC
        cd pcre
	$(MAKE) "CC=$(CC)" "ALLCFLAGS=$(ALLCFLAGS)"
	cd ..
zlib : .SYMBOLIC
        cd zlib
	$(MAKE) "CC=$(CC)" "ALLCFLAGS=$(ALLCFLAGS)"
	cd ..
alias.obj : alias.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c alias.c
analog.obj : analog.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c analog.c
cache.obj : cache.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c cache.c
dates.obj : dates.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c dates.c
globals.obj : globals.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c globals.c
hash.obj : hash.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c hash.c
init.obj : init.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c init.c
init2.obj : init2.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c init2.c
input.obj : input.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c input.c
macinput.obj : macinput.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c macinput.c
macstuff.obj : macstuff.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c macstuff.c
output.obj : output.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c output.c
output2.obj : output2.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c output2.c
process.obj : process.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c process.c
settings.obj : settings.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c settings.c
sort.obj : sort.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c sort.c
tree.obj : tree.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c tree.c
utils.obj : utils.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c utils.c
win32.obj : win32.c $(HEADERS) Makefile
        $(CC) $(ALLCFLAGS) -c win32.c
force :
        rm -f $(ALLOBJS)
        make $(PROGRAM) 'CFLAGS=$(CFLAGS)' 'LIBS=$(LIBS)' \
        'DEFS=$(DEFS)' 'CC=$(CC)'
clean :
        rm -f $(ALLOBJS) $(TARGET) *~ */*~
# OK, here's the details on all the DEFS options, in case anyone needs to know.
# NOPIPES excludes non-ANSI functions popen() and pclose(). You will lose the
#   UNCOMPRESS command.
# NODNS excludes all the DNS lookup code. This is platform-dependent, but
#   typically involves header files <net*.h> and functions like inet_addr()
#   and gethostbyaddr().
# NODIRENT stops you using wildcards in logfile names. This code is also
#   platform-dependent. But under Unix, the header file <glob.h> and function
#   glob() from POSIX.2 are used; _unless_ NOGLOB is defined, in which case
#   the header file <dirent.h> and functions stat(), opendir(), readdir() and
#   closedir() are used instead. In this latter case, you can't use wildcards
#   in directory names.
# NOOPEN excludes non-ANSI functions open() and fdopen(). This results in an
#   alternative, less safe locking mechanism for DNS files and cache files.
# NOFOLLOW omits code including the functions realpath(), access() and stat()
#   and the header file <unistd.h> and possibly <sys/param.h>. Analog won't
#   then follow symbolic links when guessing path names.
# NOALARM omits code including the function alarm() and the header file
#   <unistd.h>. You will lose the ability to set a DNS timeout.
#
# ** If all of the above are defined only features defined in ANSI C are used.
#
# NOGRAPHICS omits the code for generating pie charts, including all of libgd
#   and libpng.
# HAVE_GD means you already have libgd (at least version 1.8), libpng, libjpeg
#   and zlib, and you want to use your version of these libraries not
#   mine. This is likely to reduce the size of the binary. Also you will gain
#   the JPEGCHARTS command. You will also need to include
#   "-lgd -lpng -ljpeg -lz" in the LIBS above.
# HAVE_ZLIB means you already have zlib, and you want to use your version not
#   mine. This is likely to reduce the size of the binary. You will also need
#   to include "-lz" in the LIBS above.
# HAVE_PCRE means you already have libpcre, and you want to use your version
#   not mine. This is likely to reduce the size of the binary.
#   You will also need to include "-lpcre" in the LIBS.
# EBCDIC is needed if your server uses the EBCDIC character set, not ASCII.
# USE_PLAIN_SETJMP uses ANSI setjmp() instead of POSIX sigsetjmp().
# NEED_STRCMP, NEED_MEMMOVE, NEED_STRTOUL and NEED_DIFFTIME provide
#   replacements for standard functions missing on some systems.
# NOGMTIME doesn't use the gmtime() function.
# NEED_FLOATINGPOINT_H includes a header file called <floatingpoint.h>.
# HAVE_ADDR_T is needed if inet_addr() returns in_addr_t which is not the
#   same as unsigned long.

