##// END OF EJS Templates
First init
First init

File last commit:

r0:7d185b578514 default
r0:7d185b578514 default
Show More
rules.mk
65 lines | 2.3 KiB | text/x-makefile | MakefileLexer
#/*------------------------------------------------------------------------------
#-- This file is a part of the libuc, microcontroler library
#-- Copyright (C) 2011, Alexis Jeandet
#--
#-- This program is free software; you can redistribute it and/or modify
#-- it under the terms of the GNU General Public License as published by
#-- the Free Software Foundation; either version 3 of the License, or
#-- (at your option) any later version.
#--
#-- This program is distributed in the hope that it will be useful,
#-- but WITHOUT ANY WARRANTY; without even the implied warranty of
#-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#-- GNU General Public License for more details.
#--
#-- You should have received a copy of the GNU General Public License
#-- along with this program; if not, write to the Free Software
#-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#-------------------------------------------------------------------------------
#-- Author : Alexis Jeandet
#-- Mail : alexis.jeandet@gmail.com
#-------------------------------------------------------------------------------*/
all:
@echo "calling rules.mk"
bindirs:
mkdir -p $(OUTBINDIR)
mkdir -p $(TEMPDIR)
libdirs:
mkdir -p tmp
mkdir -p $(INCPATH)
mkdir -p $(LIBDIR)
$(NAME).elf: bindirs $(FILE).o $(STARTUP).o
$(CC) -O3 -nostartfiles -T $(LDSCRIPT) -o $(OUTBINDIR)$(NAME).elf $(TEMPDIR)$(FILE).o $(TEMPDIR)$(STARTUP).o -I$(LPCINCPATH) -I$(BSPINCPATH) -I$(INCPATH) -L $(LIBDIR) -L $(BSPLIBDIR) -static $(LIBS) -lbsp $(FLAGS)
$(FILE).o:
$(CC) -I$(LPCINCPATH) -I$(BSPINCPATH) -I$(INCPATH) -c $(FILE).c -o tmp/$(FILE).o $(FLAGS)
$(STARTUP).o: $(STARTUP)
$(CC) -O3 -c -o $(TEMPDIR)$(STARTUP).o $(STARTUP) $(FLAGS)
run: $(NAME).hex
$(FLASHER) -hex -term $(OUTBINDIR)$(NAME).hex $(PORT) $(SPEED) $(OSC)
$(NAME).hex: $(OUTBINDIR)$(NAME).elf
$(OBJCOPY) -O ihex $(OUTBINDIR)$(NAME).elf $(OUTBINDIR)$(NAME).hex
$(FILE).a: libdirs $(FILE).o
$(AR) rs $(LIBDIR)$(LIB) tmp/$(FILE).o
cp *.h $(INCPATH)
rm -R tmp
@echo "library "$(LIB)" created"
$(READELF) -a $(LIBDIR)$(LIB)
bspclean:
rm -R -f $(LIBUCROOT)lib/BSP/bin/$(BOARD)
libclean:
rm -f $(LIBDIR)$(LIB)
rm -f $(INCPATH)$(FILE).h