#
# Declare the sub-directories to be built here
#

SUBDIRS = \
	$(EOLIST)

#
# Get the 'head' of the build environment.  This includes default targets and
# paths to tools
#

include $(APR_WORK)/build/NWGNUhead.inc

#
# build this level's files

#
# Make sure all needed macro's are defined
#

#
# These directories will be at the beginning of the include list, followed by
# INCDIRS
#
XINCDIRS += \
	$(APR)/include \
	$(APR)/include/private \
	$(APR)/include/arch/netware \
	$(APR)/include/arch/unix \
	$(APRBUILD) \
	$(EOLIST)

FILES_prebuild_headers = \
	$(APR)/include/apr.h \
	$(APR)/include/apu_want.h \
	$(APR)/include/private/apu_select_dbm.h \
	$(APR)/include/private/apr_escape_test_char.h \
	$(EOLIST)

nlms :: $(APR)/aprlib.imp

$(APR)/aprlib.imp : make_nw_export.awk nw_export.i
	@echo $(DL)GEN  $@$(DL)
	$(AWK) -v EXPPREFIX=APR$(VERSION_MAJMIN) -f $^ >$@

nw_export.i : nw_export.h $(FILES_prebuild_headers) $(CCOPT_DEPENDS)
	@echo $(DL)GEN  $@$(DL)
	$(CPRE) $(CCFLAGS) -DGENEXPORTS $< -o $@

%.h: %.hnw
	@echo Creating $@
	$(call COPY,$<,$@)

%.h: %.hw
	@echo Creating $@
	$(call COPY,$<,$@)

$(APR)/include/private/apr_escape_test_char.h: gen_test_char.exe $(APR)/tools/gen_test_char.c
	@echo $(DL)GEN  $@$(DL)
	$< > $@

%.exe: $(APR)/tools/%.c
	@echo $(DL)Creating Build Helper $@$(DL)
	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DCROSS_COMPILE $< -o $@

#
# You can use this target if all that is needed is to copy files to the
# installation area
#
install :: nlms FORCE


clean ::
	$(call DEL,nw_export.i)
	$(call DEL,cc.opt)
	$(call DEL,NWGNUversion.inc)
	$(call DEL,$(APR)/aprlib.imp)
	$(foreach file,$(FILES_prebuild_headers),$(call DEL,$(file)))
	$(call DEL,gen_test_char.exe)

#
# Include the 'tail' makefile that has targets that depend on variables defined
# in this makefile
#

include $(APRBUILD)/NWGNUtail.inc


