contiki/platform/cooja/Makefile.cooja

80 lines
2.4 KiB
Makefile
Raw Normal View History

# $Id: Makefile.cooja,v 1.9 2006/11/06 18:07:51 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.
### Check input COOJA parameters
ifndef CONTIKI
$(error CONTIKI not defined!)
endif
ifndef TYPEID
$(error TYPEID not defined!)
endif
OUTPUT_DIR = obj_cooja
LIBFILE = $(OUTPUT_DIR)/$(TYPEID).library
DEPFILE = $(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
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 radio-arch.c rs232.c vib-sensor.c \
clock.c log.c radio-sensor.c cfs-cooja.c
CORE_FILES = random.c sensors.c leds.c serial.c cfs.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 = -I. -I$(CONTIKI_CPU) \
$(EXTRA_CC_ARGS) \
-I$(COOJA) \
-I$(CONTIKI)/core \
-DWITH_UIP -DWITH_ASCII \
-Wall -g -I. -I/usr/local/include
CFLAGS = $(CFLAGSNO)
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(COOJA)/, \
$(CONTIKI_TARGET_DIRS)}
vpath %.c $(PROJECTDIRS) \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU)
### Define custom targets
$(LIBFILE): $(MAINFILE) $(PROJECT_OBJECTFILES) $(DEPFILE)
ifdef SYMBOLS
${CONTIKI}/tools/make-symbols-nm $(LIBFILE)
$(CC) $(CFLAGS) -c symbols.c -o $(OBJECTDIR)/symbols.o
$(LD) -Map=$(MAPFILE) -shared $(LD_ARGS_1) -o $@ $^ $(OBJECTDIR)/symbols.o $(LD_ARGS_2)
${CONTIKI}/tools/make-symbols-nm $(LIBFILE)
$(CC) $(CFLAGS) -c symbols.c -o $(OBJECTDIR)/symbols.o
$(LD) -Map=$(MAPFILE) -shared $(LD_ARGS_1) -o $@ $^ $(OBJECTDIR)/symbols.o $(LD_ARGS_2)
else
$(LD) -Map=$(MAPFILE) -shared $(LD_ARGS_1) -o $@ $^ $(LD_ARGS_2)
endif
$(DEPFILE): ${addprefix $(OBJECTDIR)/, $(CONTIKI_SOURCEFILES:.c=.o)}
$(AR) rcf $@ $^