瀏覽代碼

Update default projects/Makefiles to build without SSL more easy

While CMAKE has options to build without SSL, this option is only indirectly
accessible using the (older) default Makefiles.
bel2125 5 年之前
父節點
當前提交
e23a15e623
共有 5 個文件被更改,包括 38 次插入9 次删除
  1. 2 1
      .gitignore
  2. 15 0
      Makefile
  3. 1 1
      VisualStudio/ex_embedded_c/ex_embedded_c.vcxproj
  4. 18 5
      examples/embedded_c/Makefile
  5. 2 2
      unittest/public_server.c

+ 2 - 1
.gitignore

@@ -13,7 +13,8 @@ out
 *.trace
 [oO]utput
 [tT]esting
-
+examples/embedded_c/embedded_c
+*.a
 *.o
 
 ################# //hash

+ 15 - 0
Makefile

@@ -75,6 +75,17 @@ else
   CFLAGS += -O2 -DNDEBUG
 endif
 
+ifdef NO_SSL
+  CFLAGS += -DNO_SSL
+endif
+ifdef NO_CGI
+  CFLAGS += -DNO_CGI
+endif
+ifdef NO_CACHING
+  CFLAGS += -DNO_CACHING
+endif
+
+
 ifdef WITH_CPP
   OBJECTS += src/CivetServer.o
   HEADERS += include/CivetServer.h
@@ -245,6 +256,9 @@ help:
 	@echo "   WITH_CPP=1            build library with c++ classes"
 	@echo "   WITH_EXPERIMENTAL=1   build with experimental features"
 	@echo "   WITH_DAEMONIZE=1      build with daemonize."
+	@echo "   NO_SSL=1              build without SSL support. Build will not need libcrypto/libssl."
+	@echo "   NO_CGI=1              build without CGI support."
+	@echo "   NO_CACHING=1          disable caching. Send no-cache/no-store headers."
 	@echo "   PID_FILE=/path        PID file path of daemon."
 	@echo "   CONFIG_FILE=file      use 'file' as the config file"
 	@echo "   CONFIG_FILE2=file     use 'file' as the backup config file"
@@ -271,6 +285,7 @@ help:
 	@echo "   LDFLAGS='$(LDFLAGS)'"
 	@echo "   CC='$(CC)'"
 	@echo "   CXX='$(CXX)'"
+	@echo ""
 
 build: $(CPROG) $(CXXPROG)
 

+ 1 - 1
VisualStudio/ex_embedded_c/ex_embedded_c.vcxproj

@@ -96,7 +96,7 @@
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>USE_IPV6;USE_WEBSOCKET;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>NO_SSL;USE_IPV6;USE_WEBSOCKET;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>$(ProjectDir)..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>

+ 18 - 5
examples/embedded_c/Makefile

@@ -1,10 +1,8 @@
-# 
+#
 # Copyright (c) 2013 No Face Press, LLC
 # License http://opensource.org/licenses/mit-license.php MIT License
 #
 
-#This makefile is used to test the other Makefiles
-
 
 PROG = embedded_c
 SRC = embedded_c.c
@@ -15,12 +13,18 @@ CIVETWEB_LIB = libcivetweb.a
 CFLAGS = -I$(TOP)/include $(COPT) -DUSE_WEBSOCKET -DUSE_IPV6
 LIBS = -lpthread
 
+ifdef NO_SSL
+  CFLAGS += -DNO_SSL
+endif
+
+
 include $(TOP)/resources/Makefile.in-os
 
-ifeq ($(TARGET_OS),LINUX) 
+ifeq ($(TARGET_OS),LINUX)
 	LIBS += -ldl -lrt
 endif
 
+
 all: $(PROG)
 
 $(PROG): $(CIVETWEB_LIB) $(SRC)
@@ -33,5 +37,14 @@ $(CIVETWEB_LIB):
 clean:
 	rm -f $(CIVETWEB_LIB) $(PROG)
 
-.PHONY: all clean
+help:
+	@echo "make help                show this message"
+	@echo "make clean               remove result"
+	@echo "make all                 build all"
+	@echo "make                     build all"
+	@echo ""
+	@echo " Make Options:"
+	@echo "   NO_SSL=1              build without SSL support"
+	@echo ""
 
+.PHONY: all clean

+ 2 - 2
unittest/public_server.c

@@ -4860,7 +4860,7 @@ static int
 minimal_test_request_handler(struct mg_connection *conn, void *cbdata)
 {
 	const char *msg = (const char *)cbdata;
-	unsigned long len = (unsigned long)strlen(msg)+1;
+	unsigned long len = (unsigned long)strlen(msg) + 1;
 	const struct mg_request_info *ri = mg_get_request_info(conn);
 
 	ck_assert(conn != NULL);
@@ -4877,7 +4877,7 @@ minimal_test_request_handler(struct mg_connection *conn, void *cbdata)
 
 	if (ri->query_string != NULL) {
 		msg = ri->query_string;
-		len = (unsigned long)strlen(msg)+1;
+		len = (unsigned long)strlen(msg) + 1;
 	}
 
 	mg_printf(conn,