Jump to content

makefile: compilar apenas arquivos alterados


maurosmartins

Recommended Posts

Boa tarde a todos, 

estive a tentar fazer um makefile para poder compilar e carregar SW para um microcontrolador STM8. Apesar de estar a funcionar compila sempre todos os arquivos e não apenas os alterados, gostaria de perguntar se podiam ajudar a ter o comportamento esperado.

Aqui está o conteúdo do makefile:

PROJ_NAME=workingproject
MICRO=STM8L15xC8
PROGRAMMER=STVP_CmdLine

# Compiler
CC=cxstm8
 
# Flags for compiler
CFLAGS=+mods0 -pp -dSTM8L15X_HD -iinc -isrc -i"C:\Program Files (x86)\COSMIC\FSE_Compilers\Hstm8"  -clRelease\ -coRelease\
 
# .c files
C_SOURCE=$(wildcard *.c)
C_SOURCE+=$(wildcard src/*.c)

# .h files
H_SOURCE=$(wildcard *.h)
H_SOURCE+=$(wildcard inc/*.h)
# Object files
objects=$(C_SOURCE:c=o)

%.o : %.c
	$(CC) $(CFLAGS) $?

#target : prerequisites
#<TAB>recipe

#all : $(PROJ_NAME).sm8

$(PROJ_NAME).sm8 : $(objects)
	clnk -l"C:\Program Files (x86)\COSMIC\FSE_Compilers\Lib"  -o Release\$(PROJ_NAME).sm8 Release\eso.lkf
	chex -o Release\$(PROJ_NAME).s19 Release\$(PROJ_NAME).sm8
	
.PHONY : load
load:
	STVP_CmdLine -BoardName=ST-LINK -Port=USB -ProgMode=SWIM -Device=$(MICRO) -no_log -no_loop -no_warn_protect -verif -FileProg=Release\$(PROJ_NAME).s19

desde já obrigado, Mauro.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.