]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Merge pull request #600 from adiabatic/master
authorErez Zukerman <bulk@ezuk.org>
Tue, 2 Aug 2016 12:01:56 +0000 (08:01 -0400)
committerGitHub <noreply@github.com>
Tue, 2 Aug 2016 12:01:56 +0000 (08:01 -0400)
zweihander-osx: add left-hand-thumb tab key

14 files changed:
.gitignore
.travis.yml
Makefile
doc/basic_how_keyboards_work.md [new file with mode: 0644]
keyboards/ergodox/keymaps/algernon/keymap.c
keyboards/ergodox/keymaps/default/keymap.c
keyboards/ergodox/keymaps/josh/keymap.c
keyboards/ergodox/readme.md
keyboards/planck/keymaps/cbbrowne/keymap.c
keyboards/planck/keymaps/experimental/keymap.c
readme.md
tmk_core/rules.mk
util/ergodox_ez.html [new file with mode: 0644]
util/travis_compiled_push.sh

index 8491433524d9c7c8b1f0878995c8fc7fb2616bfc..8c85d6ffa8882c607fa4f91ba048e74ef466e8e3 100644 (file)
@@ -17,6 +17,7 @@ build/
 .build/
 *.bak
 .vagrant/
+quantum/version.h
 .idea/
 CMakeLists.txt
 .DS_STORE
@@ -26,4 +27,4 @@ CMakeLists.txt
 .project
 .settings/
 .idea
-.browse.VC.db*
\ No newline at end of file
+.browse.VC.db*
index 26deac0cebcf86e64a5d8fcff27a5b7ef0a28d7d..297cf19a686925e67f68f66da6feccf04a8b5ad7 100644 (file)
@@ -10,7 +10,7 @@ env:
   global:
   - secure: vBTSL34BDPxDilKUuTXqU4CJ26Pv5hogD2nghatkxSQkI1/jbdnLj/DQdPUrMJFDIY6TK3AltsBx72MaMsLQ1JO/Ou24IeHINHXzUC1FlS9yQa48cpxnhX5kzXNyGs3oa0qaFbvnr7RgYRWtmD52n4bIZuSuW+xpBv05x2OCizdT2ZonH33nATaHGFasxROm4qYZ241VfzcUv766V6RVHgL4x9V08warugs+RENVkfzxxwhk3NmkrISabze0gSVJLHBPHxroZC6EUcf/ocobcuDrCwFqtEt90i7pNIAFUE7gZsN2uE75LmpzAWin21G7lLPcPL2k4FJVd8an1HiP2WmscJU6U89fOfMb2viObnKcCzebozBCmKGtHEuXZo9FcReOx49AnQSpmESJGs+q2dL/FApkTjQiyT4J6O5dJpoww0/r57Wx0cmmqjETKBb5rSgXM51Etk3wO09mvcPHsEwrT7qH8r9XWdyCDoEn7FCLX3/LYnf/D4SmZ633YPl5gv3v9XEwxR5+04akjgnvWDSNIaDbWBdxHNb7l4pMc+WR1bwCyMyA7KXj0RrftEGOrm9ZRLe6BkbT4cycA+j77nbPOMcyZChliV9pPQos+4TOJoTzcK2L8yWVoY409aDNVuAjdP6Yum0R2maBGl/etLmIMpJC35C5/lZ+dUNjJAM=
 script:
-- make all-keyboards-quick AUTOGEN=true
+- make all-keyboards AUTOGEN=true
 addons:
   apt:
     packages:
index 980ab26b2203bd4a2982a56a25c8226ec0016b84..053c8532af1387bf751e32867f738700c2f1ba6b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,8 +5,9 @@ endif
 .DEFAULT_GOAL := all
 
 space := $(subst ,, )
-starting_makefile := $(subst $(space),_SPACE_,$(abspath $(firstword $(MAKEFILE_LIST))))
-mkfile_path := $(subst $(space),_SPACE_,$(abspath $(lastword $(MAKEFILE_LIST))))
+ESCAPED_ABS_PATH = $(subst $(space),_SPACE_,$(abspath $1))
+starting_makefile := $(call ESCAPED_ABS_PATH,$(firstword $(MAKEFILE_LIST)))
+mkfile_path := $(call ESCAPED_ABS_PATH,$(lastword $(MAKEFILE_LIST))))
 abs_tmk_root := $(patsubst %/,%,$(dir $(mkfile_path)))
 
 ifneq (,$(findstring /keyboards/,$(starting_makefile)))
