makefile 2.33 KB
Newer Older
1 2
#
#             LUFA Library
Dean Camera's avatar
Dean Camera committed
3
#     Copyright (C) Dean Camera, 2013.
4 5 6 7 8 9 10 11
#
#  dean [at] fourwalledcubicle [dot] com
#           www.lufa-lib.org
#
# ---------------------------------------
#  Makefile for the LUFA Atmel Studio Integration.
# ---------------------------------------

12
LUFA_ROOT            := ..
13 14 15 16 17 18
DOXYGEN_TAG_FILE_XML := $(LUFA_ROOT)/Documentation/lufa_doc_tags.xml
TEMP_MANIFEST_XML    := manifest.xml
EXTENSION_OUTPUT_XML := $(LUFA_ROOT)/../extension.xml
MODULE_OUTPUT_XML    := $(LUFA_ROOT)/asf.xml
XML_FILES            := $(filter-out $(TEMP_MANIFEST_FILE), $(shell ls *.xml))
LUFA_VERSION_NUM     := $(shell grep LUFA_VERSION_STRING $(LUFA_ROOT)/Version.h | cut -d'"' -f2)
19
EXT_VERSION_NUM      := $(shell date +"%y.%m.%d").$(LUFA_VERSION_NUM)
20

21
all: check_filenames generate_xml generate_vsix
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

clean:
	@rm $(TEMP_MANIFEST_XML) $(MODULE_OUTPUT_XML) $(EXTENSION_OUTPUT_XML)

$(DOXYGEN_TAG_FILE_XML):
	make -C ../ doxygen

$(TEMP_MANIFEST_XML): $(DOXYGEN_TAG_FILE_XML)
	@echo "Generating Manifest XML..."

	@printf "<lufa-manifest version=\"%s\" tagfile=\"%s\">\n" $(LUFA_VERSION_NUM) $(DOXYGEN_TAG_FILE_XML) > $@
	@for i in $(XML_FILES); do \
		printf "\t<xml-source filename=\"%s\"/>\n" $$i >> $@; \
	done;
	@echo '</lufa-manifest>' >> $@

	@echo "Manifest XML file generated."

generate_xml: $(TEMP_MANIFEST_XML)
	@echo "Processing asf.xml file..."
42
	@xsltproc XSLT/lufa_module_transform.xslt $< | xsltproc XSLT/lufa_indent_transform.xslt - > $(MODULE_OUTPUT_XML)
43 44 45
	@echo "Atmel Studio asf.xml file generated."

	@echo "Processing extension.xml file..."
46
	@xsltproc XSLT/lufa_extension_transform.xslt $< | xsltproc XSLT/lufa_indent_transform.xslt - > $(EXTENSION_OUTPUT_XML)
47 48
	@echo "Atmel Studio extension.xml file generated."

49
generate_vsix: $(EXTENSION_OUTPUT_XML) $(MODULE_OUTPUT_XML)
50 51
	cp "VSIX/[Content_Types].xml" $(LUFA_ROOT)/../
	xsltproc --stringparam extension-version $(EXT_VERSION_NUM) XSLT/lufa_vsmanifest_transform.xslt VSIX/extension.vsixmanifest > $(LUFA_ROOT)/../extension.vsixmanifest
52 53
	cd $(LUFA_ROOT)/../; zip LUFA_AS_Extension.vsix -r --exclude=*StudioIntegration* *

54 55
check_filenames: $(TEMP_MANIFEST_XML)
	@for i in `xsltproc XSLT/lufa_filelist_transform.xslt $< | grep -v "^<" | sed -e "/^$$/d"`; do \
56 57 58 59 60 61
		if ( ! test -f "$(LUFA_ROOT)/$$i" ); then \
			echo "Source file $$i does not exist!"; \
		fi; \
	done;

.PHONY: all clean check_filenames generate_xml