Hello mspgcc-users,
I'm searching makefile example for mspgcc.
Will anybody share it to me?
I just find a makefile example, but it's to build lib file.
Will anybody modify it to build project and emulation?
Below is contents of makefile:
#put the name of the target mcu here, for example: msp430x149
MCU =
#put your C sourcefiles here
SRC =
#put additional assembler source file here
ASRC =
#additional includes to compile
INC =
#compiler flags
CPFLAGS = -std=gnu99 -g -O -Wall -Wstrict-prototypes
#----------------------------------------------------------------------------------
# MSPGCC standard Makefile part 3
#
---------------------------------------------------------------------------------
###### BLOCK 1) define some variables based on the MSP base path in $(MSP)
#######
CC = msp430-gcc
AS = msp430-gcc -x assembler-with-cpp
AR = msp430-ar
RM = rm -f
RN = mv
OUT = coff
CP = cp
BIN = msp430-objcopy
SIZE = msp430-size
INCDIR = .
OBJDIR = obj
TRGDIR = lib
LIBDIR = $(MSP)/msp430/lib
SHELL = sh.exe
###### BLOCK 3) define all project specific object files ######
OBJ = $(ASRC:.s=.o) $(SRC:.c=.o)
CPFLAGS += -mmcu=$(MCU)
ASFLAGS += -mmcu=$(MCU)
###### BLOCK 5) compile: instructions to create assembler and/or object files
from C source ######
%.o: %.c
$(CC) -c $(CPFLAGS) -Wa,-ahlms=$(addprefix $(OBJDIR)/,$(<:.c=.lst))
-I$(INCDIR) $< -o $(OBJDIR)/$@
%.s : %.c
$(CC) -S $(CPFLAGS) -I$(INCDIR) $< -o $(OBJDIR)/$@
###### BLOCK 6) assemble: instructions to create object file from assembler
files ######
%.o : %.s
$(AS) -c $(ASFLAGS) -I$(INCDIR) $< -o $(OBJDIR)/$@
###### BLOCK 7) arch: instructions to create library output file from object
files ######
OS.a : $(OBJ)
${AR} -rcsv $(TRGDIR)/$@ $(addprefix $(OBJDIR)/,$(OBJ))
$(SIZE) $(TRGDIR)/$@
###### BLOCK 8) make instruction to delete created files ######
clean:
$(RM) $(addprefix $(OBJDIR)/,$(OBJ))
$(RM) $(TRGDIR)/OS.a
@echo "Errors: none"
--
Best regards,
lyming mailto:[email protected]