facdd73eda
* including selected Contiki process source files automatically at compilation time. -> removes the need for manually adding all source files in the cooja.config:s -> only selected source files are compiled
120 lines
3.1 KiB
Text
120 lines
3.1 KiB
Text
## The COOJA Simulator - cooja platform makefile
|
|
##
|
|
## This makefile's main purpose is to compile source files
|
|
## generated by the COOJA Simulator and should
|
|
## only be called from inside the simulator...
|
|
##
|
|
## However, it can also be used as a shortcut to startup the
|
|
## simulator from a customized user platform.
|
|
## See the user platform examples.
|
|
|
|
###########################################################
|
|
ifndef COMPILE_MAIN # << shortcut, startup simulator >>
|
|
|
|
# The COOJA Simulator jar-file location (default)
|
|
ifndef COOJA_JAR
|
|
COOJA_JAR=$(CONTIKI)/tools/cooja/dist/cooja.jar
|
|
endif
|
|
|
|
# Java binary (default)
|
|
ifndef JAVA
|
|
JAVA=java
|
|
endif
|
|
|
|
ifndef WINDIR
|
|
ifdef OS
|
|
ifneq (,$(findstring Windows,$(OS)))
|
|
WINDIR := Windows
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifndef WINDIR
|
|
# This settings are for UNIX
|
|
SEPARATOR=:
|
|
else
|
|
# These setting are for MS-DOS/Windows 95/Windows NT
|
|
SEPARATOR=;
|
|
endif
|
|
|
|
# Command to start simulator with a source file argument
|
|
COMMAND = $(JAVA) -DPATH_CONTIKI=$(CONTIKI) -DQUICKSTART_APP=$@ \
|
|
-cp "$(COOJA_JAR)$(SEPARATOR)$(COOJA_JAVA)" se.sics.cooja.GUI $(CLASS_CONFIGS)
|
|
|
|
# Delete pre-defined project sourcefiles (messes up make execution)
|
|
PROJECT_SOURCEFILES = # OBS! Ugly fix
|
|
|
|
%:
|
|
@echo "Starting simulator (using shortcut)"
|
|
$(COMMAND)
|
|
|
|
###########################################################
|
|
else # << compile generated source file >>
|
|
|
|
### Check/create COOJA parameters (output files)
|
|
|
|
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
|
|
|
|
COOJA = $(CONTIKI)/platform/$(TARGET)
|
|
CONTIKI_TARGET_DIRS = . dev lib sys
|
|
|
|
COOJA_DEV = $(patsubst $(COOJA)/dev/%.c,%.c,$(wildcard $(COOJA)/dev/*.c))
|
|
|
|
COOJA_LIB = $(patsubst $(COOJA)/lib/%.c,%.c,$(wildcard $(COOJA)/lib/*.c))
|
|
|
|
COOJA_SYS = $(patsubst $(COOJA)/sys/%.c,%.c,$(wildcard $(COOJA)/sys/*.c))
|
|
|
|
CORE_FILES = random.c sensors.c leds.c serial.c
|
|
|
|
CONTIKI_TARGET_SOURCEFILES = \
|
|
$(COOJA_DEV) $(COOJA_LIB) $(COOJA_SYS) $(CORE_FILES)
|
|
|
|
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
|
|
|
.SUFFIXES:
|
|
|
|
### Define the CPU directory
|
|
CONTIKI_CPU=$(CONTIKI)/cpu/x86
|
|
|
|
### Compiler definitions (search contiki core last)
|
|
CC = gcc
|
|
LD = ld
|
|
AS = as
|
|
OBJCOPY = objcopy
|
|
STRIP = strip
|
|
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)
|
|
|
|
$(LIBFILE): $(MAINFILE) $(PROJECT_OBJECTFILES) $(DEPFILE)
|
|
$(LD) -Map=$(MAPFILE) -shared $(LD_ARGS_1) -o $@ $^ $(LD_ARGS_2)
|
|
|
|
$(DEPFILE): ${addprefix $(OBJECTDIR)/, $(CONTIKI_SOURCEFILES:.c=.o)}
|
|
$(AR) rcf $@ $^
|
|
|
|
endif ## END OF 'COMPILE GENERATED CONTIKI MAIN SOURCE FILE'
|