From ad871be01724cf9f554b902227b1f2ec76245d03 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Thu, 7 Mar 2024 00:27:37 +0300 Subject: [PATCH] Some work with templates - Now configure script also reads templates (files which end by .in) - So added template for config.mk - Moved templates to templates/ folder --- CMakeLists.txt | 5 ++++- configure | 11 ++--------- {include => templates}/config.h.in | 0 templates/config.mk.in | 4 ++++ 4 files changed, 10 insertions(+), 10 deletions(-) rename {include => templates}/config.h.in (100%) create mode 100644 templates/config.mk.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fcb071..a788479 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,4 +32,7 @@ set(DEFX 0 CACHE STRING "Start x") set(DEFY 0 CACHE STRING "Start y") set(SLEEP 1000 CACHE STRING "Sleep between frames (ms)") -configure_file(include/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/templates/config.h.in + ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h +) diff --git a/configure b/configure index 24a587a..a595cf5 100755 --- a/configure +++ b/configure @@ -45,12 +45,5 @@ echo "Start x: $DEFX" echo "Start y: $DEFY" echo "Sleep: $SLEEP" -echo "CC = $CC -CFLAGS = $CFLAGS -LDFLAGS = $LDFLAGS -OUT = $OUT" > config.mk - -echo "#define FIELD_SIZE $FIELD_SIZE -#define DEFX $DEFX -#define DEFY $DEFY -#define SLEEP $SLEEP" > include/config.h +eval "echo \"$(cat templates/config.mk.in)\"" > config.mk +eval "echo \"$(cat templates/config.h.in)\"" > include/config.h diff --git a/include/config.h.in b/templates/config.h.in similarity index 100% rename from include/config.h.in rename to templates/config.h.in diff --git a/templates/config.mk.in b/templates/config.mk.in new file mode 100644 index 0000000..4210e03 --- /dev/null +++ b/templates/config.mk.in @@ -0,0 +1,4 @@ +CC = ${CC} +CFLAGS = ${CFLAGS} +LDFLAGS = ${LDFLAGS} +OUT = ${OUT}