# -*- makefile -*- 
#
# builds a C library, installs three public include files
#
# Required macros:
#  TARGET = libraryname  (no leading lib or trailing .so or whatever)
# VERSION = version number major.minor
#   API_0 = public include file
#   API_1 = public include file
#   API_2 = public include file
# HEADERS = private include files
# SOURCES = list of C source files in this library
#  CFLAGS = extra compiler flags
#  EXTRAS = other files that make distclean should not nuke

!include $(CONFIG)\make\initial
!include $(CONFIG)\make\lib

API_X = $(INCLUDE_DIR)\$(API_0) $(INCLUDE_DIR)\$(API_1) \
        $(INCLUDE_DIR)\$(API_2)

install-includes: $(INCLUDE_DIR) $(API_X)

$(INCLUDE_DIR)\$(API_0): $(source)\$(API_0)
	$(CP) $(source)\$(API_0) $(INCLUDE_DIR)
	$(TOUCH) $@

$(INCLUDE_DIR)\$(API_1): $(source)\$(API_1)
	$(CP) $(source)\$(API_1) $(INCLUDE_DIR)
	$(TOUCH) $@

$(INCLUDE_DIR)\$(API_2): $(source)\$(API_2)
	$(CP) $(source)\$(API_2) $(INCLUDE_DIR)
	$(TOUCH) $@

uninstall-includes:
	-$(RM) $(API_X)

$(source)\cntrs.c: $(source)\$(API_0) $(source)\$(API_1) $(source)\$(API_2)
	$(TCLSH) $(CSLU_BIN_DIR)\parse $(source)\$(API_0) $(source)\$(API_1) \
	$(source)\$(API_2)

!include $(CONFIG)\make\final
