(more makefile modifications)
parent
5260e7104d
commit
973cac3240
|
@ -1,2 +0,0 @@
|
||||||
*.zip
|
|
||||||
|
|
40
makefile
40
makefile
|
@ -4,9 +4,9 @@
|
||||||
# This should produce a single file (probably in an archive format) for
|
# This should produce a single file (probably in an archive format) for
|
||||||
# distribution, containing everything people will need to use the software.
|
# distribution, containing everything people will need to use the software.
|
||||||
#
|
#
|
||||||
# AVAILABILITY: This is unabashedly dependant on various Unix commands, and
|
# DEPENDENCIES: This is unabashedly dependant on various Unix commands, and
|
||||||
# therefore probably won't work in a Windows environment. I'm sorry. I don't
|
# therefore probably won't work in a Windows environment. I'm sorry... I
|
||||||
# know a good portable way to write it.
|
# don't know a good portable way to write it.
|
||||||
#
|
#
|
||||||
# TODO:
|
# TODO:
|
||||||
# - include doc files (and maybe render them in html)
|
# - include doc files (and maybe render them in html)
|
||||||
|
@ -23,10 +23,13 @@ NAME := ergodox-firmware
|
||||||
# the branch of the git repo we're currently on
|
# the branch of the git repo we're currently on
|
||||||
BRANCH := $(shell git branch -l | grep '*' | cut -c 3-)
|
BRANCH := $(shell git branch -l | grep '*' | cut -c 3-)
|
||||||
# a version identifier
|
# a version identifier
|
||||||
VERSION := $(shell date +'%Y%m%d_%H%M%S')
|
VERSION := $(shell git log -n 1 | grep 'commit' | cut -c 8-14)--$(shell date +'%Y%m%dT%H%M%S')
|
||||||
|
|
||||||
# name to use for the final distribution file or package
|
# name to use for the final distribution file or package
|
||||||
TARGET = $(NAME)--$(BRANCH)--$(VERSION)
|
TARGET := $(NAME)--$(BRANCH)--$(VERSION)
|
||||||
|
|
||||||
|
# the build dir
|
||||||
|
BUILD := build
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
@ -37,17 +40,22 @@ all: dist
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
git clean -dX # remove ignored files and directories
|
git clean -dX # remove ignored files and directories
|
||||||
|
-rm -r '$(BUILD)'
|
||||||
|
|
||||||
dist: src contrib/UI
|
dist:
|
||||||
|
# set up the build dir
|
||||||
# -----------------------------------------------------------------------------
|
-rm -r '$(BUILD)/$(TARGET)'*
|
||||||
|
-mkdir -p '$(BUILD)/$(TARGET)'
|
||||||
.PHONY: src contrib/UI
|
# make all subprojects
|
||||||
|
|
||||||
src:
|
|
||||||
cd src; $(MAKE) all
|
cd src; $(MAKE) all
|
||||||
zip '$(TARGET)' src/*.hex src/*.elf src/*.map
|
# copy stuff to build dir
|
||||||
|
# --- from src
|
||||||
contrib/UI:
|
( cd src; \
|
||||||
# nothing yet
|
cp firmware.hex firmware.eep firmware.map \
|
||||||
|
'../$(BUILD)/$(TARGET)' )
|
||||||
|
# make into a zip archive
|
||||||
|
( cd '$(BUILD)/$(TARGET)'; \
|
||||||
|
zip '../$(TARGET).zip' \
|
||||||
|
-r * .* \
|
||||||
|
-x '..*' )
|
||||||
|
|
||||||
|
|
32
src/makefile
32
src/makefile
|
@ -13,18 +13,18 @@
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
TARGET = firmware # the name we want for our program binary
|
TARGET := firmware # the name we want for our program binary
|
||||||
FORMAT = ihex # the program binary's format
|
FORMAT := ihex # the program binary's format
|
||||||
KEYBOARD = ergodox # keyboard model; see "src/keyboard" for what's available
|
KEYBOARD := ergodox # keyboard model; see "src/keyboard" for what's available
|
||||||
LAYOUT = qwerty # keyboard layout; see "src/keyboard/*/layout" for what's
|
LAYOUT := qwerty # keyboard layout; see "src/keyboard/*/layout" for what's
|
||||||
# available
|
# available
|
||||||
|
|
||||||
MCU = atmega32u4 # processor type (for teensy 2.0); must match real life
|
MCU := atmega32u4 # processor type (for teensy 2.0); must match real life
|
||||||
BOARD = teensy-2-0 # see the libraries you're using for what's available
|
BOARD := teensy-2-0 # see the libraries you're using for what's available
|
||||||
F_CPU = 16000000 # processor speed, in Hz
|
F_CPU := 16000000 # processor speed, in Hz
|
||||||
|
|
||||||
# firmware stuff
|
# firmware stuff
|
||||||
SRC = $(wildcard *.c)
|
SRC := $(wildcard *.c)
|
||||||
# keyboard and layout stuff
|
# keyboard and layout stuff
|
||||||
# --- remove whitespace from vars
|
# --- remove whitespace from vars
|
||||||
KEYBOARD := $(strip $(KEYBOARD))
|
KEYBOARD := $(strip $(KEYBOARD))
|
||||||
|
@ -48,7 +48,7 @@ SRC += $(wildcard lib-other/*/*/*.c)
|
||||||
OBJ = $(SRC:%.c=%.o)
|
OBJ = $(SRC:%.c=%.o)
|
||||||
|
|
||||||
|
|
||||||
CFLAGS = -mmcu=$(MCU) # processor type (teensy 2.0); must match real
|
CFLAGS := -mmcu=$(MCU) # processor type (teensy 2.0); must match real
|
||||||
# life
|
# life
|
||||||
CFLAGS += -DF_CPU=$(F_CPU) # processor frequency; must match initialization
|
CFLAGS += -DF_CPU=$(F_CPU) # processor frequency; must match initialization
|
||||||
# in source
|
# in source
|
||||||
|
@ -76,7 +76,7 @@ CFLAGS += -fdata-sections # / section in the output file if the
|
||||||
# unused code.
|
# unused code.
|
||||||
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||||
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||||
LDFLAGS = -Wl,-Map=$(strip $(TARGET)).map,--cref # generate a link map, with
|
LDFLAGS := -Wl,-Map=$(strip $(TARGET)).map,--cref # generate a link map, with
|
||||||
# a cross reference table
|
# a cross reference table
|
||||||
LDFLAGS += -Wl,--relax # for some linker optimizations
|
LDFLAGS += -Wl,--relax # for some linker optimizations
|
||||||
LDFLAGS += -Wl,--gc-sections # discard unused functions and data
|
LDFLAGS += -Wl,--gc-sections # discard unused functions and data
|
||||||
|
@ -85,14 +85,14 @@ LDFLAGS += -Wl,--gc-sections # discard unused functions and data
|
||||||
GENDEPFLAGS += -MMD -MP -MF $@.dep # generate dependency files
|
GENDEPFLAGS += -MMD -MP -MF $@.dep # generate dependency files
|
||||||
|
|
||||||
|
|
||||||
CC = avr-gcc
|
CC := avr-gcc
|
||||||
OBJCOPY = avr-objcopy
|
OBJCOPY := avr-objcopy
|
||||||
SIZE = avr-size
|
SIZE := avr-size
|
||||||
|
|
||||||
|
|
||||||
# remove whitespace from some of the variables
|
# remove whitespace from some of the variables
|
||||||
TARGET := $(strip $(TARGET))
|
TARGET := $(strip $(TARGET))
|
||||||
FORMAT := $(strip $(FORMAT))
|
FORMAT := $(strip $(FORMAT))
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue