CC = gcc
CFLAGS = -MD -O2 -mcpu=pentium -march=i386 -Wall
AR = ar
RANLIB = ranlib

SRCS = ansi/locale/setlocal.c \
       ansi/string/strcoll.c \
       ansi/time/strftime.c \
       ansi/stdio/doprnt.c ansi/stdio/doscan.c \
       ansi/stdlib/strtod.c ansi/stdlib/strtold.c \
       posix/regex/regcomp.c posix/regex/regerror.c posix/regex/regexec.c \
       posix/regex/regfree.c

OBJS = $(addsuffix .o, $(basename $(SRCS)))

.PHONY: all clean

all: ../../../lib/liblocal.a

../../../lib/liblocal.a: $(OBJS)
	@echo - 'creating library' $@
	@$(AR) cru $@ $(OBJS)
	@$(RANLIB) $@

%.o : %.c
	@echo - $(CC) '...' -o $@ -c $<
	@$(CC) $(CFLAGS) -o $@ -c $<

clean:
	@rm .../*.o .../*.d

DEPS = $(wildcard .../*.d)
ifneq ($(DEPS),)
include $(DEPS)
endif
