#SHELL += -x
#####################################################################
# Assumptions are basically that all the .c files in the CWD are modules
# for the library and that all .h files are the interface to the library.
#####################################################################
LIBDIR = ../../lib/ulib

include ../Rules.make

#####################################################################
LINCS := -I. -I../../includes -I../include
LINCS += -I$(CROSS_UINC)

EXTRA_FLAGS += -pipe -Wno-sign-compare
# ppc
#EXTRA_FLAGS += -mpowerpc -mcpu=440
EXTRA_FLAGS += -mpowerpc

CFLAGS	+= $(COMMON_CFLAGS) $(COMMON_DEFS) $(LINCS)
#CFLAGS  += -O2 -fno-inline -Wall -Wstrict-prototypes 
CFLAGS	+= $(EXTRA_FLAGS)

# library name
LIBNAME = libchctl.ppc64.a

# object files
LIBOBJ	=  $(patsubst %.c,%.o,$(wildcard *.c ))

all: $(LIBNAME) postmake

$(LIBNAME): $(LIBOBJ)
#	strip $(ULIB_KEEP_SYMBOLS) $^
	$(AR) rcs $@ $^

postmake:
	@echo "copy $(LIBNAME) to $(LIBDIR)"
	@mkdir -p ../../lib/ulib
	@cp -f $(LIBNAME) $(LIBDIR)

clean:
	$(RM) $(LIBNAME) *.o
	$(RM) $(LIBDIR)/$(LIBNAME)
