# Copyright 1995 Jyrki Salmi, Online Solutions Oy (www.online.fi)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#    this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its
#    contributors may be used to endorse or promote products derived from this
#    software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
###############################################################################
#                                                                             #
#			      Makefile for P.DLL.                                         #
#									                                          #
#		       !! NOTE: GNU MAKE IS REQUIRED !!                               #
#                                                                             #
###############################################################################

# Define the compiler you want to use.
#
# GCC for EMX/GCC
#
# ICC for IBM's Cset++

COMPILER = GCC
#COMPILER = ICC
#COMPILER = ICC_DEBUG

%.obj : %.c
	$(CC) $(CFLAGS) $<

SRCS = \
brw.c \
callback.c \
common.c \
dir.c \
error.c \
global.c \
p.c \
p_dll.c \
tcpipapi.c \
tl.c

OBJS = $(SRCS:.c=.obj)
LIBS =
DEFS = p.def

ifeq ($(COMPILER), GCC)
CC = gcc
CFLAGS = -Zomf -Zsys -Wall -c -O2
LD = gcc
LDFLAGS = -Zomf -Zsys -s -o p.exe $(OBJS) $(DEFS)
endif

ifeq ($(COMPILER), ICC)
CC = icc
CFLAGS = /Q /O /C
LD = link386
LDFLAGS = /nol $(OBJS), p.exe, nul, $(LIBS) os2386.lib dde4sbs.lib, $(DEFS)
endif

ifeq ($(COMPILER), ICC_DEBUG)
CC = icc
CFLAGS = /Q /Ti+ /C
LD = link386
LDFLAGS = /debug /nol $(OBJS), p.exe, nul, $(LIBS) os2386.lib dde4sbs.lib, $(DEFS)
endif

p.exe: $(OBJS) $(DEFS)
	$(LD) $(LDFLAGS)
	rc p

depend:
	makedepend -o.obj $(SRCS)

$(OBJS): makefile

# DO NOT DELETE THIS LINE -- make depend depends on it.

brw.obj: typedefs.h brw.h
callback.obj: typedefs.h p.h callback.h common.h brw.h error.h global.h tl.h
callback.obj: modules.h
common.obj: typedefs.h common.h error.h modules.h global.h brw.h tl.h p.h
dir.obj: typedefs.h dir.h
error.obj: typedefs.h errmsgs.h tcpipapi.h
global.obj: typedefs.h tl.h brw.h p.h
p.obj: typedefs.h p.h callback.h p_dll.h tcpipapi.h global.h brw.h tl.h
p.obj: common.h usage.h
p_dll.obj: typedefs.h common.h p.h p_dll.h error.h modules.h
tcpipapi.obj: p.h typedefs.h tcpipapi.h error.h modules.h
tl.obj: typedefs.h common.h dir.h tl.h global.h brw.h p.h
