osd-contiki/platform/cooja/Makefile.cooja

101 lines
2.7 KiB
Makefile
Raw Normal View History

2007-11-29 05:57:04 +01:00
# $Id: Makefile.cooja,v 1.22 2007/11/29 04:57:04 fros4943 Exp $
## 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.
ifndef WINDIR
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
WINDIR := Windows
endif
endif
endif
### Check input COOJA parameters
ifndef CONTIKI
$(error CONTIKI not defined!)
endif
### Assuming quickstart if no type ID set
ifndef TYPEID
QUICKSTART=1
endif
### Quickstart simulator
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 11:07:30 +02:00
# Create COOJA JAR rule
2007-04-02 11:07:30 +02:00
$(CONTIKI)/tools/cooja/dist/cooja.jar:
@echo "Creating COOJA Java archive..."
2007-04-02 11:07:30 +02:00
(cd $(CONTIKI)/tools/cooja && ant jar)
# Quickstart rule
$(MAKECMDGOALS): $(CONTIKI)/tools/cooja/dist/cooja.jar
java -jar $(CONTIKI)/tools/cooja/dist/cooja.jar -quickstart=$(MAKECMDGOALS).c -contiki=$(CONTIKI)
endif ## QUICKSTART
OUTPUT_DIR = obj_cooja
LIBFILE = $(OUTPUT_DIR)/$(TYPEID).library
ARFILE = $(OUTPUT_DIR)/$(TYPEID).a
MAPFILE = $(OUTPUT_DIR)/$(TYPEID).map
MAINFILE = $(OUTPUT_DIR)/$(TYPEID).co
### Define COOJA core interfaces
COOJA = $(CONTIKI)/platform/$(TARGET)
CONTIKI_TARGET_DIRS = . dev lib sys cfs net
COOJA_BASE = simEnvChange.c irq.c cooja_mt.c cooja_mtarch.c
COOJA_INTFS = beep.c button-sensor.c ip.c leds-arch.c moteid.c \
pir-sensor.c rs232.c vib-sensor.c \
clock.c log.c radio-sensor.c cfs-cooja.c
2007-05-21 16:57:47 +02:00
CORE_FILES = random.c sensors.c leds.c serial.c symbols.c
CONTIKI_TARGET_SOURCEFILES = \
$(COOJA_BASE) $(COOJA_INTFS) $(CORE_FILES) $(PROJECT_SOURCEFILES)
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
.SUFFIXES:
### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/cpu/x86
### Compiler arguments
CFLAGSNO = $(EXTRA_CC_ARGS) -Wall -g -I/usr/local/include
CFLAGS = $(CFLAGSNO)
### Define custom targets
$(LIBFILE): $(MAINFILE) $(PROJECT_OBJECTFILES) $(ARFILE)
ifdef SYMBOLS
# Recreate symbols file and relink with final memory layout (twice)
2007-11-25 23:47:43 +01:00
${CONTIKI}/tools/make-symbols-nm $(LIBFILE)
$(CC) $(CFLAGS) -c symbols.c -o $(OBJECTDIR)/symbols.o
$(LINK_COMMAND_1) $^ $(LINK_COMMAND_2)
${CONTIKI}/tools/make-symbols-nm $(LIBFILE)
$(CC) $(CFLAGS) -c symbols.c -o $(OBJECTDIR)/symbols.o
$(LINK_COMMAND_1) $^ $(LINK_COMMAND_2)
else
$(LINK_COMMAND_1) $^ $(LINK_COMMAND_2)
endif
$(ARFILE): ${addprefix $(OBJECTDIR)/, $(CONTIKI_SOURCEFILES:.c=.o)}
$(AR_COMMAND_1) $^ $(AR_COMMAND_2)
symbols.c:
# Create initial symbol files if not existing
${CONTIKI}/tools/make-empty-symbols