@@ -83,10 +84,8 @@ endif
 
 ifneq ("$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)","")
        KEYBOARD_FILE = keyboards/$(KEYBOARD)/$(KEYBOARD).c
-       ifndef ARCH
-               ifneq ("$(wildcard $(KEYBOARD_PATH)/Makefile)","")
-                       include $(KEYBOARD_PATH)/Makefile
-               endif
+       ifneq ($(call ESCAPED_ABS_PATH,$(KEYBOARD_PATH)/Makefile),$(starting_makefile))
+               -include $(KEYBOARD_PATH)/Makefile
        endif
 else 
 $(error "$(KEYBOARD_PATH)/$(KEYBOARD).c" does not exist)
@@ -101,7 +100,9 @@ ifdef SUBPROJECT
        ifneq ("$(wildcard $(SUBPROJECT_PATH)/$(SUBPROJECT).c)","")
                OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT)
                SUBPROJECT_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/$(SUBPROJECT).c
-               -include $(SUBPROJECT_PATH)/Makefile
+               ifneq ($(call ESCAPED_ABS_PATH,$(SUBPROJECT_PATH)/Makefile),$(starting_makefile))
+                       -include $(SUBPROJECT_PATH)/Makefile
+               endif
        else 
 $(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist)
        endif
@@ -119,14 +120,18 @@ endif
 KEYMAP_PATH = $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
 ifneq ("$(wildcard $(KEYMAP_PATH)/keymap.c)","")
        KEYMAP_FILE = keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/keymap.c
-       -include $(KEYMAP_PATH)/Makefile
+       ifneq ($(call ESCAPED_ABS_PATH,$(KEYMAP_PATH)/Makefile),$(starting_makefile))
+               -include $(KEYMAP_PATH)/Makefile
+       endif
 else 
        ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/keymap.c)","")
 $(error "$(KEYMAP_PATH)/keymap.c" does not exist)
        else
                KEYMAP_PATH = $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)
                KEYMAP_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/keymap.c
-               -include $(KEYMAP_PATH)/Makefile
+               ifneq ($(call ESCAPED_ABS_PATH,$(KEYMAP_PATH)/Makefile),$(starting_makefile))
+                       -include $(KEYMAP_PATH)/Makefile
+               endif
        endif
 endif
 
@@ -135,7 +140,8 @@ ifdef SUBPROJECT
 else
        TARGET ?= $(KEYBOARD)_$(KEYMAP)
 endif
-BUILD_DIR = .build
+
+BUILD_DIR = $(TOP_DIR)/.build
 
 # Object files directory
 #     To put object files in current directory, use a dot (.), do NOT make
@@ -265,4 +271,6 @@ include $(TMK_PATH)/rules.mk
 GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
 BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
 OPT_DEFS += -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"
