# Makefile
#  This builds a subset of libc mainly to add sprintf() and associated support.
#  Further more this version only prints out numbers in hex form.
#
#  990810 Daniel Potts, danielp@cse.unsw.edu.au


L4DIR = ../..
TOOLDIR = $(HOME)/local/bin-$(ARCH)

CC = gcc
HACKS = -D_MIPS_SZLONG=64
INCLUDE = -I$(L4DIR)/include/lib -I$(L4DIR)/include/lib/libc
AR = ar

CCFLAGS	= -nostdinc -nostdlib $(INCLUDE) -Wstrict-prototypes \
	  -O2 -fomit-frame-pointer -fno-strength-reduce -mno-fp-regs \
	  -freg-struct-return -DALPHAENV -D_MIPS_SZLONG=64 -Wall -mcpu=ev5 -DL4_EXTRA_TYPES #-D__VMS__


TARGET=libc.a
LIBCINSTALLDIR=..
OBJECTS=atob.o iscntrl.o isdigit.o islower.o isspace.o sprintf.o str_fmt.o\
        strcat.o\
        strchr.o strcpy.o strichr.o strlen.o strncpy.o strtoupp.o\
        toupper.o vsprintf.o


all:    $(TARGET) printf.o
	cp $(TARGET) $(LIBCINSTALLDIR)/
.c.o:
	$(CC) $(CCFLAGS) $(INCLUDE) $(HACKS) -c $<

libc.a: $(OBJECTS)
	$(AR) -vr $(TARGET) *.o

printf.o: printf.c
	$(CC) $(CCFLAGS) $(INCLUDE) $(HACKS) -c printf.c

clean:
	rm -f *.o $(TARGET) $(LIBCINSTALLDIR)/$(TARGET)

