From b2536a3c7be7ae84068abedfe2aeef3f486a58c8 Mon Sep 17 00:00:00 2001 From: nishi Date: Sat, 11 May 2024 05:23:50 +0000 Subject: [PATCH] config gen git-svn-id: file:///raid/svn-main/nishi-mandshurica/trunk@86 f982e544-4a7d-3444-ad1a-fde59a2a69f1 --- GNUmakefile | 17 +++++++++++++---- Mandshurica/config.c | 2 +- build.sh | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index d9a084c..bc03387 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,15 +6,23 @@ PROJECT_PREFIX := $(PREFIX)/lib/mandshurica/project TOOL_PREFIX := $(PREFIX)/lib/mandshurica/tool DATABASE_PREFIX := $(PREFIX)/lib/mandshurica/db +.PHONY: all clean format replace ./Mandshurica ./Module ./Tool + +all: ./config.mk ./Mandshurica ./Module ./Tool + +./config.mk: + echo "PREFIX := $(PREFIX)" > $@ + echo "MODULE_PREFIX := $(MODULE_PREFIX)" >> $@ + echo "WEBROOT_PREFIX := $(WEBROOT_PREFIX)" >> $@ + echo "PROJECT_PREFIX := $(PROJECT_PREFIX)" >> $@ + echo "TOOL_PREFIX := $(TOOL_PREFIX)" >> $@ + echo "DATABASE_PREFIX := $(DATABASE_PREFIX)" >> $@ + CC := gcc CFLAGS := -g -std=c99 -DPREFIX=\\\"$(PREFIX)\\\" -DWEBROOT_PREFIX=\\\"$(WEBROOT_PREFIX)\\\" -DMODULE_PREFIX=\\\"$(MODULE_PREFIX)\\\" -DPROJECT_PREFIX=\\\"$(PROJECT_PREFIX)\\\" -DTOOL_PREFIX=\\\"$(TOOL_PREFIX)\\\" -DDATABASE_PREFIX=\\\"$(DATABASE_PREFIX)\\\" -D_DEFAULT_SOURCE LDFLAGS := LIBS := -.PHONY: all clean format replace ./Mandshurica ./Module ./Tool - -all: ./Mandshurica ./Module ./Tool - ./Mandshurica:: $(MAKE) -C $@ CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" @@ -57,3 +65,4 @@ clean: $(MAKE) -C ./Mandshurica clean $(MAKE) -C ./Module clean $(MAKE) -C ./Tool clean + rm -f ./config.mk diff --git a/Mandshurica/config.c b/Mandshurica/config.c index d54e48b..fb355da 100644 --- a/Mandshurica/config.c +++ b/Mandshurica/config.c @@ -217,7 +217,7 @@ int mandshurica_create_config(const char* path) { fprintf(f, "Set HTTPPort 1024\n"); fprintf(f, "Set HTTPRoot %s\n", WEBROOT_PREFIX); fprintf(f, "Set HTMLManage %s/html-manage\n", TOOL_PREFIX); - fprintf(f, "Set ProjectRoot %s\n", WEBROOT_PREFIX); + fprintf(f, "Set ProjectRoot %s\n", PROJECT_PREFIX); fprintf(f, "Set InstanceName Sumire\n"); fprintf(f, "\n"); fprintf(f, "Set HTTPMIME.html text/html\n"); diff --git a/build.sh b/build.sh index f66d8ec..103186f 100755 --- a/build.sh +++ b/build.sh @@ -9,10 +9,10 @@ fi EXITCODE=0 touch auth.db login.db project.db if [ "`uname -s`" = "NetBSD" ]; then - $MAKE PREFIX=`pwd` DATABASE_PREFIX=`pwd` MODULE_PREFIX=`pwd`/Module WEBROOT_PREFIX=`pwd`/Webroot PROJECTS_PREFIX=`pwd`/Projects TOOL_PREFIX=`pwd`/Tool -j`cat /proc/cpuinfo | grep proc | wc -l` + $MAKE PREFIX=`pwd` DATABASE_PREFIX=`pwd` MODULE_PREFIX=`pwd`/Module WEBROOT_PREFIX=`pwd`/Webroot PROJECT_PREFIX=`pwd`/Project TOOL_PREFIX=`pwd`/Tool -j`cat /proc/cpuinfo | grep proc | wc -l` EXITCODE=$? else - $MAKE PREFIX=`pwd` DATABASE_PREFIX=`pwd` MODULE_PREFIX=`pwd`/Module WEBROOT_PREFIX=`pwd`/Webroot PROJECTS_PREFIX=`pwd`/Projects TOOL_PREFIX=`pwd`/Tool -j`nproc` + $MAKE PREFIX=`pwd` DATABASE_PREFIX=`pwd` MODULE_PREFIX=`pwd`/Module WEBROOT_PREFIX=`pwd`/Webroot PROJECT_PREFIX=`pwd`/Project TOOL_PREFIX=`pwd`/Tool -j`nproc` EXITCODE=$? fi exit $EXITCODE -- 2.43.0