# Makefile.am.common					-*- Makefile -*-
# Generated file, do not edit!

modulebin_DATA = $(patsubst %.ycp,%.ybc,$(module_DATA))
modulebindir = $(moduledir)

ybcfiles = $(filter %.ybc,$(modulebin_DATA))

# suffix mapping: info '(make)Static Usage'
# apply only to our modules, not external ones
${ybcfiles}: %.ybc: %.ycp $(ycpchook)
	Y2DIR=$(YCPC_Y2DIR) LD_LIBRARY_PATH=$(YCPC_LD_LIBRARY_PATH) ${YCPC} -c -M. -I. -q $(YCPCFLAGS) $<

# files to clean
CLEANFILES = ${ybcfiles}
DISTCLEANFILES = .dep

# Needs to be outside "." because of cases
# where ycpchook contains a symlink to "."
# Otherwise "." keeps being newer than .dep and we loop.
NEWDEP=${top_builddir}/.dep.new
# generate dependencies
# two steps not to lose the file if the command fails
# hook: create the links before we look for files
.dep: $(wildcard *.ycp) ${ycpchook}
	${YCPMAKEDEP} --prefix=${prefix} ${YCPCFLAGS} > ${NEWDEP}
	cat ${NEWDEP} > .dep
	rm ${NEWDEP}

dist-hook: check-syntax

check-syntax: $(client_DATA) $(ycpchook)
	if test "$(client_DATA)"; then $(bindir)/ycpc -qE -M. -I. $(YCPCFLAGS) $(filter %.ycp,$^) || exit 1; fi

-include .dep