ifdef HAVE_LIBMODBUS3

PI500_SRCS = hal/user_comps/pi500_vfd/pi500_vfd.c
PI500_CFLAGS = -DDEBUG $(LIBMODBUS_CFLAGS)
PI500_LIBS = $(LIBMODBUS_LIBS)

$(call TOOBJSDEPS, $(PI500_SRCS)) : EXTRAFLAGS += $(PI500_CFLAGS)

USERSRCS += $(PI500_SRCS)

../bin/pi500_vfd: $(call TOOBJS, $(PI500_SRCS)) ../lib/liblinuxcnchal.so.0
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(PI500_LIBS) 

hal/user_comps/pi500_vfd/pi500_vfd.c: hal/user_comps/pi500_vfd/pi500_vfd.comp ../bin/halcompile
	$(ECHO) "Preprocessing pi500_vfd.comp"
	$(Q)../bin/halcompile -U --preprocess $<

../docs/build/man/man1/pi500_vfd.1: hal/user_comps/pi500_vfd/pi500_vfd.comp ../bin/halcompile
	@mkdir -p $(dir $@) objects/man/man1
	$(Q)../bin/halcompile -U -u --document --keep-adoc=$@.adoc -o $@ $<
	$(Q)sed -i -e's/^\.als /.\\" .als /' $@
	$(Q)mv -f $@.adoc objects/man/man1/

clean: pi500_clean
pi500_clean:
	-rm -f hal/user_comps/pi500_vfd/pi500_vfd.c
	-rm -f hal/user_comps/pi500_vfd/pi500_vfd.1

TARGETS += ../bin/pi500_vfd
GENERATED_MANPAGES += ../docs/build/man/man1/pi500_vfd.1
endif

