소스 검색

Cleaned up installion make rule using GNU conventions

Thomas Davis 12 년 전
부모
커밋
1bef635908
2개의 변경된 파일13개의 추가작업 그리고 5개의 파일을 삭제
  1. 12 4
      Makefile
  2. 1 1
      main.c

+ 12 - 4
Makefile

@@ -13,7 +13,15 @@ CPROG = civetweb
 #CXXPROG = civetweb
 
 BUILD_DIR = out
+
+# Installation directories by convention
+# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
 PREFIX = /usr/local
+EXEC_PREFIX = $(PREFIX)
+BINDIR = $(EXEC_PREFIX)/bin
+DATAROOTDIR = $(PREFIX)/share
+DOCDIR = $(DATAROOTDIR)/doc/$(CPROG)
+SYSCONFDIR = $(PREFIX)/etc
 
 BUILD_DIRS += $(BUILD_DIR)
 
@@ -121,10 +129,10 @@ build: $(CPROG) $(CXXPROG)
 
 install: build
 ifeq ($(TARGET_OS),LINUX)
-	install -Dm755 "$(CPROG)" "$(PREFIX)/usr/bin/$(CPROG)"
-	install -Dm644 "distribution/arch/$(CPROG).conf" "$(PREFIX)/etc/$(CPROG)/$(CPROG).conf"
-	install -d "$(PREFIX)/usr/share/$(CPROG)"
-	install -m644 "docs/UserManual.md" "README.md" "$(PREFIX)/usr/share/$(CPROG)"
+	install -d "$(BINDIR)" "$(DOCDIR)" "$(SYSCONFDIR)"
+	install -m 755 $(CPROG) "$(BINDIR)/"
+	install -m 644 distribution/arch/$(CPROG).conf  "$(SYSCONFDIR)/"
+	install -m 644 *.md "$(DOCDIR)"
 endif
 
 lib: lib$(CPROG).a

+ 1 - 1
main.c

@@ -78,7 +78,7 @@ static struct mg_context *ctx;      // Set by start_civetweb()
 
 // backup config file
 #if !defined(CONFIG_FILE2) && defined(LINUX)
-#define CONFIG_FILE2 "/etc/civetweb/civetweb.conf"
+#define CONFIG_FILE2 "/usr/local/etc/civetweb.conf"
 #endif
 
 static void WINCDECL signal_handler(int sig_num) {