#####################################################################
# 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
include ../lib_defs.mk

#####################################################################
LINCS	= -I. -I../../includes -I../include 
EXTRA_FLAGS += -m64 -mno-red-zone -mcmodel=kernel -pipe -Wno-sign-compare
CFLAGS	+= $(COMMON_CFLAGS) $(COMMON_DEFS) $(LINCS)
CFLAGS  += -O2 -fno-inline -Wall -Wstrict-prototypes 
CFLAGS	+= $(EXTRA_FLAGS)

LIBNAME = libchctl.x86_64.a
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)
