2007-04-26 15:39:52 +02:00
|
|
|
# $Id: Makefile,v 1.13 2007/04/26 13:39:52 bg- Exp $
|
2006-08-02 16:44:46 +02:00
|
|
|
#
|
|
|
|
# This makefile requires GNU make!
|
|
|
|
|
|
|
|
LIB = libcontiki.a
|
2006-12-01 15:55:15 +01:00
|
|
|
KERNELS = gateway.ihex client.ihex dhclient.ihex
|
2006-08-02 16:44:46 +02:00
|
|
|
PROGS = loadable_prg.ko udpsend.ko udprecv.ko
|
|
|
|
TOOLS = tunslip scat codeprop
|
|
|
|
|
|
|
|
all: $(LIB) $(KERNELS) $(PROGS) $(TOOLS)
|
|
|
|
|
2006-12-05 17:19:43 +01:00
|
|
|
loadable_prg.ko: loadable_prg.o
|
|
|
|
udpsend.ko: udpsend.o
|
|
|
|
udprecv.ko: udprecv.o
|
|
|
|
|
2006-08-02 16:44:46 +02:00
|
|
|
gateway.out: gateway.o $(LIB)
|
2006-12-01 15:55:15 +01:00
|
|
|
client.out: client.o $(LIB)
|
2006-08-02 16:44:46 +02:00
|
|
|
dhclient.out: dhclient.o $(LIB)
|
|
|
|
|
2007-01-29 15:28:10 +01:00
|
|
|
TOP=../..
|
|
|
|
INCDIRS = -I. -I$(TOP)/cpu/msp430 -I$(TOP)/core -I$(TOP)/apps
|
|
|
|
SRCDIRS = dev $(TOP)/cpu/msp430 ${addprefix $(TOP)/core/,sys dev net lib loader} $(TOP)/apps/codeprop
|
2006-08-02 16:44:46 +02:00
|
|
|
|
|
|
|
MCU=msp430x1611
|
|
|
|
|
2007-04-26 15:39:52 +02:00
|
|
|
ARCH=msp430.o minileds.o watchdog.o light.o button.o spi.o ds2411.o rom.o xmem.o i2c.o cle_msp430.o
|
2006-08-02 16:44:46 +02:00
|
|
|
SYSTEM=process.o procinit.o service.o clock.o etimer.o timer.o \
|
2007-04-25 17:49:43 +02:00
|
|
|
cmod.o cle.o sym.o
|
2006-08-02 16:44:46 +02:00
|
|
|
UIP=uip.o uiplib.o tcpip.o uip-fw.o uip-fw-service.o uipbuf.o \
|
2007-03-15 22:50:23 +01:00
|
|
|
tcpdump.o psock.o dhcpc.o uaodv.o uaodv-rt.o uip-udp-packet.o \
|
|
|
|
uip-ipchksum.o
|
2006-08-02 16:44:46 +02:00
|
|
|
UIPDRIVERS=slip.o slip_uart1.o \
|
|
|
|
cc2420.o cc2420_uart0.o cc2420_send_ip.o cc2420_send_uaodv.o
|
2006-08-11 15:37:21 +02:00
|
|
|
LIBS=memb.o list.o malloc.o realloc.o malloc_compact.o rand.o assert.o crtk.o
|
2007-01-12 19:24:51 +01:00
|
|
|
SYSAPPS=tcp_loader2.o
|
2006-08-02 16:44:46 +02:00
|
|
|
LIBFILES=$(SYSTEM) $(ARCH) $(UIP) $(UIPDRIVERS) $(LIBS) $(SYSAPPS)
|
|
|
|
|
2007-04-25 17:49:43 +02:00
|
|
|
MKNMLIST=awk -f $(TOP)/tools/mknmlist-ansi
|
2006-08-02 16:44:46 +02:00
|
|
|
CP=cp
|
|
|
|
LIBC=-lgcc -lc -lgcc
|
|
|
|
CC=msp430-gcc
|
|
|
|
LD=msp430-ld
|
|
|
|
AS=msp430-as
|
2006-12-20 14:46:14 +01:00
|
|
|
NM=msp430-nm
|
2006-08-02 16:44:46 +02:00
|
|
|
OBJCOPY=msp430-objcopy
|
|
|
|
STRIP=msp430-strip
|
|
|
|
AR=msp430-ar
|
|
|
|
RANLIB=msp430-ranlib
|
|
|
|
BSL=msp430-bsl
|
|
|
|
CFLAGS=-mmcu=$(MCU) $(INCDIRS) -Wall -Os
|
|
|
|
LDFLAGS=-mmcu=$(MCU)
|
|
|
|
|
|
|
|
# Setup directory search path for source files
|
|
|
|
vpath %.c $(SRCDIRS) ${filter-out CVS,${wildcard labs/*}}
|
|
|
|
|
|
|
|
# Set COM port if not already set.
|
|
|
|
# DOS: 1 => COM2, 2 => COM3, etc.
|
|
|
|
# Linux: /dev/ttyUSB0, /dev/ttyUSB1, etc.
|
2007-01-12 19:24:51 +01:00
|
|
|
# FreeBSD 6.2: /dev/cuaU0, /dev/cuaU1, etc.
|
2006-08-02 16:44:46 +02:00
|
|
|
ifndef COMPORT
|
|
|
|
COMPORT := /dev/ttyUSB0
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $(notdir $(<:.c=.o))
|
|
|
|
|
2006-12-20 14:46:14 +01:00
|
|
|
# Combine several .o:s to one .ko and put COMMONs into the BSS segment
|
2006-12-05 17:19:43 +01:00
|
|
|
%.ko:
|
|
|
|
$(LD) -r -dc --strip-all --unresolved-symbols=ignore-in-object-files $^ -o $@
|
2006-08-02 16:44:46 +02:00
|
|
|
|
|
|
|
%.ihex: %.out
|
|
|
|
$(OBJCOPY) $^ -O ihex $@
|
|
|
|
|
|
|
|
#%.out:
|
|
|
|
# $(if $^,$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^,$(error "NO TARGET $@"))
|
|
|
|
|
|
|
|
# Add a namelist to the kernel
|
|
|
|
%.out: $^
|
2007-01-29 15:28:10 +01:00
|
|
|
: | $(MKNMLIST) > $@_tmp.c && mv $@_tmp.c $@_nm.c
|
2006-08-02 16:44:46 +02:00
|
|
|
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBC) $@_nm.c
|
2007-01-29 15:28:10 +01:00
|
|
|
$(NM) $@ | $(MKNMLIST) > $@_tmp.c && mv $@_tmp.c $@_nm.c
|
2006-08-02 16:44:46 +02:00
|
|
|
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBC) $@_nm.c
|
|
|
|
|
|
|
|
%.u: %.ihex
|
|
|
|
$(BSL) --telosb -D -c $(COMPORT) -r -e -I -p $<
|
|
|
|
|
|
|
|
$(LIB): $(LIBFILES)
|
|
|
|
$(AR) rcf $@ $^
|
|
|
|
$(RANLIB) $@
|
|
|
|
|
2007-01-29 15:28:10 +01:00
|
|
|
codeprop: $(TOP)/tools/codeprop.c
|
2006-08-02 16:44:46 +02:00
|
|
|
cc -g -Wall $< -o $@
|
|
|
|
|
2007-01-29 15:28:10 +01:00
|
|
|
tunslip: $(TOP)/tools/tunslip.c
|
2006-08-02 16:44:46 +02:00
|
|
|
cc -g -Wall $< -o $@
|
|
|
|
|
2007-01-29 15:28:10 +01:00
|
|
|
scat: $(TOP)/tools/scat.c
|
2006-08-02 16:44:46 +02:00
|
|
|
cc -g -Wall $< -o $@
|
|
|
|
|
|
|
|
### TEST ###
|
|
|
|
|
|
|
|
test.out: test.o $(LIB)
|
|
|
|
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
depend: $(LIBFILES:.o=.c)
|
|
|
|
-$(CC) $(CCDEPFLAGS) -MM $(CFLAGS) $(INCDIRS) $^ *.c >Makefile.depend
|
|
|
|
|
|
|
|
tags: $(LIBFILES:.o=.c)
|
|
|
|
etags $^
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *.o *.ko *~ *.core *.out *.ihex *_nm.c
|
|
|
|
rm -f $(LIB) $(KERNELS) $(TOOLS)
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
|
|
|
|
-include Makefile.depend
|