diff --git a/platform/cooja/Makefile.cooja b/platform/cooja/Makefile.cooja index c98dff4fa..2f7aec67d 100644 --- a/platform/cooja/Makefile.cooja +++ b/platform/cooja/Makefile.cooja @@ -1,57 +1,13 @@ -## The COOJA Simulator - cooja platform makefile +# $Id: Makefile.cooja,v 1.3 2006/09/06 12:20:12 fros4943 Exp $ + +## The COOJA Simulator Contiki 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. +## 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 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) +### Check input COOJA parameters ifndef CONTIKI $(error CONTIKI not defined!) @@ -67,19 +23,25 @@ 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 -COOJA_DEV = $(patsubst $(COOJA)/dev/%.c,%.c,$(wildcard $(COOJA)/dev/*.c)) +COOJALIB = simEnvChange.c irq.c -COOJA_LIB = $(patsubst $(COOJA)/lib/%.c,%.c,$(wildcard $(COOJA)/lib/*.c)) - -COOJA_SYS = $(patsubst $(COOJA)/sys/%.c,%.c,$(wildcard $(COOJA)/sys/*.c)) +COOJAINTFS = beep.c button-sensor.c ip.c leds-arch.c moteid.c \ + pir-sensor.c radio-arch.c rs232.c vib-sensor.c simEnvChange.c \ + clock.c log.c CORE_FILES = random.c sensors.c leds.c serial.c +#COOJA_SYS = $(patsubst $(COOJA)/sys/%.c,%.c,$(wildcard $(COOJA)/sys/*.c)) +#COOJA_DEV = $(patsubst $(COOJA)/dev/%.c,%.c,$(wildcard $(COOJA)/dev/*.c)) +#COOJA_LIB = $(patsubst $(COOJA)/lib/%.c,%.c,$(wildcard $(COOJA)/lib/*.c)) +#COOJA_LIB = simEnvChange.c + CONTIKI_TARGET_SOURCEFILES = \ -$(COOJA_DEV) $(COOJA_LIB) $(COOJA_SYS) $(CORE_FILES) +$(COOJALIB) $(COOJAINTFS) $(CORE_FILES) $(PROJECT_SOURCEFILES) CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) @@ -88,12 +50,7 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) ### 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 +### Compiler arguments CFLAGSNO = -I. -I$(CONTIKI_CPU) \ $(EXTRA_CC_ARGS) \ -I$(COOJA) \ @@ -103,7 +60,6 @@ CFLAGSNO = -I. -I$(CONTIKI_CPU) \ CFLAGS = $(CFLAGSNO) ### Setup directory search path for source files - CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(COOJA)/, \ $(CONTIKI_TARGET_DIRS)} @@ -111,10 +67,9 @@ vpath %.c $(PROJECTDIRS) \ $(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \ $(CONTIKI_CPU) +### Define custom targets $(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'