标签:
Mongoose开源项目的主页是http://code.google.com/p/mongoose/。Mongoose是一个web服务器,通过提供一个web接口给它,它可以嵌入到现有的应用程序中去。Mongoose web服务器的执行是自满足的,它不依赖于任何其他服务。如果你将它复制到任何目录并执行,它将将启动web服务并将当前目录作为主目录、端口号是8080。当然这些配置选项都可以通过配置文件mongoose.conf设置。
Mongoose它的前身是shttpd,它完全开源和自由使用。
解压后,查看解压得到的文件如下:
如果需要支持交叉编译的话,Makefile说明很清楚,$(CC)就是需要的交叉编译工具连接,例如增加TI的交叉编译修改Makefile如下:
all:
@echo "make (linux|bsd|solaris|mac|windows|mingw|cygwin)" // 已经支持的交叉编译
# Make sure that the compiler flags come last in the compilation string.
# If not so, this can break some on some Linux distros which use
# "-Wl,--as-needed" turned on by default in cc command.
# Also, this is turned in many other distros in static linkage builds.
linux:
$(CC) mongoose.c main.c -o $(PROG) -ldl $(CFLAGS)
在文中21行加入交叉编译连接文件夹存储路径内容:
PROG = ../../bin/ConsoleWeb
CFLAGS = -std=c99 -O2 -W -Wall -pedantic -pthread $(COPT)
CSTOOL_DIR=/usr
CSTOOL_PREFIX=$(CSTOOL_DIR)/bin/arm-linux-gnueabihf-
CCOMP = $(CSTOOL_PREFIX)gcc
以及83行加入内容:
all:
@echo "make (linux|bsd|solaris|mac|windows|mingw|cygwin|ti)" // 已经支持的交叉编译
# Make sure that the compiler flags come last in the compilation string.
# If not so, this can break some on some Linux distros which use
# "-Wl,--as-needed" turned on by default in cc command.
# Also, this is turned in many other distros in static linkage builds.
linux:
$(CC) mongoose.c main.c -o $(PROG) -ldl $(CFLAGS)
ti: $(CCOMP) mongoose.c main.c -o $(PROG) -ldl $(CFLAGS)
保存退出,然后make clean && make ti 生成相应程序
完成后,放入板子中运行,监听端口8080:
标签:
原文地址:http://www.cnblogs.com/ws523910/p/4600693.html