diff --git a/Makefile.include b/Makefile.include index 68cba85bb..e8251c921 100644 --- a/Makefile.include +++ b/Makefile.include @@ -1,3 +1,5 @@ +# -*- makefile -*- + ifndef CONTIKI ${error CONTIKI not defined! You must specify where CONTIKI resides} endif @@ -93,9 +95,9 @@ PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFI ifdef APPS APPDIRS += ${wildcard ${addprefix $(CONTIKI)/apps/, $(APPS)} \ - ${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(APPS)} \ - ${addprefix , $(APPS)}} - APPINCLUDES = ${foreach APP, $(APPS), ${wildcard \ + ${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(APPS)} \ + ${addprefix , $(APPS)}} + APPINCLUDES = ${foreach APP, $(APPS), ${wildcard ${foreach DIR, $(APPDIRS), $(DIR)/Makefile.$(APP)} \ $(CONTIKI)/apps/$(APP)/Makefile.$(APP) \ $(CONTIKI)/platform/$(TARGET)/apps/$(APP)/Makefile.$(APP) \ $(APP)/Makefile.$(APP)}} @@ -107,7 +109,7 @@ endif ### Include target makefile (TODO Unsafe?) -target_makefile := $(wildcard $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET)) +target_makefile := $(wildcard ${realpath $(CONTIKI)}/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)}) # Check if the target makefile exists, and create the object directory if necessary. ifeq ($(strip $(target_makefile)),) @@ -116,7 +118,10 @@ else ifeq (${wildcard $(OBJECTDIR)},) DUMMY := ${shell mkdir $(OBJECTDIR)} endif - include $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET) + ifneq (1, ${words $(target_makefile)}) + ${error More than one TARGET Makefile found: $(target_makefile)} + endif + include $(target_makefile) endif ### Forward comma-separated list of arbitrary defines to the compiler @@ -126,13 +131,13 @@ CFLAGS += ${addprefix -D,${subst $(COMMA), ,$(DEFINES)}} ### Setup directory search path for source and header files -CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \ +CONTIKI_TARGET_DIRS_CONCAT = ${addprefix ${dir $(target_makefile)}, \ $(CONTIKI_TARGET_DIRS)} CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI_CPU)/, \ $(CONTIKI_CPU_DIRS)} SOURCEDIRS = . $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \ - $(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(APPDIRS) + $(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(APPDIRS) ${dir $(target_makefile)} vpath %.c $(SOURCEDIRS) vpath %.S $(SOURCEDIRS) diff --git a/apps/webserver-nano/httpd-cgi.c b/apps/webserver-nano/httpd-cgi.c index fa72a6340..9d62bc5b9 100644 --- a/apps/webserver-nano/httpd-cgi.c +++ b/apps/webserver-nano/httpd-cgi.c @@ -259,12 +259,16 @@ PT_THREAD(header(struct httpd_state *s, char *ptr)) #endif /* WEBSERVER_CONF_HEADER */ #if WEBSERVER_CONF_FILESTATS -static char *thisfilename; //todo move to s->ptr /*---------------------------------------------------------------------------*/ static unsigned short generate_file_stats(void *arg) { + struct httpd_state *s = (struct httpd_state *)arg; +#if WEBSERVER_CONF_LOADTIME + static const char httpd_cgi_filestat1[] HTTPD_STRING_ATTR = "
This page has been sent %u times (%1u.%u sec)