blob: 7e4a76a0dd1359f7419daa4df0f18ae1c2ac5e21 [file] [log] [blame]
adamdunkelsd9ae56d2003-04-11 20:29:28 +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/04/11 20:29:28 adamdunkels Exp $
34#
35
36all: contiki loader-arch-module.o contiki-labels.o \
37 about.prg processes.prg netconf.prg memstat.prg calc.prg
38
39CONTIKI=../contiki
40SYS=pet
41
42CC=cc65
43AS=ca65
44CFLAGS=-I apps -I ctk -I loader -I uip -I conf \
45 -I $(CONTIKI)/apps -I $(CONTIKI)/ctk -I $(CONTIKI)/ek \
46 -I $(CONTIKI)/lib -I $(CONTIKI)/uip \
47 -t $(SYS) --add-source -DWITH_LOADER_ARCH
48OPT=-Or
49
50%.o: %.c
51 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
52 $(AS) -o $@ $(AFLAGS) $(*).s
53
54%.o: apps/%.c
55 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
56 $(AS) -o $@ $(AFLAGS) $(*).s
57
58%.o: ctk/%.c
59 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
60 $(AS) -o $@ $(AFLAGS) $(*).s
61
62%.o: loader/%.c
63 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
64 $(AS) -o $@ $(AFLAGS) $(*).s
65
66%.o: uip/%.c
67 $(CC) $(CFLAGS) -o $(patsubst %c, %s, $(notdir $<)) $<
68 $(AS) -o $@ $(AFLAGS) $(*).s
69
70%.o: $(CONTIKI)/apps/%.c
71 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
72 $(AS) -o $@ $(AFLAGS) $(*).s
73
74%.o: $(CONTIKI)/ctk/%.c
75 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
76 $(AS) -o $@ $(AFLAGS) $(*).s
77
78%.o: $(CONTIKI)/ek/%.c
79 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
80 $(AS) -o $@ $(AFLAGS) $(*).s
81
82%.o: $(CONTIKI)/lib/%.c
83 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
84 $(AS) -o $@ $(AFLAGS) $(*).s
85
86%.o: $(CONTIKI)/uip/%.c
87 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
88 $(AS) -o $@ $(AFLAGS) $(*).s
89
90
91%.o: apps/%.S
92 $(AS) -o $@ $(AFLAGS) $<
93
94%.o: ctk/%.S
95 $(AS) -o $@ $(AFLAGS) $<
96
97%.o: loader/%.S
98 $(AS) -o $@ $(AFLAGS) $<
99
100%.prg: %.o contiki-labels.o
101 cl65 --module -t $(SYS) -o $@ loader-arch-module.o $^
102
103
104contiki-labels.o: contiki-labels.s
105 ca65 -o contiki-labels.o contiki-labels.s
106contiki-labels.s: contiki
107 ./make-labels
108
109contiki: contiki-main.o strncasecmp.o petsciiconv.o \
110 ctk-conio.o ctk.o ek.o dispatcher.o \
111 program-handler.o loader-arch.o
112 cl65 -Ln contiki-labels -o contiki -t $(SYS) $^
113
114
115clean:
116 rm -f *.o *~ *core contiki *.s *.prg
117
118depend:
119 gcc -MM -Iapps -Ictk -Iuip -Iconf \
120 -I$(CONTIKI)/lib -I$(CONTIKI)/ek \
121 -I$(CONTIKI)/ctk -I$(CONTIKI)/apps -I$(CONTIKI)/uip \
122 *.c */*.c $(CONTIKI)/*/*.c > Makefile.depend
123
124include Makefile.depend
125
126codesize:
127 od65 --dump-segsize *.o | egrep '\.o|CODE'