#========================================================================
#  Copyright (C) GemTalk Systems 1986-2024.  All Rights Reserved.
# 
#  Name - Makefile.install
# 
#  Usage: this makefile is used by the buildsystests script in the same
#         directory. Users should use 'buildsystests' instead of 'make'.
#
#  Description - Makefile for misc public domain programs used by GemStone
# 
#========================================================================


# Use strict gcc options in preference to lint
GCCFLAGS= -Wall -pedantic -Wshadow -Wpointer-arith -Wwrite-strings \
    -Wid-clash-32 -Wconversion -Wstrict-prototypes \
    -Wmissing-prototypes -Wnested-externs -Winline


RM = rm -f

SOURCES = Makefile fileopentest.c getdtablesize.c \
  gethostbyname.c getservbyname.c getservbyport.c gsstat.cc

TARGETS = fileopentest getdtablesize gethostbyname getservbyname \
  getservbyport shmem getpwnam gsstat

all:	$(TARGETS)

clean:
	-$(RM) *.o

# Here are the basic dependencies.  The rules are provided because Sun's
# Make seems to be horribly broken.  Simple lines of the form,
#
# fileopentest: fileopentest.c
#
# (for instance) seem to work just fine with Gnu make.

fileopentest: fileopentest.c
	$(CC) $< $(CFLAGS) -o $@ $(LDLIBS)

getdtablesize: getdtablesize.c
	$(CC) $< $(CFLAGS) -o $@ $(LDLIBS)

gethostbyname: gethostbyname.c
	$(CC) $< $(CFLAGS) -I./include -o $@ $(LDLIBS)

getservbyname: getservbyname.c
	$(CC) $< $(CFLAGS) -o $@ $(LDLIBS)

getservbyport: getservbyport.c
	$(CC) $< $(CFLAGS) -o $@ $(LDLIBS)

getpwnam: getpwnam.c
	$(CC) $< $(CFLAGS) -o $@ $(LDLIBS)

shmem: shmem.c
	$(CC) $< $(CFLAGS) -I$(GEMSTONE)/include -o $@ $(LDLIBS)

# exes that load shared libs need -brtl on AIX
EXTRA_LD_FLAG =
ifeq ($(MTYPE), 9) # AIX
  EXTRA_LD_FLAG = -brtl
endif

gsstat: gsstat.cc
	$(CC) $< $(CFLAGS) -I$(GEMSTONE)/include -o $@ $(EXTRA_LD_FLAG) -L$(OBJDIR) -lgcsi $(LDLIBS)

