From 1cf945909d1d5daa311dd0bb0119e041f2a329e0 Mon Sep 17 00:00:00 2001 From: Stefan Dorn Date: Wed, 9 Dec 2015 10:46:03 +0000 Subject: [PATCH] sipmlify base makefile --- makefile | 107 +++---------------------------------------------------- 1 file changed, 5 insertions(+), 102 deletions(-) diff --git a/makefile b/makefile index d9fe10c..158c10e 100644 --- a/makefile +++ b/makefile @@ -1,49 +1,6 @@ # ----------------------------------------------------------------------------- # makefile for the ergoDOX project -# -# This should produce a single file (probably in an archive format) for -# distribution, containing everything people will need to use the software. -# -# DEPENDENCIES: This is unabashedly dependant on (the GNU implementation of) -# various Unix commands, and therefore probably won't work in a Windows -# environment (besides maybe cygwin). Sorry... I don't know a good portable -# way to write it. -# -# TODO: -# - include doc files (and maybe render them in html) -# - include the UI stuff (once it's done) # ----------------------------------------------------------------------------- -# Copyright (c) 2012 Ben Blazak -# Released under The MIT License (MIT) (see "license.md") -# Project located at -# ----------------------------------------------------------------------------- - - -include src/makefile-options - -# which layouts to compile (will override the variable in src/makefile-options) -# --- default -LAYOUT := qwerty-kinesis-mod -# --- all -LAYOUTS := qwerty-kinesis-mod dvorak-kinesis-mod colemak-symbol-mod workman-p-kinesis-mod - -# system specific stuff -UNAME := $(shell uname) -ifeq ($(UNAME),Darwin) - DATE_PROG := gdate -else - DATE_PROG := date -endif - -CURRENT_DATE := $(shell $(DATE_PROG) --rfc-3339 s) - -# git info -GIT_BRANCH := $(shell git branch -l | grep '*' | cut -c 3-) -GIT_COMMIT_DATE := $(shell git log -n 1 --pretty --date=iso | grep 'Date' | cut -c 9- ) -GIT_COMMIT_ID := $(shell git log -n 1 | grep 'commit' | cut -c 8-) - -# name to use for the final distribution file or package -TARGET := ergodox-firmware--$(GIT_BRANCH)--$(shell $(DATE_PROG) -d "$(GIT_COMMIT_DATE)" +'%Y%m%dT%H%M%S')--$(shell echo $(GIT_COMMIT_ID) | cut -c 1-7)--$(LAYOUT) # directories BUILD := build @@ -53,66 +10,12 @@ SCRIPTS := build-scripts # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- -.PHONY: all clean checkin build-dir firmware dist zip zip-all +.PHONY: all clean firmware -all: dist +all: firmware clean: - git clean -dX # remove ignored files and directories - -rm -r '$(BUILD)' - -checkin: - -git commit -a - -build-dir: - -rm -r '$(BUILD)/$(TARGET)'* - -mkdir -p '$(BUILD)/$(TARGET)' - -firmware: - cd src; $(MAKE) LAYOUT=$(LAYOUT) all - -$(ROOT)/firmware.%: firmware - cp 'src/firmware.$*' '$@' - - -$(ROOT)/firmware--ui-info.json: $(SCRIPTS)/gen-ui-info.py checkin - ( ./'$<' \ - --current-date '$(shell $(DATE_PROG) --rfc-3339 s)' \ - --git-commit-date '$(GIT_COMMIT_DATE)' \ - --git-commit-id '$(GIT_COMMIT_ID)' \ - --map-file-path '$(BUILD)/$(TARGET)/firmware.map' \ - --source-code-path 'src' \ - --matrix-file-path 'src/keyboard/$(KEYBOARD)/matrix.h' \ - --layout-file-path \ - 'src/keyboard/$(KEYBOARD)/layout/$(LAYOUT).c' \ - ) > '$@' - -$(ROOT)/firmware--layout.html: \ - $(SCRIPTS)/gen-layout.py \ - $(ROOT)/firmware--ui-info.json - \ - ( ./'$<' \ - --ui-info-file '$(ROOT)/firmware--ui-info.json' \ - ) > '$@' - - -dist: \ - checkin \ - build-dir \ - $(ROOT)/firmware.hex \ - $(ROOT)/firmware.eep \ - $(ROOT)/firmware.map \ - $(ROOT)/firmware--ui-info.json \ - $(ROOT)/firmware--layout.html - -zip: dist - ( cd '$(BUILD)/$(TARGET)'; \ - zip '../$(TARGET).zip' \ - -r * .* \ - -x '..*' ) - -zip-all: - for layout in $(LAYOUTS); do \ - make LAYOUT=$$layout zip; \ - done + cd src; $(MAKE) clean +firmware: clean + cd src; $(MAKE) all