-OPT_DEFS += -DQMK_VERSION=\"$(GIT_VERSION)\" -DQMK_BUILDDATE=\"$(BUILD_DATE)\"
+
+$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(QUANTUM_PATH)/version.h)
+$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(QUANTUM_PATH)/version.h)
\ No newline at end of file
diff --git a/doc/basic_how_keyboards_work.md b/doc/basic_how_keyboards_work.md
new file mode 100644 (file)
index 0000000..73c3f5c
--- /dev/null
@@ -0,0 +1,96 @@
+# How keys are registered, and interpreted by computers
+
+In this file, you can will learn the concepts of how keyboards work over USB,
+and you'll be able to better understand what you can expect from changing your
+firmware directly.
+
+## Schematic view
+
+Whenever you type on 1 particular key, here is the chain of actions taking
+place:
+
+``` text
++------+         +-----+       +----------+      +----------+     +----+
+| User |-------->| Key |------>| Firmware |----->| USB wire |---->| OS |
++------+         +-----+       +----------+      +----------+     |----+
+```
+
+This scheme is a very simple view of what's going on, and more details follow
+in the next sections.
+
+## 1. You Press a Key
+
+Whenever you press a key, the firmware of your keyboard can register this event.
+It can register when the key is pressed, held and released.
+
+This usually happens with a [periodic scan of key presses with a frequency around 100 hz](https://github.com/benblazak/ergodox-firmware/blob/master/references.md#typical-keyboard-information).
+This speed often is limited by the mechanical key response time, the protocol
+to transfer those key presses (here USB HID), and by the software it is used in.
+
+## 2. What the Firmware Sends
+
+The [HID specification](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)
+tells what a keyboard can actually send through USB to have a chance to be
+properly recognised. This includes a pre-defined list of keycodes which are
+simple numbers from `0x00` to `0xE7`. The firmware assigns a keycode to each
+key of the keyboard.
+
+The firmware does not send actually letters or characters, but only keycodes.
+Thus, by modifying the firmware, you only can modify what keycode is sent over
+USB for a given key.
+
+## 3. What the Operating System Does
+
+Once the keycode reaches the operating system, a piece of software has to have
+it match an actual character thanks to a keyboard layout. For example, if your
+layout is set to QWERTY, a sample of the matching table is as follow:
+
+``` text
+| keycode | character |
+|---------+-----------|
+|    0x04 | a/A       |
+|    0x05 | b/B       |
+|    0x06 | c/C       |
+|     ... | ...       |
+|    0x1C | y/Y       |
+|    0x1D | z/Z       |
+|     ... | ...       |
+|---------+-----------|
+```
+
+## Back to the firmware
+
+As the layout is generally fixed (unless you create your own), the firmware can
+actually call a keycode by its layout name directly to ease things for you.
+
+This is exactly what is done here with `KC_A` actually representing `0x04` in
+QWERTY. The full list can be found in `keycode.txt`.
+
+## List of Characters You Can Send
+
+Putting aside shortcuts, having a limited set of keycodes mapped to a limited
+layout means that **the list of characters you can assign to a given key only
+is the ones present in the layout**.
+
+For example, this means that if you have a QWERTY US layout, and you want to
+assign 1 key to produce `€` (euro currency symbol), you are unable to do so,
+because the QWERTY US layout does not have such mapping. You could fix that by
+using a QWERTY UK layout, or a QWERTY US International.
+
+You may wonder why a keyboard layout containing all of Unicode is not devised
+then? The limited number of keycode available through USB simply disallow such
+a thing.
+
+## How to (Maybe) Enter Unicode Characters
+
+You can have the firmware send *sequences of keys* to use the [software Unicode
+Input
+Method](https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input) of
+the target operating system, thus effectively entering characters independently
+of the layout defined in the OS.
+
+Yet, it does come with multiple disadvantages:
+
+ - Tied to a specific OS a a time (need recompilation when changing OS);
+ - Within a given OS, does not work in all software;
+ - Limited to a subset of Unicode on some systems.
index 6a14ef467629543fa7ad97a2ccf6026e853b76e7..c4de53da27c14cc9172e87951696830cfeaea62e 100644 (file)
@@ -12,6 +12,7 @@
 #include "keymap_plover.h"\r
 #include "eeconfig.h"\r
 #include "wait.h"\r
+#include "version.h"
 \r
 /* Layers */\r
 \r
index f1a83f4e792c019966fed99d54f9e11842c396de..1b80cb3a236f628f99ef05a2ae4f7ad5066d9aeb 100644 (file)
@@ -1,6 +1,7 @@
 #include "ergodox.h"
 #include "debug.h"
 #include "action_layer.h"
+#include "version.h"
 
 #define BASE 0 // default layer
 #define SYMB 1 // symbols
index 488b21427363014564179fda1a467eca434347a0..b5463873a90d2dc785bdb581ee1b5e33df86a192 100644 (file)
@@ -1,6 +1,7 @@
 #include "ergodox.h"
 #include "debug.h"
 #include "action_layer.h"
+#include "version.h"
 
 #define BASE 0 // default layer
 #define SYMB 1 // symbols
index 9afa4741084fc9ace7d9f120d08337e6d510973e..f81d7cd8df1338eec5a877eb457a5a2ca8da3b22 100644 (file)
@@ -2,24 +2,21 @@
 
 There are two main ways you could customize the ErgoDox (EZ and Infinity)
 
-## The Easy Way: Use an existing firmware file and just flash it
-
-This does not work for Infinity ErgoDox yet, you need to compile the firmware according to the instructions below
+## The Easy Way: Use an existing firmware file and just flash it (ErgoDox EZ only)
 
 1. Download and install the [Teensy Loader](https://www.pjrc.com/teensy/loader.html). Some Linux distributions already provide a binary (may be called `teensy-loader-cli`), so you may prefer to use this.
-2. Find a firmware file you like. You can find a few of these in the keymaps subdirectory right here. The file you need ends with .hex, and you can look at its .c counterpart (or its PNG image) to see what you'll be getting. You can also use the [Massdrop configurator](https://keyboard-configurator.massdrop.com/ext/ergodox) to create a firmware Hex file you like.
+2. Find a firmware file you like. There are [dozens of community-contributed keymaps](http://qmk.fm/keyboards/ergodox/) you can browse and download. You can also use the [Massdrop configurator](https://keyboard-configurator.massdrop.com/ext/ergodox) to create a firmware Hex file you like.
 3. Download the firmware file
 4. Connect the keyboard, press its Reset button (gently insert a paperclip into the hole in the top-right corner) and flash it using the Teensy loader you installed on step 1 and the firmware you downloaded.
 
 ## More technical: compile an existing keymap, or create your own totally custom firmware by editing the source files.
 
-This requires a little bit of familiarity with coding. 
+This requires a little bit of familiarity with coding.
 If you are just compiling an existing keymap and don't want to create your own, you can skip step 4, 5 and 8.
 
 1. Go to https://github.com/jackhumbert/qmk_firmware and read the readme at the base of this repository, top to bottom. Then come back here :)
 2. Clone the repository (download it)
-3. Set up a build environment as per [the build guide](/doc/BUILD_GUIDE.md) 
-    - Using a Mac and have homebrew? just run `brew tap osx-cross/avr && brew install avr-libc`
+3. Set up a build environment as per the readme.
 4. Copy `keyboards/ergodox/keymaps/default/keymap.c` into `keymaps/your_name/keymap.c` (for example, `keymaps/german/keymap.c`)
 5. Edit this file, changing keycodes to your liking (see "Finding the keycodes you need" below). Try to edit the comments as well, so the "text graphics" represent your layout correctly. See below for more tips on sharing your work.
 6. Compile your firmware by running `make keymap=keymap_name`. For example, `make keymap=german`. This will result in a hex file, which will be called `ergodox_ez_keymap_name.hex`, e.g. `ergodox_ez_german.hex`. For **Infinity ErgoDox** you need to add `subproject=infinity` to the make command.
@@ -32,12 +29,12 @@ Good luck! :)
 
 ## Contributing your keymap
 
-The ErgoDox firmware is open-source, so it would be wonderful to have your contribution! Within a very short time after launching we already amassed almost 20 user-contributed keymaps, with all sorts of creative improvements and tweaks. This is very valuable for people who aren't comfortable coding, but do want to customize their ErgoDox. To make it easy for these people to use your layout, I recommend submitting your PR in the following format. 
+The QMK firmware is open-source, so it would be wonderful to have your contribution! Within a very short time after launching we already amassed dozens of user-contributed keymaps, with all sorts of creative improvements and tweaks. This is very valuable for people who aren't comfortable coding, but do want to customize their ErgoDox. To make it easy for these people to use your layout, I recommend submitting your PR in the following format.
 
 1. All work goes inside your keymap subdirectory (`keymaps/german` in this example).
 2. `keymap.c` - this is your actual keymap file; please update the ASCII comments in the file so they correspond with what you did.
 3. `readme.md` - a readme file, which GitHub would display by default when people go to your directory. Explain what's different about your keymap, what you tweaked or how it works. No specific format to follow, just communicate what you did. :)
-4. Any graphics you wish to add. This is absolutely not a must. If you feel like it, you can use [Keyboard Layout Editor](http://keyboard-layout-editor.com) to make something and grab a screenshot, but it's really not a must. If you do have graphics, your readme can just embed the graphic as a link, just like I did with the default layout. 
+4. Any graphics you wish to add. This is absolutely not a must. If you feel like it, you can use [Keyboard Layout Editor](http://keyboard-layout-editor.com) to make something and grab a screenshot, but it's really not a must. If you do have graphics, your readme can just embed the graphic as a link, just like I did with the default layout.
 
 
 ## Finding the keycodes you need
index 14a5be1708263432a0ff4caa0aac4acef1cdafd1..70eaefb7beacc446bf341605da644e2345e3cd6c 100644 (file)
@@ -4,6 +4,7 @@
 #endif
 #include "config.h"
 #include "quantum.h"
+#include "version.h"
 
 /* Each layer is given a name to aid in readability, which is then
    used in the keymap matrix below.  The underscores do not denote 
index d9303fcae5940bf37e450aaafa89401ca5e1145c..2c12700944ca9251bfd6a877f1102151c95a889d 100644 (file)
@@ -8,6 +8,7 @@
 #endif
 
 #include "eeconfig.h"
+#include "version.h"
 
 extern keymap_config_t keymap_config;
 
index c3d866f36babeafc3c0ac6ccca5a3faef9c0fbd2..57629f8be20c6ab26d95c7f6ab6ff76f2d044adc 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -122,17 +122,16 @@ Below are some definitions that will be useful:
 
 Below is a list of the useful `make` commands in QMK:
 
-* `make` - cleans automatically and builds your keyboard and keymap depending on which folder you're in. This defaults to the "default" layout (unless in a keymap folder), and Planck keyboard in the root folder
+* `make` - builds your keyboard and keymap depending on which folder you're in. This defaults to the "default" layout (unless in a keymap folder), and Planck keyboard in the root folder
   * `make keyboard=<keyboard>` - specifies the keyboard (only to be used in root)
   * `make keymap=<keymap>` - specifies the keymap (only to be used in root and keyboard folder - not needed when in keymap folder)
-* `make quick` - skips the clean step (cannot be used immediately after modifying config.h or Makefiles)
+* `make clean` - cleans the `.build` folder, ensuring that everything is re-built
 * `make dfu` - (requires dfu-programmer) builds and flashes the keymap to your keyboard once placed in reset/dfu mode (button or press `KC_RESET`). This does not work for Teensy-based keyboards like the ErgoDox EZ.
   * `keyboard=` and `keymap=` are compatible with this
 * `make all-keyboards` - builds all keymaps for all keyboards and outputs status of each (use in root)
 * `make all-keyboards-default` - builds all default keymaps for all keyboards and outputs status of each (use in root)
 * `make all-keymaps [keyboard=<keyboard>]` - builds all of the keymaps for whatever keyboard folder you're in, or specified by `<keyboard>`
-* `make all-keyboards-quick`, `make all-keyboards-default-quick` and `make all-keymaps-quick [keyboard=<keyboard>]` - like the normal "make-all-*" commands, but they skip the clean steps
-
+* `make all-keyboards-*`, `make all-keyboards-default-*` and `make all-keymaps-* [keyboard=<keyboard>]` - like the normal "make-all-*" commands, but the last string aftter the `-` (for example clean) is passed to the keyboard make command.
 Other, less useful functionality:
 
 * `make COLOR=false` - turns off color output
index c81fa685415ebac6652b92e428822cd0e21381a3..d2350f27c12c8f2619ba9ff3fd44bf3e9cd421bc 100644 (file)
 # Carlos Lamas
 #
 
+# Enable vpath seraching for source files only
+# Without this, output files, could be read from the wrong .build directories
+VPATH_SRC := $(VPATH)
+vpath %.c $(VPATH_SRC)
+vpath %.h $(VPATH_SRC)
+vpath %.cpp $(VPATH_SRC)
+vpath %.hpp $(VPATH_SRC)
+vpath %.S $(VPATH_SRC)
+VPATH :=
+
 
 # Output format. (can be srec, ihex, binary)
 FORMAT = ihex
@@ -35,11 +45,6 @@ ifeq ($(COLOR),true)
        BOLD=\033[1m
 endif
 
-ifdef quick
-       QUICK = $(quick)
-endif
-
-QUICK ?= false
 AUTOGEN ?= false
 
 ifneq ($(shell awk --version 2>/dev/null),)
@@ -71,7 +76,7 @@ BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [
 #     Each directory must be seperated by a space.
 #     Use forward slashes for directory separators.
 #     For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS += $(subst :, ,$(VPATH))
+EXTRAINCDIRS += $(subst :, ,$(VPATH_SRC))
 
 
 # Compiler flag to set the C Standard level.
@@ -268,22 +273,21 @@ LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst
 
 # Compiler flags to generate dependency files.
 #GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
-GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$(subst $(BUILD_DIR)/,,$@)).d
+GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
 
 
 # Combine all necessary flags and optional flags.
 # Add target processor to flags.
 # You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
-ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
-ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
+ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
+ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(EXTRAFLAGS)
 ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
 
+MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
+
 # Default target.
 all: build sizeafter
 
-# Quick make that doesn't clean
-quick: build sizeafter
-
 # Change the build target to build a HEX file or a library.
 build: elf hex
 #build: elf hex eep lss sym
@@ -373,35 +377,62 @@ BEGIN = gccversion check_submodule sizebefore
 # Link: create ELF output file from object files.
 .SECONDARY : $(BUILD_DIR)/$(TARGET).elf
 .PRECIOUS : $(OBJ)
-%.elf: $(OBJ) | $(BEGIN)
+# Note the obj.txt depeendency is there to force linking if a source file is deleted
+%.elf: $(OBJ) $(OBJDIR)/cflags.txt $(OBJDIR)/ldflags.txt $(OBJDIR)/obj.txt | $(BEGIN)
        @$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
-       $(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
+       $(eval CMD=$(CC) $(ALL_CFLAGS) $(filter-out %.txt,$^) --output $@ $(LDFLAGS))
        @$(BUILD_CMD)
 
 define GEN_OBJRULE
 # Compile: create object files from C source files.
-$1/%.o : %.c | $(BEGIN)
+$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
        @mkdir -p $$(@D)
        @$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
-       $$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$< -o $$@)
+       $$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
        @$$(BUILD_CMD)
 
 # Compile: create object files from C++ source files.
-$1/%.o : %.cpp | $(BEGIN)
+$1/%.o : %.cpp $1/%.d $1/cppflags.txt $1/compiler.txt | $(BEGIN)
        @mkdir -p $$(@D)
        @$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD)
-       $$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$< -o $$@)
+       $$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
        @$(BUILD_CMD)
 
 # Assemble: create object files from assembler source files.
-$1/%.o : %.S | $(BEGIN)
+$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
        @mkdir -p $$(@D)
        @$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
        $$(eval CMD=$$(CC) -c $$(ALL_ASFLAGS) $$< -o $$@)
        @$$(BUILD_CMD)
 
+$1/force:
+
+$1/cflags.txt: $1/force
+       echo '$$(ALL_CFLAGS)' | cmp -s - $$@ || echo '$$(ALL_CFLAGS)' > $$@
+
+$1/cppflags.txt: $1/force
+       echo '$$(ALL_CPPFLAGS)' | cmp -s - $$@ || echo '$$(ALL_CPPFLAGS)' > $$@
+
+$1/asflags.txt: $1/force
+       echo '$$(ALL_ASFLAGS)' | cmp -s - $$@ || echo '$$(ALL_ASFLAGS)' > $$@
+
+$1/ldflags.txt: $1/force
+       echo '$$(LDFLAGS)' | cmp -s - $$@ || echo '$$(LDFLAGS)' > $$@
+
+$1/obj.txt: $1/force
+       echo '$$(OBJ)' | cmp -s - $$@ || echo '$$(OBJ)' > $$@
+
+$1/compiler.txt: $1/force
+       $$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
 endef
 
+# We have to use static rules for the .d files for some reason
+DEPS = $(patsubst %.o,%.d,$(OBJ))
+# Keep the .d files
+.PRECIOUS: $(DEPS)
+# Empty rule to force recompilation if the .d file is missing
+$(DEPS):
+
 # Since the object files could be in two different folders, generate
 # separate rules for them, rather than having too generic rules
 $(eval $(call GEN_OBJRULE,$(OBJDIR)))
@@ -424,7 +455,10 @@ $(eval $(call GEN_OBJRULE,$(KBOBJDIR)))
        $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
 
 # Target: clean project.
-clean: 
+clean:
+       $(REMOVE) -r $(OBJDIR) 2>/dev/null
+       $(REMOVE) -r $(KBOBJDIR) 2>/dev/null
+       $(REMOVE) $(BUILD_DIR)/$(TARGET).*
 
 show_path:
        @echo VPATH=$(VPATH)
@@ -444,7 +478,6 @@ all-keyboards-defaults: all-keyboards-defaults-all
 
 KEYBOARDS := $(SUBDIRS:$(TOP_DIR)/keyboards/%/=/keyboards/%)
 all-keyboards-all: $(addsuffix -all,$(KEYBOARDS))
-all-keyboards-quick: $(addsuffix -quick,$(KEYBOARDS))
 all-keyboards-clean: $(addsuffix -clean,$(KEYBOARDS))
 all-keyboards: all-keyboards-all
 
@@ -461,12 +494,10 @@ done
 endef
 
 define make_keyboard_helper
-# Just remove the -quick, -all and so on from the first argument and pass it forward
+# Just remove the -all and so on from the first argument and pass it forward
 $(call make_keyboard,$(subst -$2,,$1),$2)
 endef
 
-/keyboards/%-quick:
-       $(call make_keyboard_helper,$@,quick)
 /keyboards/%-all:
        $(call make_keyboard_helper,$@,all)
 /keyboards/%-clean:
@@ -484,19 +515,6 @@ all-keymaps-%:
 
 all-keymaps: all-keymaps-all
 
-GOAL=$(MAKECMDGOALS)
-ifeq ($(MAKECMDGOALS),)
-GOAL = all
-endif
-CLEANING_GOALS=clean clean_list all
-ifneq ($(findstring $(GOAL),$(CLEANING_GOALS)),)
-$(shell $(REMOVE) -r $(BUILD_DIR) 2>/dev/null)
-$(shell $(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR))
-$(shell $(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR))
-$(shell if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi)
-$(shell $(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR))
-endif
-
 # Create build directory
 $(shell mkdir $(BUILD_DIR) 2>/dev/null)
 
@@ -505,11 +523,11 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
 $(shell mkdir $(KBOBJDIR) 2>/dev/null)
 
 # Include the dependency files.
--include $(shell mkdir $(BUILD_DIR)/.dep 2>/dev/null) $(wildcard $(BUILD_DIR)/.dep/*)
+-include $(patsubst %.o,%.d,$(OBJ))
 
 
 # Listing of phony targets.
-.PHONY : all quick finish sizebefore sizeafter gccversion \
+.PHONY : all finish sizebefore sizeafter gccversion \
 build elf hex eep lss sym coff extcoff check_submodule \
 clean clean_list debug gdb-config show_path \
 program teensy dfu flip dfu-ee flip-ee dfu-start \
diff --git a/util/ergodox_ez.html b/util/ergodox_ez.html
new file mode 100644 (file)
index 0000000..8e92866
--- /dev/null
@@ -0,0 +1 @@
+<html><head><meta http-equiv="refresh" content="0; url=http://qmk.fm/keyboards/ergodox/" /></head></html>
\ No newline at end of file
index 01317f4be2d980a069afcec5911fb947b92f68f1..27ab3cec66aa23c09579a8786180fa2e376e9598 100644 (file)
@@ -15,6 +15,8 @@ git submodule update --init --recursive
 rm -rf keyboard
 rm -rf keyboards
 cp -r ../qmk_firmware/keyboards .
+mkdir keyboards/ergodox_ez/
+cp ../qmk_firmware/util/ergodox_ez.html keyboards/ergodox_ez/index.html
 cp ../qmk_firmware/readme.md qmk_readme.md
 ./generate.sh