examples/AppliSlave_HCS12/Makefile.in
changeset 93 16c8ceea8f18
parent 92 0d84d95790d9
child 94 bdf4c86be6b2
equal deleted inserted replaced
92:0d84d95790d9 93:16c8ceea8f18
     1 #! gmake
       
     2 
       
     3 #
       
     4 # Copyright (C) 2006 Laurent Bessard
       
     5 # 
       
     6 # This file is part of canfestival, a library implementing the canopen
       
     7 # stack
       
     8 # 
       
     9 # This library is free software; you can redistribute it and/or
       
    10 # modify it under the terms of the GNU Lesser General Public
       
    11 # License as published by the Free Software Foundation; either
       
    12 # version 2.1 of the License, or (at your option) any later version.
       
    13 # 
       
    14 # This library is distributed in the hope that it will be useful,
       
    15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    17 # Lesser General Public License for more details.
       
    18 # 
       
    19 # You should have received a copy of the GNU Lesser General Public
       
    20 # License along with this library; if not, write to the Free Software
       
    21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    22 # 
       
    23 
       
    24 CC = SUB_CC
       
    25 OPT_CFLAGS = -Os
       
    26 CFLAGS = SUB_OPT_CFLAGS
       
    27 PROG_CFLAGS = SUB_PROG_CFLAGS
       
    28 OS_NAME = SUB_OS_NAME
       
    29 ARCH_NAME = SUB_ARCH_NAME
       
    30 PREFIX = SUB_PREFIX
       
    31 BINUTILS_PREFIX = SUB_BINUTILS_PREFIX
       
    32 TARGET = SUB_TARGET
       
    33 
       
    34 INCLUDES = -I../../include -I../../include/hcs12
       
    35 MEMORY_X = ../../include/hcs12/board/arch
       
    36 
       
    37 OBJCOPY = $(BINUTILS_PREFIX)objcopy
       
    38 OBJCOPY_FLAGS = --only-section=.text --only-section=.rodata --only-section=.vectors --only-section=.data
       
    39 
       
    40 PROGDEFINES = -mnoshort -Wall -Wmissing-prototypes -fno-strict-aliasing -g
       
    41 
       
    42 PGR=AppliSlave
       
    43 
       
    44 SLAVE_OBJS = objdict.o appli.o vectors.o
       
    45 
       
    46 OBJS = ../../src/hc12_pdo.o ../../src/hc12_sdo.o ../../src/hc12_init.o ../../src/hc12_sync.o\
       
    47        ../../src/hc12_objacces.o ../../src/hc12_lifegrd.o ../../src/hc12_timer.o ../../src/hc12_nmtSlave.o\
       
    48        ../../drivers/hc12/canOpenDriver.o ../../drivers/hc12/ports.o ../../drivers/hc12/interrupt.o\
       
    49        ../../drivers/hc12/timerhw.o ../../drivers/hc12/variahw.o $(SLAVE_OBJS)
       
    50 
       
    51 LDFLAGS= -Wl,-m,m68hc12elfb  -L$(MEMORY_X)
       
    52 
       
    53 all: $(PGR).elf $(PGR).s19 $(PGR).b $(PGR).s MSG
       
    54 
       
    55 %o: %c
       
    56 	$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -c -o $@ $<
       
    57 
       
    58 %o: %s
       
    59 	$(CC)  -c -x assembler-with-cpp $(PROG_CFLAGS) -o  $@ $<
       
    60 
       
    61 $(PGR).elf: $(OBJS)
       
    62 	$(CC) $(CFLAGS) $(LDFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS)
       
    63 
       
    64 $(PGR).s19: $(PGR).elf
       
    65 	$(OBJCOPY) --output-target=srec $(OBJCOPY_FLAGS) $< $@
       
    66 
       
    67 $(PGR).b: $(PGR).elf
       
    68 	$(OBJCOPY) --output-target=binary --gap-fill=255 --only-section=.data $(OBJCOPY_FLAGS) $< $@
       
    69 
       
    70 $(PGR).s: $(PGR).elf
       
    71 	@echo "Desassemble"
       
    72 	$(BINUTILS_PREFIX)objdump -D $(PGR).elf > $(PGR).s
       
    73 
       
    74 MSG:
       
    75 	$(BINUTILS_PREFIX)readelf -S $(PGR).elf
       
    76 	@echo
       
    77 	$(BINUTILS_PREFIX)size $(PGR).elf
       
    78 
       
    79 clean:
       
    80 	rm -f $(SLAVE_OBJS)
       
    81 
       
    82 mrproper: clean
       
    83 	rm -f $(PGR).elf $(PGR).s19 $(PGR).b $(PGR).s
       
    84