Skip to content

Instantly share code, notes, and snippets.

@bbenno
Created August 26, 2020 13:01
Show Gist options
  • Save bbenno/fd433ff958abf0bb48cdbf8610c6d939 to your computer and use it in GitHub Desktop.
Save bbenno/fd433ff958abf0bb48cdbf8610c6d939 to your computer and use it in GitHub Desktop.
Makefile for IAR Embedded Workbench Projects using `iarbuild`
PROJ_NAME=<...>
PROJ_FILE=$(PROJ_NAME).ewp
IAR_FLAGS = -log info
IAR_FLAGS += -parallel 4
CONFIG=*
# Brings the current build configuration up to date by compiling, assembling,
# and linking only the files that have changed since the last build.
build: $(PROJ_FILE)
iarbuild $< -make $(CONFIG) $(IAR_FLAGS)
#Rebuilds and relinks all files in the current build configuration.
rebuild: $(PROJ_FILE)
iarbuild $< -build $(CONFIG) $(IAR_FLAGS)
# Analyzes the project using C-STAT and generates information about the number
# of messages.
# For more information, see the C-STAT Static Analysis Guide.
analyze: $(PROJ_FILE)
iarbuild $< -cstat_analyze $(CONFIG) $(IAR_FLAGS)
# Removes any intermediate and output files
# Cleans the C-STAT message database for the project.
# For more information, see the C-STAT Static Analysis Guide.
clean: $(PROJ_FILE)
iarbuild $< -clean $(CONFIG) $(IAR_FLAGS)
iarbuild $< -cstat_clean $(CONFIG) $(IAR_FLAGS)
.PHONY: build rebuild analyze clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment