2007-11-25 22:47:43 +00:00
|
|
|
# $Id: Makefile.cooja,v 1.21 2007/11/25 22:47:43 fros4943 Exp $
|
2006-08-21 12:11:16 +00:00
|
|
|
|
2006-09-06 12:20:12 +00:00
|
|
|
## The COOJA Simulator Contiki platform Makefile
|
|
|
|
##
|
|
|
|
## This makefile should normally never be called directly, but
|
|
|
|
## rather from inside the COOJA simulator.
|
|
|
|
## The purpose of this file is to compile a shared library that
|
|
|
|
## can be loaded into the Java part of COOJA.
|
2006-08-21 12:11:16 +00:00
|
|
|
|
2007-03-23 21:36:48 +00:00
|
|
|
ifndef WINDIR
|
|
|
|
ifdef OS
|
|
|
|
ifneq (,$(findstring Windows,$(OS)))
|
|
|
|
WINDIR := Windows
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2006-09-06 12:20:12 +00:00
|
|
|
### Check input COOJA parameters
|
2006-08-21 12:11:16 +00:00
|
|
|
|
|
|
|
ifndef CONTIKI
|
|
|
|
$(error CONTIKI not defined!)
|
|
|
|
endif
|
|
|
|
|
2007-04-02 10:28:52 +00:00
|
|
|
### Assuming quickstart if no type ID set
|
2006-08-21 12:11:16 +00:00
|
|
|
ifndef TYPEID
|
2007-04-02 10:28:52 +00:00
|
|
|
QUICKSTART=1
|
|
|
|
endif
|
|
|
|
|
2007-03-25 18:22:41 +00:00
|
|
|
### Quickstart simulator
|
2007-04-02 10:28:52 +00:00
|
|
|
ifdef QUICKSTART
|
|
|
|
|
|
|
|
# Check that target file exists
|
|
|
|
have_file := $(wildcard $(MAKECMDGOALS).c)
|
|
|
|
ifeq ($(strip $(have_file)),)
|
|
|
|
$(error Quick-start error. Can't find file "$(MAKECMDGOALS).c")
|
|
|
|
endif
|
2007-04-02 09:07:30 +00:00
|
|
|
|
2007-04-02 10:28:52 +00:00
|
|
|
# Create COOJA JAR rule
|
2007-04-02 09:07:30 +00:00
|
|
|
$(CONTIKI)/tools/cooja/dist/cooja.jar:
|
2007-04-02 10:28:52 +00:00
|
|
|
@echo "Creating COOJA Java archive..."
|
2007-04-02 09:07:30 +00:00
|
|
|
(cd $(CONTIKI)/tools/cooja && ant jar)
|
2007-04-02 10:28:52 +00:00
|
|
|
|
|
|
|
# Quickstart rule
|
|
|
|
$(MAKECMDGOALS): $(CONTIKI)/tools/cooja/dist/cooja.jar
|
|
|
|
java -jar $(CONTIKI)/tools/cooja/dist/cooja.jar -quickstart=$(MAKECMDGOALS).c -contiki=$(CONTIKI)
|
|
|
|
|
|
|
|
endif ## QUICKSTART
|
2006-08-21 12:11:16 +00:00
|
|
|
|
|
|
|
OUTPUT_DIR = obj_cooja
|
|
|
|
LIBFILE = $(OUTPUT_DIR)/$(TYPEID).library
|
2007-09-05 14:00:59 +00:00
|
|
|
ARFILE = $(OUTPUT_DIR)/$(TYPEID).a
|
2006-08-21 12:11:16 +00:00
|
|
|
MAPFILE = $(OUTPUT_DIR)/$(TYPEID).map
|
|
|
|
MAINFILE = $(OUTPUT_DIR)/$(TYPEID).co
|
|
|
|
|
2006-09-06 12:20:12 +00:00
|
|
|
### Define COOJA core interfaces
|
2006-08-21 12:11:16 +00:00
|
|
|
COOJA = $(CONTIKI)/platform/$(TARGET)
|
2007-05-18 13:51:04 +00:00
|
|
|
CONTIKI_TARGET_DIRS = . dev lib sys cfs net
|
2006-08-21 12:11:16 +00:00
|
|
|
|
2006-09-29 14:32:15 +00:00
|
|
|
COOJA_BASE = simEnvChange.c irq.c cooja_mt.c cooja_mtarch.c
|
2006-08-21 12:11:16 +00:00
|
|
|
|
2006-09-29 14:32:15 +00:00
|
|
|
COOJA_INTFS = beep.c button-sensor.c ip.c leds-arch.c moteid.c \
|
2007-05-18 13:51:04 +00:00
|
|
|
pir-sensor.c rs232.c vib-sensor.c \
|
2006-10-11 14:14:41 +00:00
|
|
|
clock.c log.c radio-sensor.c cfs-cooja.c
|
2006-08-21 12:11:16 +00:00
|
|
|
|
2007-05-21 14:57:47 +00:00
|
|
|
CORE_FILES = random.c sensors.c leds.c serial.c symbols.c
|
2006-09-06 12:20:12 +00:00
|
|
|
|
2006-08-21 12:11:16 +00:00
|
|
|
CONTIKI_TARGET_SOURCEFILES = \
|
2006-09-29 14:32:15 +00:00
|
|
|
$(COOJA_BASE) $(COOJA_INTFS) $(CORE_FILES) $(PROJECT_SOURCEFILES)
|
2006-08-21 12:11:16 +00:00
|
|
|
|
|
|
|
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
|
|
|
|
|
|
|
.SUFFIXES:
|
|
|
|
|
|
|
|
### Define the CPU directory
|
|
|
|
CONTIKI_CPU=$(CONTIKI)/cpu/x86
|
|
|
|
|
2006-09-06 12:20:12 +00:00
|
|
|
### Compiler arguments
|
2007-05-19 07:54:53 +00:00
|
|
|
CFLAGSNO = $(EXTRA_CC_ARGS) -Wall -g -I/usr/local/include
|
2006-08-21 12:11:16 +00:00
|
|
|
CFLAGS = $(CFLAGSNO)
|
|
|
|
|
2006-09-06 12:20:12 +00:00
|
|
|
### Define custom targets
|
2007-09-05 14:00:59 +00:00
|
|
|
$(LIBFILE): $(MAINFILE) $(PROJECT_OBJECTFILES) $(ARFILE)
|
2006-11-06 18:03:34 +00:00
|
|
|
ifdef SYMBOLS
|
2007-01-09 09:13:36 +00:00
|
|
|
# Recreate symbols file and relink with final memory layout (twice)
|
2007-11-25 22:47:43 +00:00
|
|
|
${CONTIKI}/tools/make-symbols-nm $(LIBFILE)
|
2006-10-23 16:07:29 +00:00
|
|
|
$(CC) $(CFLAGS) -c symbols.c -o $(OBJECTDIR)/symbols.o
|
2007-09-05 14:00:59 +00:00
|
|
|
$(LINK_COMMAND_1) $^ $(LINK_COMMAND_2)
|
2006-10-23 16:07:29 +00:00
|
|
|
${CONTIKI}/tools/make-symbols-nm $(LIBFILE)
|
|
|
|
$(CC) $(CFLAGS) -c symbols.c -o $(OBJECTDIR)/symbols.o
|
2007-09-05 14:00:59 +00:00
|
|
|
$(LINK_COMMAND_1) $^ $(LINK_COMMAND_2)
|
2006-11-06 18:03:34 +00:00
|
|
|
else
|
2007-09-05 14:00:59 +00:00
|
|
|
$(LINK_COMMAND_1) $^ $(LINK_COMMAND_2)
|
2006-11-06 18:03:34 +00:00
|
|
|
endif
|
2006-08-21 12:11:16 +00:00
|
|
|
|
2007-09-05 14:00:59 +00:00
|
|
|
$(ARFILE): ${addprefix $(OBJECTDIR)/, $(CONTIKI_SOURCEFILES:.c=.o)}
|
2007-09-28 07:21:21 +00:00
|
|
|
$(AR_COMMAND_1) $^ $(AR_COMMAND_2)
|
2007-01-09 09:13:36 +00:00
|
|
|
|
2007-03-23 21:36:48 +00:00
|
|
|
ifndef WINDIR
|
2007-01-09 09:13:36 +00:00
|
|
|
.PHONY: symbols.c
|
2007-03-23 21:36:48 +00:00
|
|
|
endif
|
|
|
|
|
2007-01-09 09:13:36 +00:00
|
|
|
symbols.c:
|
|
|
|
# Create initial symbol files if not existing
|
|
|
|
${CONTIKI}/tools/make-empty-symbols
|