aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Arduino.mk34
-rw-r--r--HISTORY.md1
-rw-r--r--arduino-mk-vars.md52
3 files changed, 87 insertions, 0 deletions
diff --git a/Arduino.mk b/Arduino.mk
index 77313c2..c83ad0d 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -1310,6 +1310,22 @@ $(OBJDIR)/%.sym: $(OBJDIR)/%.elf $(COMMON_DEPS)
$(NM) --size-sort --demangle --reverse-sort --line-numbers $< > $@
########################################################################
+# Ctags
+
+# Assume ctags is on path unless has been specified
+ifndef CTAGS_EXEC
+ CTAGS_EXEC = ctags
+endif
+
+# Default to 'tags' unless user has specified a tags file
+ifndef TAGS_FILE
+ TAGS_FILE = tags
+endif
+
+# ctags command: append, flags unsort (as will be sorted after) and specify filename
+CTAGS_CMD = $(CTAGS_EXEC) $(CTAGS_OPTS) -auf
+
+########################################################################
# Avrdude
# If avrdude is installed separately, it can find its own config file
@@ -1564,6 +1580,23 @@ generate_assembly: $(OBJDIR)/$(TARGET).s
generated_assembly: generate_assembly
@$(ECHO) "\"generated_assembly\" target is deprecated. Use \"generate_assembly\" target instead\n\n"
+.PHONY: tags
+tags:
+ifneq ($(words $(wildcard $(TAGS_FILE))), 0)
+ rm -f $(TAGS_FILE)
+endif
+ @$(ECHO) "Generating tags for local sources (INO an PDE files as C++): "
+ $(CTAGS_CMD) $(TAGS_FILE) --langmap=c++:.ino --langmap=c++:.pde $(LOCAL_SRCS)
+ifneq ($(words $(ARDUINO_LIBS)), 0)
+ @$(ECHO) "Generating tags for project libraries: "
+ $(CTAGS_CMD) $(TAGS_FILE) $(foreach lib, $(ARDUINO_LIBS),$(USER_LIB_PATH)/$(lib)/*)
+endif
+ @$(ECHO) "Generating tags for Arduino core: "
+ $(CTAGS_CMD) $(TAGS_FILE) $(ARDUINO_CORE_PATH)/*
+ @$(ECHO) "Sorting..\n"
+ @sort $(TAGS_FILE) -o $(TAGS_FILE)
+ @$(ECHO) "Tag file generation complete, output: $(TAGS_FILE)\n"
+
help_vars:
@$(CAT) $(ARDMK_DIR)/arduino-mk-vars.md
@@ -1595,6 +1628,7 @@ help:
generated assembly of the main sketch.\n\
make burn_bootloader - burn bootloader and fuses\n\
make set_fuses - set fuses without burning bootloader\n\
+ make tags - generate tags file including project libs and Arduino core\n\
make help_vars - print all variables that can be overridden\n\
make help - show this help\n\
"
diff --git a/HISTORY.md b/HISTORY.md
index 973edc1..ad5972f 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -10,6 +10,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Tweak: Set ARDMK_VERSION to 1.6 (https://github.com/sej7278)
- Tweak: Move non-standard-related items from CxxFLAGS_STD to CxxFLAGS (issue #523) (https://github.com/sej7278)
- New: Added -fdiagnostics-color to *STD flags (https://github.com/sej7278)
+- New: Add generation of tags file using ctags, which automatically includes project libs and Arduino core. (https://github.com/tuna-f1sh)
### 1.6.0 (2017-07-11)
- Fix: Allowed for SparkFun's weird usb pid/vid submenu shenanigans (issue #499). (https://github.com/sej7278)
diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md
index 0f93c89..d19d3d6 100644
--- a/arduino-mk-vars.md
+++ b/arduino-mk-vars.md
@@ -11,6 +11,7 @@ The following are the different variables that can be overwritten in the user ma
* [Avrdude setting variables](#avrdude-setting-variables)
* [Bootloader variables](#bootloader-variables)
* [ChipKIT variables](#chipkit-variables)
+* [Ctags variables](#ctags-variables)
## Global variables
@@ -1404,6 +1405,57 @@ MPIDE_DIR = $(HOME)/mpide
----
+## Ctags variables
+
+### TAGS_FILE
+
+**Description:**
+
+Output file name for tags. Defaults to 'tags'.
+
+**Example:**
+
+```Makefile
+TAGS_FILE = .tags
+```
+
+**Requirement:** *Optional*
+
+----
+
+### CTAGS_OPTS
+
+**Description:**
+
+Additional options to pass to `ctags` command.
+
+**Example:**
+
+```Makefile
+# Run ctags in verbose mode
+CTAGS_OPTS = -V
+```
+
+**Requirement:** *Optional*
+
+----
+
+### CTAGS_CMD
+
+**Description:**
+
+Location of `ctags` binary. Defaults to user path.
+
+**Example:**
+
+```Makefile
+CTAGS_CMD = /usr/local/bin/
+```
+
+**Requirement:** *Optional*
+
+----
+
### MPIDE_PREFERENCES_PATH
**Description:**