#
#	Makefile for a small porting library, (w) 1994, Kay Roemer.
#

CC = gcc
AR = ar

CPPFLAGS = -I. -DMINT -DLOGIN
CFLAGS = -O2 -fomit-frame-pointer

ifdef BASEREL
LIB := bportlib.olb
CFLAGS := $(CFLAGS) -mbaserel -mpcrel
else
LIB := portlib.olb
endif

all: $(LIB)

SRCS = mint.c sigvec.c daemon.c pty.c login_tty.c setenv.c syslog.c \
  initgrp.c chroot.c readv.c writev.c getusershell.c cfsetspeed.c \
  logout.c logwtmp.c strsep.c fcrypt.c ident.c timeofday.c gethostid.c \
  rtent.c iflink.c getdomainname.c snprintf.c utimes.c

OBJS = $(patsubst %.c, %.o, $(SRCS))

portlib.olb: clean $(patsubst %.o, portlib.olb(%.o), $(OBJS))
	$(AR) s $@

bportlib.olb: clean $(patsubst %.o, bportlib.olb(%.o), $(OBJS))
	$(AR) s $@

(%): %
	$(AR) r $@ $%
	rm $%

clean:
	rm -f $(OBJS)

tarit:
	( cd ..; \
	  tar czf portlib-`cut -f2 -d\" portlib/version.h`.tgz portlib; )

#
# Dependencies
#

$(LIB)(ident.o): version.h
