blob: cb86b947c9d2058c0902df6384d935988761f3ae [file] [log] [blame]
gpzbc285042003-05-19 09:13:37 +00001# Copyright (c) 2002, Adam Dunkels.
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7# 1. Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.
9# 2. Redistributions in binary form must reproduce the above copyright
10# notice, this list of conditions and the following disclaimer in the
11# documentation and/or other materials provided with the distribution.
12# 3. All advertising materials mentioning features or use of this software
13# must display the following acknowledgement:
14# This product includes software developed by Adam Dunkels.
15# 4. The name of the author may not be used to endorse or promote
16# products derived from this software without specific prior
17# written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30#
31# This file is part of the Contiki desktop environment
32#
oliverschmidtdcb85f52005-04-18 22:45:12 +000033# $Id: Makefile,v 1.2 2005/04/18 22:45:12 oliverschmidt Exp $
gpzbc285042003-05-19 09:13:37 +000034#
35
36CONTIKI=../contiki
37
oliverschmidtdcb85f52005-04-18 22:45:12 +000038include $(CONTIKI)/Makefile.common
39
gpzbc285042003-05-19 09:13:37 +000040# Change the target system type here
41SYS=gba
42
43# CC=/opt/ham/gcc-arm/bin/arm-elf-gcc
44# LD=/opt/ham/gcc-arm/bin/arm-elf-ld
45# OBJCOPY=/opt/ham/gcc-arm/bin/arm-elf-objcopy
46
47CC=/opt/devkitadv/bin/arm-agb-elf-gcc
48AS=/opt/devkitadv/bin/arm-agb-elf-as
49LD=/opt/devkitadv/bin/arm-agb-elf-ld
50OBJCOPY=/opt/devkitadv/bin/arm-agb-elf-objcopy
51
52CFLAGS=-I arch/gba -I ctk -I uip -I conf \
53 -I $(CONTIKI)/apps -I $(CONTIKI)/ctk -I $(CONTIKI)/ek \
54 -I $(CONTIKI)/lib -I $(CONTIKI)/uip \
55 -Wa,-I,arch -Wa,-I,arch/gba \
56 -D__GBA__ -DCTK_CONIO -DWITH_UIP \
57 -DWITH_TELNET \
58 -DWITH_EMAIL \
59 -DWITH_CALC -D WITH_CALC_ICON
60
61 #-DWITH_WWW
62
63OPT=-O3
64
65CINC=-Iarch/gba -Ictk -Iuip -Iconf \
66 -I$(CONTIKI)/apps -I$(CONTIKI)/ctk -I$(CONTIKI)/ek \
67 -I$(CONTIKI)/lib -I$(CONTIKI)/uip \
68 -D__GBA__
69
70splint:
71 @splint $(CINC) +ansi89limits +continuecomment +controlnestdepth 15 \
72 +evalorder +evalorderuncon +exitarg +fcnderef +fcnmacros +fcnuse \
73 +hints +forcehints +formatconst -gnuextensions +immediatetrans \
74 +includenest 8 +incondefs +incondefslib +infloops +infloopsuncon \
75 +internalnamelookalike \
76 +iso99limits +isolib +isoreserved +isoreservedinternal \
77 +libmacros +macroassign +macroempty \
78 ./contiki-main.c \
79 \
80 strncasecmp.c \
81 petsciiconv.c \
82 ./../contiki/apps/contiki.c \
83 programs.c \
84 ctk-conio.c \
85 ctk.c \
86 ek.c \
87 dispatcher.c \
88 program-handler.c \
89 \
90 ./arch/gba/conio.c \
91 ./arch/gba/joystick.c \
92 ./arch/none/joytokbd.c \
93 ./arch/gba/vsprintf.c \
94 ./arch/gba/ltostr.c \
95 ./arch/gba/_sbrk.c \
96 ./arch/gba/_oserror.c \
97 ./arch/gba/_exit.c \
98 ./arch/gba/_kill.c \
99 ./arch/gba/_getpid.c \
100 ./arch/gba/gba.c \
101 2>&1 | less
102
103%.o: %.c
104 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
105 @$(AS) -o $@ $(AFLAGS) $(*).s
106
107%.o: ctk/%.c
108 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
109 @$(AS) -o $@ $(AFLAGS) $(*).s
110
111%.o: uip/%.c
112 @$(CC) $(CFLAGS) -S -o $(patsubst %c, %s, $(notdir $<)) $<
113 @$(AS) -o $@ $(AFLAGS) $(*).s
114
115%.o: $(CONTIKI)/apps/%.c
116 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
117 @$(AS) -o $@ $(AFLAGS) $(*).s
118
119%.o: $(CONTIKI)/ctk/%.c
120 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
121 @$(AS) -o $@ $(AFLAGS) $(*).s
122
123%.o: $(CONTIKI)/ek/%.c
124 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
125 @$(AS) -o $@ $(AFLAGS) $(*).s
126
127%.o: $(CONTIKI)/lib/%.c
128 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
129 @$(AS) -o $@ $(AFLAGS) $(*).s
130
131%.o: $(CONTIKI)/uip/%.c
132 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
133 @$(AS) -o $@ $(AFLAGS) $(*).s
134
gpzbc285042003-05-19 09:13:37 +0000135all: contiki
136
137# about-dsc.o netconf-dsc.o processes-dsc.o \
138
139contiki: contiki-main.o strncasecmp.o petsciiconv.o \
140 contiki.o programs.o \
141 ctk-conio.o ctk.o ek.o dispatcher.o \
142 $(UIP) \
143 $(EMAIL) \
144 $(TELNET) \
145 program-handler.o
146
147 cd arch;bin2o .rodata gba/ascchar.raw gba/ascchar.o
148
149 @$(CC) $(CFLAGS) -O6 -c -I./gba -D__GBA__ \
150 ./arch/gba/crt0.s \
151 ./arch/gba/conio.c \
152 ./arch/gba/joystick.c \
153 ./arch/none/joytokbd.c \
154 ./arch/gba/vsprintf.c \
155 ./arch/gba/ltostr.c \
156 ./arch/gba/_sbrk.c \
157 ./arch/gba/_oserror.c \
158 ./arch/gba/_exit.c \
159 ./arch/gba/_kill.c \
160 ./arch/gba/_getpid.c \
161 ./arch/gba/gba.c
162
163 @$(LD) -nostdlib -o contiki.elf -T ./arch/gba/arm-gbabin.x \
164 crt0.o \
165 $^ \
166 ./arch/gba/ascchar.o \
167 gba.o \
168 conio.o \
169 joystick.o \
170 joytokbd.o \
171 vsprintf.o \
172 ltostr.o \
173 _sbrk.o \
174 _oserror.o \
175 _exit.o \
176 _kill.o \
177 _getpid.o \
178 /opt/devkitadv/lib/gcc-lib/arm-agb-elf/3.0.2/libgcc.a \
179 -lc -lg -lm -lstdc++
180
181 @$(OBJCOPY) -v -O binary contiki.elf contiki.gba 1> /dev/null 2> /dev/null
182
183run:
184 @VisualBoyAdvance -T 500000 -f 0 -1 -s 9 --ifb-none contiki.gba
185
186clean:
187 rm -f *.o *~ *core contiki.gba contiki.elf *.s