#
# $Id: //devel/tools/main/arblcheck/Makefile#1 $
#
# written by:  Stephen J. Friedl
#              Software Consultant
#              Tustin, California USA
#              http://www.unixwiz.net/tools/arblcheck.html
#
# This is the makefile for the ARBLCHECK program under UNIX and Win32. 
# In addition to the usual development tools, it requires the ADNS
# library at http://www.chiark.greenend.org.uk/~ian/adns/  There is
# a Win32 port of it, including libraries and a DLL, referenced on that
# page.
#
# NOTE: this requires GNU make on all platforms
#

ifdef PROCESSOR_REVISION
 OS=NT
else
 OS=unix
endif

# ------------------------------------------------------------------------
# UNIX / Win32 differences
#

ifeq ($(OS),NT)
  E=.exe
  O=.obj
  CFLAGS  =
# CFLAGS += /Gz           # use __stdcall calling convention (CAN'T DO THIS)
  CFLAGS += /GF           # enable read-only string pooling
  CFLAGS += /W4           # set max warnings
  CFLAGS += /WX           # warnings are errors
  CFLAGS += /MD           # link with MSVCRT.DLL
  CFLAGS += /YXwinsock.h  # precompile up to winsock.h
else
  E=
  CC = gcc
  CFLAGS += -W -Wall --pedantic
  O=.o
endif

all : arblcheck$E

ifeq ($(OS),NT)

LIBS= adns_lib.lib wsock32.lib Iphlpapi.lib kernel32.lib advapi32.lib

arblcheck.exe : arblcheck.obj
	link /nologo /out:$@ $^ $(LIBS)

else

arblcheck : arblcheck.o
	$(CC) -o $@ $^ -ladns

endif

ifeq ($(OS),NT)
%.obj : %.c
	$(strip cl /nologo $(CFLAGS) $*.c)
else
%.o : %.c
	$(CC) -c $(CFLAGS) $*.c
endif

# "webupdate.mk" includes the code that updates my website with
# this source, and I don't distribute it. The "-" in front is
# used by GNU make to indicate that the file need not exist.

-include webupdate.mk
