Add WITH_WEBSERVER=<webserver> options
This commit is contained in:
parent
05c11d362b
commit
031c45994b
|
@ -5,16 +5,24 @@ CONTIKI=../../..
|
||||||
WITH_UIP6=1
|
WITH_UIP6=1
|
||||||
UIP_CONF_IPV6=1
|
UIP_CONF_IPV6=1
|
||||||
|
|
||||||
#Override inclusion of internal webserver with make WITH_WEBSERVER=0
|
|
||||||
WITH_WEBSERVER=1
|
|
||||||
|
|
||||||
ifeq ($(WITH_WEBSERVER), 0)
|
|
||||||
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
|
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
|
||||||
PROJECT_SOURCEFILES += slip-bridge.c
|
PROJECT_SOURCEFILES += slip-bridge.c
|
||||||
else
|
|
||||||
|
#Simple built-in webserver is the default.
|
||||||
|
#Override with make WITH_WEBSERVER=0 for no webserver.
|
||||||
|
#WITH_WEBSERVER=webserver-name will use /apps/webserver-name if it can be
|
||||||
|
#found in the /apps, /platform/$(TARGET)/apps/, or current directory (in that order).
|
||||||
|
# WITH_WEBSERVER=webserver for /apps/webserver
|
||||||
|
# WITH_WEBSERVER=raven-webserver for /platform/avr-raven/apps/raven-webserver/
|
||||||
|
#make clean before changing webservers!
|
||||||
|
WITH_WEBSERVER=1
|
||||||
|
ifeq ($(WITH_WEBSERVER),1)
|
||||||
|
CFLAGS += -DWEBSERVER=1
|
||||||
|
PROJECT_SOURCEFILES += httpd-simple.c
|
||||||
APPS += webserver
|
APPS += webserver
|
||||||
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" -DWEBSERVER
|
else ifneq ($(WITH_WEBSERVER), 0)
|
||||||
PROJECT_SOURCEFILES += slip-bridge.c httpd-simple.c
|
APPS += $(WITH_WEBSERVER)
|
||||||
|
CFLAGS += -DWEBSERVER=2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(CONTIKI)/Makefile.include
|
include $(CONTIKI)/Makefile.include
|
||||||
|
|
|
@ -69,11 +69,17 @@ static uip_ipaddr_t prefix;
|
||||||
static uint8_t prefix_set;
|
static uint8_t prefix_set;
|
||||||
|
|
||||||
PROCESS(border_router_process, "Border router process");
|
PROCESS(border_router_process, "Border router process");
|
||||||
AUTOSTART_PROCESSES(&border_router_process);
|
|
||||||
|
|
||||||
#if WEBSERVER
|
#if WEBSERVER==0
|
||||||
/*---------------------------------------------------------------------------*/
|
/* No webserver */
|
||||||
/* Only one single web request at time */
|
AUTOSTART_PROCESSES(&border_router_process);
|
||||||
|
#elif WEBSERVER>1
|
||||||
|
/* Use an external webserver process */
|
||||||
|
//PROCESS_NAME(webserver_nogui_process);
|
||||||
|
AUTOSTART_PROCESSES(&border_router_process,&webserver_nogui_process);
|
||||||
|
#else
|
||||||
|
AUTOSTART_PROCESSES(&border_router_process,&webserver_nogui_process);
|
||||||
|
/* Use simple webserver with only one page */
|
||||||
static const char *TOP = "<html><head><title>ContikiRPL</title></head><body>\n";
|
static const char *TOP = "<html><head><title>ContikiRPL</title></head><body>\n";
|
||||||
static const char *BOTTOM = "</body></html>\n";
|
static const char *BOTTOM = "</body></html>\n";
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
|
@ -212,10 +218,6 @@ PROCESS_THREAD(border_router_process, ev, data)
|
||||||
|
|
||||||
PROCESS_PAUSE();
|
PROCESS_PAUSE();
|
||||||
|
|
||||||
#if WEBSERVER
|
|
||||||
process_start(&webserver_nogui_process, NULL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SENSORS_ACTIVATE(button_sensor);
|
SENSORS_ACTIVATE(button_sensor);
|
||||||
|
|
||||||
PRINTF("RPL-Border router started\n");
|
PRINTF("RPL-Border router started\n");
|
||||||
|
|
|
@ -1,5 +1,29 @@
|
||||||
all: webserver6
|
all: webserver6 $(WITH_WEBSERVER)
|
||||||
|
|
||||||
|
ifeq ($(WITH_WEBSERVER),)
|
||||||
|
#
|
||||||
|
#Set default webserver for different platforms
|
||||||
|
#Although Makefile.include sets the default target, we need to know it now.
|
||||||
|
#
|
||||||
|
ifeq ($(TARGET),)
|
||||||
|
-include Makefile.target
|
||||||
|
endif
|
||||||
|
ifeq ($(TARGET),sky)
|
||||||
|
WITH_WEBSERVER=webserver-nano
|
||||||
|
else ifeq ($(TARGET),avr-raven)
|
||||||
|
WITH_WEBSERVER=raven-webserver
|
||||||
|
endif
|
||||||
|
#
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(WITH_WEBSERVER),)
|
||||||
|
APPS = $(WITH_WEBSERVER)
|
||||||
|
#copy output to e.g. webserver-nano.sky, raven-webserver.avr-raven
|
||||||
|
$(WITH_WEBSERVER) : webserver6
|
||||||
|
cp webserver6.$(TARGET) $(WITH_WEBSERVER).$(TARGET)
|
||||||
|
else
|
||||||
APPS=webserver
|
APPS=webserver
|
||||||
|
endif
|
||||||
|
|
||||||
UIP_CONF_IPV6=1
|
UIP_CONF_IPV6=1
|
||||||
DEFINES=WITH_UIP6
|
DEFINES=WITH_UIP6
|
||||||
|
|
|
@ -23,3 +23,8 @@ code as follows:
|
||||||
3ffe:0501:ffff:0100:0206:98ff:fe00:0232
|
3ffe:0501:ffff:0100:0206:98ff:fe00:0232
|
||||||
- Finally you can use 'wget http://[3ffe:0501:ffff:0100:0206:98ff:fe00:0232]'
|
- Finally you can use 'wget http://[3ffe:0501:ffff:0100:0206:98ff:fe00:0232]'
|
||||||
to get the web page (index.html file)
|
to get the web page (index.html file)
|
||||||
|
|
||||||
|
The default webserver and content is in /apps/webserver/...
|
||||||
|
Change that using e.g.
|
||||||
|
$make WITH_WEBSERVER=webserver-nano
|
||||||
|
$make TARGET=avr-raven WITH_WEBSERVER=raven-webserver
|
Loading…
Reference in a new issue