blob: 416420bf42c295dcec5a02afb55ef7aa22e5e241 [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.
adamdunkels1dc4ca02004-07-04 19:58:55 +000012# 3. The name of the author may not be used to endorse or promote
adamdunkelsd9ae56d2003-04-11 20:29:28 +000013# products derived from this software without specific prior
14# written permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
17# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28# This file is part of the Contiki desktop environment
29#
oliverschmidte4e7e532005-04-27 23:50:23 +000030# $Id: Makefile,v 1.3 2005/04/27 23:50:23 oliverschmidt Exp $
adamdunkelsd9ae56d2003-04-11 20:29:28 +000031#
32
33all: contiki loader-arch-module.o contiki-labels.o \
34 about.prg processes.prg netconf.prg memstat.prg calc.prg
35
36CONTIKI=../contiki
adamdunkels1dc4ca02004-07-04 19:58:55 +000037CONTIKICC65=../contiki-cc65
adamdunkelsd9ae56d2003-04-11 20:29:28 +000038SYS=pet
39
40CC=cc65
41AS=ca65
42CFLAGS=-I apps -I ctk -I loader -I uip -I conf \
43 -I $(CONTIKI)/apps -I $(CONTIKI)/ctk -I $(CONTIKI)/ek \
44 -I $(CONTIKI)/lib -I $(CONTIKI)/uip \
45 -t $(SYS) --add-source -DWITH_LOADER_ARCH
46OPT=-Or
47
48%.o: %.c
49 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
50 $(AS) -o $@ $(AFLAGS) $(*).s
51
52%.o: apps/%.c
53 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
54 $(AS) -o $@ $(AFLAGS) $(*).s
55
56%.o: ctk/%.c
57 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
58 $(AS) -o $@ $(AFLAGS) $(*).s
59
60%.o: loader/%.c
61 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
62 $(AS) -o $@ $(AFLAGS) $(*).s
63
64%.o: uip/%.c
65 $(CC) $(CFLAGS) -o $(patsubst %c, %s, $(notdir $<)) $<
66 $(AS) -o $@ $(AFLAGS) $(*).s
67
68%.o: $(CONTIKI)/apps/%.c
69 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
70 $(AS) -o $@ $(AFLAGS) $(*).s
71
72%.o: $(CONTIKI)/ctk/%.c
73 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
74 $(AS) -o $@ $(AFLAGS) $(*).s
75
76%.o: $(CONTIKI)/ek/%.c
77 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
78 $(AS) -o $@ $(AFLAGS) $(*).s
79
80%.o: $(CONTIKI)/lib/%.c
81 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
82 $(AS) -o $@ $(AFLAGS) $(*).s
83
84%.o: $(CONTIKI)/uip/%.c
85 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
86 $(AS) -o $@ $(AFLAGS) $(*).s
87
adamdunkels1dc4ca02004-07-04 19:58:55 +000088%.o: $(CONTIKICC65)/apps/%.c
89 $(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
90 $(AS) -o $@ $(AFLAGS) $(*).s
91
adamdunkelsd9ae56d2003-04-11 20:29:28 +000092
93%.o: apps/%.S
94 $(AS) -o $@ $(AFLAGS) $<
95
96%.o: ctk/%.S
97 $(AS) -o $@ $(AFLAGS) $<
98
99%.o: loader/%.S
100 $(AS) -o $@ $(AFLAGS) $<
101
102%.prg: %.o contiki-labels.o
103 cl65 --module -t $(SYS) -o $@ loader-arch-module.o $^
104
105
106contiki-labels.o: contiki-labels.s
107 ca65 -o contiki-labels.o contiki-labels.s
108contiki-labels.s: contiki
adamdunkels1dc4ca02004-07-04 19:58:55 +0000109 $(CONTIKICC65)/make-labels
adamdunkelsd9ae56d2003-04-11 20:29:28 +0000110
111contiki: contiki-main.o strncasecmp.o petsciiconv.o \
adamdunkels1dc4ca02004-07-04 19:58:55 +0000112 ctk-conio.o ctk.o ek.o timer.o arg.o \
adamdunkelsd9ae56d2003-04-11 20:29:28 +0000113 program-handler.o loader-arch.o
114 cl65 -Ln contiki-labels -o contiki -t $(SYS) $^
115
116
117clean:
118 rm -f *.o *~ *core contiki *.s *.prg
119
adamdunkelsd9ae56d2003-04-11 20:29:28 +0000120codesize:
121 od65 --dump-segsize *.o | egrep '\.o|CODE'