summaryrefslogtreecommitdiff
path: root/Demo/PIC18_SDCC/Makefile
blob: 1c47309aea119b52657cf534f2c23647491533ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#########################################################################################
# GAYE Abdoulaye Walsimou, <walsimou@walsimou.com>
# Copyright(C) 2009 GAYE Abdoulaye Walsimou, <walsimou@walsimou.com>  All rights reserved.
#
# This program is free software; you can distribute it and/or modify it
# under the terms of the GNU General Public License
# (Version 2 or later) published by the Free Software Foundation.
#
# This program is distributed in the hope 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.
#########################################################################################
#
# \file         Makefile
# \brief	Makefile of PIC18/SDCC port
# \author       GAYE Abdoulaye Walsimou, <walsimou@walsimou.com>
# \date         February 2009
#########################################################################################

CC=sdcc
AS=gpasm
LD=gplink
DEVICE=18f452
ARCH=pic16
PIC16_LIB_PATH=/usr/src/walsimou/staging_dir/share/sdcc/lib/pic16/

# Setup paths to source code
SOURCE_PATH=../../Source
PORT_PATH=$(SOURCE_PATH)/portable/SDCC/PIC18
DEMO_PATH=$(PWD)

SDCC_CFLAGS=	-m$(ARCH) -p$(DEVICE) -I. -I$(SOURCE_PATH)/include -I$(PORT_PATH)		\
		-I$(SOURCE_PATH) -I$(DEMO_PATH) -DSDCC_PIC18 --debug --mplab-comp --pstack-model=large

GPASM_CFLAGS= -g -I$(SOURCE_PATH) -I$(PORT_PATH)
LDFLAGS= -s $(DEVICE).lkr --map -I$(PIC16_LIB_PATH)
LIBS= libdev$(DEVICE).lib crt0iz.o libc18f.lib libsdcc.lib libm18f.lib

#
# Source files
#

SOURCE_FILES= tasks.c list.c queue.c
SOURCE_OBJ=$(SOURCE_FILES:.c=.o)

PORT_FILES= port.c
PORT_OBJ=$(PORT_FILES:.c=.o)

VPATH=$(SOURCE_PATH):$(PORT_PATH):$(DEMO_PATH)

All: $(SOURCE_OBJ) $(PORT_OBJ)
	$(CC) -S main.c -o main.asm $(SDCC_CFLAGS)
	$(AS) -c main.asm -o main.o $(GPASM_CFLAGS)
	$(LD) -c -o freertos.hex $^ main.o $(LIBS) $(LDFLAGS)
main.o: main.c

$(SOURCE_OBJ) $(PORT_OBJ): %.o: %.asm
	$(AS) -c $< -o $@ $(GPASM_CFLAGS)

%.asm: %.c
	$(CC) -S $< -o $@ $(SDCC_CFLAGS)

clean:
	rm -rf *.o *.asm *.cod *.lst *.hex *.adb *.lib *.calltree *.p *.map *.cof *.coff

cleanAll: clean