#-------------------------------------------------------------------------
#
# Makefile--
#    Makefile for the port-specific subsystem of the backend
#
# We have two different modes of operation: 1) put stuff specific to Port X
# in subdirectory X and have that subdirectory's make file make it all, and 
# 2) use conditional statements in the present make file to include what's
# necessary for a specific port in our own output.  (1) came first, but (2)
# is superior for many things, like when the same thing needs to be done for
# multiple ports and you don't want to duplicate files in multiple 
# subdirectories.  Much of the stuff done via Method 1 today should probably
# be converted to Method 2.  
#
# IDENTIFICATION
#    $Header: /cvsroot/pgsql/src/backend/port/Makefile,v 1.11 2002/03/13 00:05:06 petere Exp $
#
#-------------------------------------------------------------------------

subdir = src/backend/port
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global

OBJS = dynloader.o

OBJS += $(GETHOSTNAME) $(GETRUSAGE) $(INET_ATON) $(ISINF) $(MEMCMP) \
        $(MISSING_RANDOM) $(SNPRINTF) $(SRANDOM) $(STRCASECMP) $(STRERROR) \
        $(STRTOL) $(STRTOUL) $(SNPRINTF)

OBJS += $(TAS)

ifdef STRDUP
OBJS += $(top_builddir)/src/utils/strdup.o
endif
ifeq ($(PORTNAME), qnx4)
OBJS += getrusage.o qnx4/SUBSYS.o
endif
ifeq ($(PORTNAME), beos)
OBJS += beos/SUBSYS.o
endif
ifeq ($(PORTNAME), darwin)
OBJS += darwin/SUBSYS.o
endif

all: SUBSYS.o

SUBSYS.o: $(OBJS)
	$(LD) $(LDREL) $(LDOUT) $@ $^

$(top_builddir)/src/utils/strdup.o:
	$(MAKE) -C $(top_builddir)/src/utils strdup.o

qnx4/SUBSYS.o: qnx4.dir

qnx4.dir:
	$(MAKE) -C qnx4 all

beos/SUBSYS.o: beos.dir

beos.dir:
	$(MAKE) -C beos all

darwin/SUBSYS.o: darwin.dir

darwin.dir:
	$(MAKE) -C darwin all

tas.o: tas.s
	$(CC) $(CFLAGS) -c $<

distclean clean:
	rm -f SUBSYS.o $(OBJS)
	$(MAKE) -C beos clean
	$(MAKE) -C darwin clean
	$(MAKE) -C qnx4 clean
