blob: eb222b9ff6d3741d1e2d5717310bf29b17a62004 [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#
oliverschmidtf6d3a932005-04-18 22:45:29 +000033# $Id: Makefile,v 1.2 2005/04/18 22:45:29 oliverschmidt Exp $
gpz60e116b2003-05-19 09:30:01 +000034#
35
36CONTIKI=../contiki
37
oliverschmidtf6d3a932005-04-18 22:45:29 +000038include $(CONTIKI)/Makefile.common
39
gpz60e116b2003-05-19 09:30:01 +000040# Change the target system type here
41SYS=gp32
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/gp32 -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/gp32 \
56 -D__GP32__ -DCTK_CONIO -DWITH_UIP \
57 -DWITH_WWW -D WITH_TELNET_WWW \
58 -DWITH_TELNET -D WITH_TELNET_ICON \
59 -DWITH_EMAIL -D WITH_EMAIL_ICON \
60 -DWITH_CALC -D WITH_CALC_ICON
61
62OPT=-O3
63%.o: %.c
64 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
65 $(AS) -o $@ $(AFLAGS) $(*).s
66
67%.o: ctk/%.c
68 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
69 $(AS) -o $@ $(AFLAGS) $(*).s
70
71%.o: uip/%.c
72 $(CC) $(CFLAGS) -S -o $(patsubst %c, %s, $(notdir $<)) $<
73 $(AS) -o $@ $(AFLAGS) $(*).s
74
75%.o: $(CONTIKI)/apps/%.c
76 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
77 $(AS) -o $@ $(AFLAGS) $(*).s
78
79%.o: $(CONTIKI)/ctk/%.c
80 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
81 $(AS) -o $@ $(AFLAGS) $(*).s
82
83%.o: $(CONTIKI)/ek/%.c
84 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
85 $(AS) -o $@ $(AFLAGS) $(*).s
86
87%.o: $(CONTIKI)/lib/%.c
88 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
89 $(AS) -o $@ $(AFLAGS) $(*).s
90
91%.o: $(CONTIKI)/uip/%.c
92 $(CC) $(CFLAGS) -S $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
93 $(AS) -o $@ $(AFLAGS) $(*).s
94
gpz60e116b2003-05-19 09:30:01 +000095all: contiki
96
97contiki: contiki-main.o strncasecmp.o petsciiconv.o \
98 contiki.o programs.o \
99 ctk-conio.o ctk.o ek.o dispatcher.o \
100 $(WWW) \
101 $(EMAIL) \
102 $(TELNET) \
103 $(UIP)
104
105
106 cd arch;bin2o .rodata gp32/font8x8.bin gp32/font8x8.o
107
108 $(CC) $(CFLAGS) -O6 -c -I./gp32 -D__GP32__ \
109 ./arch/gp32/crt0.s \
110 ./arch/gp32/gp32.c \
111 ./arch/gp32/syscall.s \
112 ./arch/gp32/vsprintf.c \
113 ./arch/gp32/_sbrk.c \
114 ./arch/gp32/_oserror.c \
115 ./arch/gp32/_exit.c \
116 ./arch/gp32/_kill.c \
117 ./arch/gp32/_getpid.c \
118 ./arch/gp32/ltostr.c \
119 ./arch/gp32/joystick.c \
120 ./arch/none/joytokbd.c \
121 ./arch/gp32/gppaletteset.c \
122 ./arch/gp32/conio.c
123
124 $(LD) -nostdlib -o contiki.elf -T ./arch/gp32/arm-gp32bin.x \
125 crt0.o \
126 $^ \
127 gp32.o \
128 ./arch/gp32/font8x8.o \
129 vsprintf.o \
130 _sbrk.o \
131 _exit.o \
132 _kill.o \
133 _getpid.o \
134 ltostr.o \
135 joystick.o \
136 joytokbd.o \
137 _oserror.o \
138 conio.o \
139 syscall.o \
140 gppaletteset.o \
141 /opt/devkitadv/lib/gcc-lib/arm-agb-elf/3.0.2/libgcc.a \
142 -lc -lg -lm -lstdc++
143
144 $(OBJCOPY) -v -O binary contiki.elf contiki.gxb 1> /dev/null 2> /dev/null
145
146run:
147 /home/groepaz/geepee32/geepee32 /EXE=contiki.gxb /RUN
148
149clean:
150 rm -f *.o *~ *core contiki.gxb contiki.elf *.s
151 rm -f arch/gp32/*.o