blob: f5dde64175743727cc9e7e692497ef585f4241d3 [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#
33# $Id: Makefile,v 1.1 2003/05/19 09:13:37 gpz Exp $
34#
35
36CONTIKI=../contiki
37
38# Change the target system type here
39SYS=gba
40
41# CC=/opt/ham/gcc-arm/bin/arm-elf-gcc
42# LD=/opt/ham/gcc-arm/bin/arm-elf-ld
43# OBJCOPY=/opt/ham/gcc-arm/bin/arm-elf-objcopy
44
45CC=/opt/devkitadv/bin/arm-agb-elf-gcc
46AS=/opt/devkitadv/bin/arm-agb-elf-as
47LD=/opt/devkitadv/bin/arm-agb-elf-ld
48OBJCOPY=/opt/devkitadv/bin/arm-agb-elf-objcopy
49
50CFLAGS=-I arch/gba -I ctk -I uip -I conf \
51 -I $(CONTIKI)/apps -I $(CONTIKI)/ctk -I $(CONTIKI)/ek \
52 -I $(CONTIKI)/lib -I $(CONTIKI)/uip \
53 -Wa,-I,arch -Wa,-I,arch/gba \
54 -D__GBA__ -DCTK_CONIO -DWITH_UIP \
55 -DWITH_TELNET \
56 -DWITH_EMAIL \
57 -DWITH_CALC -D WITH_CALC_ICON
58
59 #-DWITH_WWW
60
61OPT=-O3
62
63CINC=-Iarch/gba -Ictk -Iuip -Iconf \
64 -I$(CONTIKI)/apps -I$(CONTIKI)/ctk -I$(CONTIKI)/ek \
65 -I$(CONTIKI)/lib -I$(CONTIKI)/uip \
66 -D__GBA__
67
68splint:
69 @splint $(CINC) +ansi89limits +continuecomment +controlnestdepth 15 \
70 +evalorder +evalorderuncon +exitarg +fcnderef +fcnmacros +fcnuse \
71 +hints +forcehints +formatconst -gnuextensions +immediatetrans \
72 +includenest 8 +incondefs +incondefslib +infloops +infloopsuncon \
73 +internalnamelookalike \
74 +iso99limits +isolib +isoreserved +isoreservedinternal \
75 +libmacros +macroassign +macroempty \
76 ./contiki-main.c \
77 \
78 strncasecmp.c \
79 petsciiconv.c \
80 ./../contiki/apps/contiki.c \
81 programs.c \
82 ctk-conio.c \
83 ctk.c \
84 ek.c \
85 dispatcher.c \
86 program-handler.c \
87 \
88 ./arch/gba/conio.c \
89 ./arch/gba/joystick.c \
90 ./arch/none/joytokbd.c \
91 ./arch/gba/vsprintf.c \
92 ./arch/gba/ltostr.c \
93 ./arch/gba/_sbrk.c \
94 ./arch/gba/_oserror.c \
95 ./arch/gba/_exit.c \
96 ./arch/gba/_kill.c \
97 ./arch/gba/_getpid.c \
98 ./arch/gba/gba.c \
99 2>&1 | less
100
101%.o: %.c
102 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
103 @$(AS) -o $@ $(AFLAGS) $(*).s
104
105%.o: ctk/%.c
106 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
107 @$(AS) -o $@ $(AFLAGS) $(*).s
108
109%.o: uip/%.c
110 @$(CC) $(CFLAGS) -S -o $(patsubst %c, %s, $(notdir $<)) $<
111 @$(AS) -o $@ $(AFLAGS) $(*).s
112
113%.o: $(CONTIKI)/apps/%.c
114 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
115 @$(AS) -o $@ $(AFLAGS) $(*).s
116
117%.o: $(CONTIKI)/ctk/%.c
118 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
119 @$(AS) -o $@ $(AFLAGS) $(*).s
120
121%.o: $(CONTIKI)/ek/%.c
122 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
123 @$(AS) -o $@ $(AFLAGS) $(*).s
124
125%.o: $(CONTIKI)/lib/%.c
126 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
127 @$(AS) -o $@ $(AFLAGS) $(*).s
128
129%.o: $(CONTIKI)/uip/%.c
130 @$(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
131 @$(AS) -o $@ $(AFLAGS) $(*).s
132
133UIP=uip.o uip_arch.o uip_main.o resolv.o
134WWW=www.o webclient.o http-strings.o htmlparser.o html-strings.o
135EMAIL=email.o smtp.o smtp-strings.o
136TELNET=simpletelnet.o telnet.o
137
138#cbm only :(
139#WEBSERVER=webserver.o http-strings.o
140#VNC=vnc.o vnc-viewer.o vnc-draw.o vnc-draw-asm.o
141
142all: contiki
143
144# about-dsc.o netconf-dsc.o processes-dsc.o \
145
146contiki: contiki-main.o strncasecmp.o petsciiconv.o \
147 contiki.o programs.o \
148 ctk-conio.o ctk.o ek.o dispatcher.o \
149 $(UIP) \
150 $(EMAIL) \
151 $(TELNET) \
152 program-handler.o
153
154 cd arch;bin2o .rodata gba/ascchar.raw gba/ascchar.o
155
156 @$(CC) $(CFLAGS) -O6 -c -I./gba -D__GBA__ \
157 ./arch/gba/crt0.s \
158 ./arch/gba/conio.c \
159 ./arch/gba/joystick.c \
160 ./arch/none/joytokbd.c \
161 ./arch/gba/vsprintf.c \
162 ./arch/gba/ltostr.c \
163 ./arch/gba/_sbrk.c \
164 ./arch/gba/_oserror.c \
165 ./arch/gba/_exit.c \
166 ./arch/gba/_kill.c \
167 ./arch/gba/_getpid.c \
168 ./arch/gba/gba.c
169
170 @$(LD) -nostdlib -o contiki.elf -T ./arch/gba/arm-gbabin.x \
171 crt0.o \
172 $^ \
173 ./arch/gba/ascchar.o \
174 gba.o \
175 conio.o \
176 joystick.o \
177 joytokbd.o \
178 vsprintf.o \
179 ltostr.o \
180 _sbrk.o \
181 _oserror.o \
182 _exit.o \
183 _kill.o \
184 _getpid.o \
185 /opt/devkitadv/lib/gcc-lib/arm-agb-elf/3.0.2/libgcc.a \
186 -lc -lg -lm -lstdc++
187
188 @$(OBJCOPY) -v -O binary contiki.elf contiki.gba 1> /dev/null 2> /dev/null
189
190run:
191 @VisualBoyAdvance -T 500000 -f 0 -1 -s 9 --ifb-none contiki.gba
192
193clean:
194 rm -f *.o *~ *core contiki.gba contiki.elf *.s