blob: 240ca66b4e73a929316e4f71d8c61a8d95c860a0 [file] [log] [blame]
gpz60e116b2003-05-19 09:30:01 +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:30:01 gpz Exp $
34#
35
36CONTIKI=../contiki
37
38# Change the target system type here
39SYS=gp32
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/gp32 -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/gp32 \
54 -D__GP32__ -DCTK_CONIO -DWITH_UIP \
55 -DWITH_WWW -D WITH_TELNET_WWW \
56 -DWITH_TELNET -D WITH_TELNET_ICON \
57 -DWITH_EMAIL -D WITH_EMAIL_ICON \
58 -DWITH_CALC -D WITH_CALC_ICON
59
60OPT=-O3
61%.o: %.c
62 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
63 $(AS) -o $@ $(AFLAGS) $(*).s
64
65%.o: ctk/%.c
66 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
67 $(AS) -o $@ $(AFLAGS) $(*).s
68
69%.o: uip/%.c
70 $(CC) $(CFLAGS) -S -o $(patsubst %c, %s, $(notdir $<)) $<
71 $(AS) -o $@ $(AFLAGS) $(*).s
72
73%.o: $(CONTIKI)/apps/%.c
74 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
75 $(AS) -o $@ $(AFLAGS) $(*).s
76
77%.o: $(CONTIKI)/ctk/%.c
78 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
79 $(AS) -o $@ $(AFLAGS) $(*).s
80
81%.o: $(CONTIKI)/ek/%.c
82 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
83 $(AS) -o $@ $(AFLAGS) $(*).s
84
85%.o: $(CONTIKI)/lib/%.c
86 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
87 $(AS) -o $@ $(AFLAGS) $(*).s
88
89%.o: $(CONTIKI)/uip/%.c
90 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
91 $(AS) -o $@ $(AFLAGS) $(*).s
92
93
94UIP=uip.o uip_arch.o uip_main.o resolv.o
95WWW=www.o webclient.o http-strings.o htmlparser.o html-strings.o
96EMAIL=email.o smtp.o smtp-strings.o
97TELNET=simpletelnet.o telnet.o
98
99#cbm only :(
100#WEBSERVER=webserver.o http-strings.o
101#VNC=vnc.o vnc-viewer.o vnc-draw.o vnc-draw-asm.o
102
103all: contiki
104
105contiki: contiki-main.o strncasecmp.o petsciiconv.o \
106 contiki.o programs.o \
107 ctk-conio.o ctk.o ek.o dispatcher.o \
108 $(WWW) \
109 $(EMAIL) \
110 $(TELNET) \
111 $(UIP)
112
113
114 cd arch;bin2o .rodata gp32/font8x8.bin gp32/font8x8.o
115
116 $(CC) $(CFLAGS) -O6 -c -I./gp32 -D__GP32__ \
117 ./arch/gp32/crt0.s \
118 ./arch/gp32/gp32.c \
119 ./arch/gp32/syscall.s \
120 ./arch/gp32/vsprintf.c \
121 ./arch/gp32/_sbrk.c \
122 ./arch/gp32/_oserror.c \
123 ./arch/gp32/_exit.c \
124 ./arch/gp32/_kill.c \
125 ./arch/gp32/_getpid.c \
126 ./arch/gp32/ltostr.c \
127 ./arch/gp32/joystick.c \
128 ./arch/none/joytokbd.c \
129 ./arch/gp32/gppaletteset.c \
130 ./arch/gp32/conio.c
131
132 $(LD) -nostdlib -o contiki.elf -T ./arch/gp32/arm-gp32bin.x \
133 crt0.o \
134 $^ \
135 gp32.o \
136 ./arch/gp32/font8x8.o \
137 vsprintf.o \
138 _sbrk.o \
139 _exit.o \
140 _kill.o \
141 _getpid.o \
142 ltostr.o \
143 joystick.o \
144 joytokbd.o \
145 _oserror.o \
146 conio.o \
147 syscall.o \
148 gppaletteset.o \
149 /opt/devkitadv/lib/gcc-lib/arm-agb-elf/3.0.2/libgcc.a \
150 -lc -lg -lm -lstdc++
151
152 $(OBJCOPY) -v -O binary contiki.elf contiki.gxb 1> /dev/null 2> /dev/null
153
154run:
155 /home/groepaz/geepee32/geepee32 /EXE=contiki.gxb /RUN
156
157clean:
158 rm -f *.o *~ *core contiki.gxb contiki.elf *.s
159 rm -f arch/gp32/*.o