Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/coding style #439

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
40 changes: 36 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Copyright 2014, 2015, Mariano Cerdeiro
# Copyright 2014, 2015, 2016, Juan Cecconi (Numetron, UTN-FRBA)
# Copyright 2014, 2015, Esteban Volentini (LabMicro, UNT)
# Copyright 2014, 2015, 2016, Esteban Volentini (LabMicro, UNT)
# All rights reserved
#
# This file is part of CIAA Firmware.
Expand Down Expand Up @@ -210,6 +210,15 @@ endif
endif
endif

###############################################################################
# Code sanity chech and fix in every compilation
ifeq ($(CODE_SANITY),FIX)
CHECK_AND_FIX_CODE += fix_code_sanity
else
ifeq ($(CODE_SANITY),CHECK)
CHECK_AND_FIX_CODE += code_sanity
endif
endif
###############################################################################
# get root dir
ROOT_DIR := .
Expand Down Expand Up @@ -425,12 +434,35 @@ mocks:
ruby externals$(DS)ceedling$(DS)vendor$(DS)cmock$(DS)lib$(DS)cmock.rb -omodules$(DS)tools$(DS)ceedling$(DS)project.yml $(FILES_TO_MOCK)

###############################################################################
# rule to check trailing spaces
# rule to check code sanity
code_sanity:
@echo ' '
@echo ===============================================================================
@echo Checking for carriage return
@./modules/tools/scripts/check_crlf.sh
@echo ' '
@echo ===============================================================================
@echo Checking for trailing spaces
@./modules/tools/scripts/check_trailing_spaces.sh
@echo ' '
@echo ===============================================================================
@echo Checking for code identation
@./modules/tools/scripts/check_indentation.sh

fix_code_sanity:
@echo ' '
@echo ===============================================================================
@echo Fixing carriage return errors
@./modules/tools/scripts/fix_crlf.sh
@echo ' '
@echo ===============================================================================
@echo Fixing trailing spaces errors
@./modules/tools/scripts/fix_trailing_spaces.sh
@echo ' '
@echo ===============================================================================
@echo Checking for code identation
@./modules/tools/scripts/check_indentation.sh

###############################################################################
# rule to run osek oil generator tests
osek_oil_gen_tst:
Expand Down Expand Up @@ -530,7 +562,7 @@ $(foreach LIB, $(LIBS), $(eval -include $(addprefix $(OBJ_DIR)$(DS),$(OBJ_FILES:
# libs with contains sources
LIBS_WITH_SRC = $(foreach LIB, $(LIBS), $(if $(filter %.c,$($(LIB)_SRC_FILES)),$(LIB)))

$(PROJECT_NAME) : $(rtos_GENERATED_FILES) $(LIBS_WITH_SRC) $(OBJ_FILES)
$(PROJECT_NAME): $(CHECK_AND_FIX_CODE) $(rtos_GENERATED_FILES) $(LIBS_WITH_SRC) $(OBJ_FILES)
@echo ' '
@echo ===============================================================================
@echo Linking file: $(LD_TARGET)
Expand Down Expand Up @@ -860,7 +892,7 @@ info:

###############################################################################
# clean
.PHONY: clean generate all run multicore
.PHONY: clean generate all run multicore code_sanity fix_code_sanity
clean:
@echo Removing libraries
@rm -rf $(LIB_DIR)$(DS)*
Expand Down
11 changes: 11 additions & 0 deletions Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# CADIEEL: http://www.cadieel.org.ar
# Copyright 2015, Mariano Cerdeiro
# Copyright 2015, Juan Cecconi (Numetron, UTN-FRBA)
# Copyright 2016, Esteban Volentini (LabMicro UNT)
# All rights reserved.
#
# This file is part of CIAA Firmware.
Expand Down Expand Up @@ -72,6 +73,7 @@
#CPU ?= none
#COMPILER ?= gcc
BOARD ?= ciaa_sim_ia32

###############################################################################
# rtostests options
#
Expand All @@ -81,6 +83,15 @@ BOARD ?= ciaa_sim_ia32
# RTOSTESTS_SUBTEST = 'full-preemptive' #, sub test case name, based on ctestcases.cfg or empty to start running from this test to the end
# RTOSTESTS_RAM_EXEC = 1 # Run all the test in RAM saving Flash cycles.

###############################################################################
# Code sanity check/fix in every compilation
#
# Remove the comment from the following line to enable verification of code guidelines at each compilation.
# Change parameter value CHECK to FIX to enable automatic fix of code to compile with guidelines.
#
#CODE_SANITY ?= CHECK

###############################################################################
# Projects
#
# Available projects are:
Expand Down
Loading