jw-pkg/make/yapp.mk

28 lines
861 B
Makefile
Raw Normal View History

SRC_ALL_CPP += main.cpp
YAPP_INCLUDE_DIR ?= .
YAPP_CLASS ?= $(firstword $(basename $(notdir $(wildcard $(addprefix \
$(YAPP_INCLUDE_DIR)/, YApp*.h App*.h Y*.h *.h)))))
YAPP_CLASS_H ?= $(firstword $(wildcard $(addsuffix /$(YAPP_CLASS).h,\
$(YAPP_INCLUDE_DIR) $(subst -I,,$(FINAL_INCLUDE)))) $(YAPP_CLASS).h)
YAPP_NAMESPACE ?=
ifneq ($(TARGET),mingw)
FINAL_LDFLAGS += -rdynamic
endif
include $(JWBDIR)/make/exe.mk
all: build_EXE
install: install_EXE
clean: clean.yapp
distclean:
clean.yapp:
$(RM) -f main.cpp
main.cpp: $(YAPP_CLASS_H)
echo "#include \"$<\"" > $@.tmp
if [ "$(YAPP_NAMESPACE)" ]; then echo "using namespace $(YAPP_NAMESPACE);" >> $@.tmp; fi
echo "#include <ytools/YAppRunner.h>" >> $@.tmp
echo "yapp_main($(YAPP_CLASS))" >> $@.tmp
mv $@.tmp $@