Merge pull request #1731 from rofl0r/paths_as_strings

build: properly quote strings passed as cpp macros
This commit is contained in:
Bob Andrews
2022-04-26 12:26:12 +02:00
committed by GitHub
7 changed files with 10 additions and 14 deletions

View File

@@ -68,9 +68,9 @@ $(info BUILD_ID: $(BUILD_ID))
CFLAGS += -MMD -MP -O3 -I common \ CFLAGS += -MMD -MP -O3 -I common \
-Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \ -Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
-DCA65_INC="$(CA65_INC)" -DCC65_INC="$(CC65_INC)" -DCL65_TGT="$(CL65_TGT)" \ -DCA65_INC="\"$(CA65_INC)\"" -DCC65_INC="\"$(CC65_INC)\"" -DCL65_TGT="\"$(CL65_TGT)\"" \
-DLD65_LIB="$(LD65_LIB)" -DLD65_OBJ="$(LD65_OBJ)" -DLD65_CFG="$(LD65_CFG)" \ -DLD65_LIB="\"$(LD65_LIB)\"" -DLD65_OBJ="\"$(LD65_OBJ)\"" -DLD65_CFG="\"$(LD65_CFG)\"" \
-DBUILD_ID="$(BUILD_ID)" -DBUILD_ID="\"$(BUILD_ID)\""
LDLIBS += -lm LDLIBS += -lm

View File

@@ -76,7 +76,7 @@ void FinishIncludePaths (void)
/* Add some compiled-in search paths if defined at compile time. */ /* Add some compiled-in search paths if defined at compile time. */
#if defined(CA65_INC) && !defined(_WIN32) #if defined(CA65_INC) && !defined(_WIN32)
AddSearchPath (IncSearchPath, STRINGIZE (CA65_INC)); AddSearchPath (IncSearchPath, CA65_INC);
#endif #endif
/* Add paths relative to the parent directory of the Windows binary. */ /* Add paths relative to the parent directory of the Windows binary. */

View File

@@ -77,7 +77,7 @@ void FinishIncludePaths (void)
/* Add some compiled-in search paths if defined at compile time. */ /* Add some compiled-in search paths if defined at compile time. */
#if defined(CC65_INC) && !defined(_WIN32) #if defined(CC65_INC) && !defined(_WIN32)
AddSearchPath (SysIncSearchPath, STRINGIZE (CC65_INC)); AddSearchPath (SysIncSearchPath, CC65_INC);
#endif #endif
/* Add paths relative to the parent directory of the Windows binary. */ /* Add paths relative to the parent directory of the Windows binary. */

View File

@@ -1216,7 +1216,7 @@ static void OptPrintTargetPath (const char* Opt attribute ((unused)),
SearchPaths* TargetPaths = NewSearchPath (); SearchPaths* TargetPaths = NewSearchPath ();
AddSubSearchPathFromEnv (TargetPaths, "CC65_HOME", "target"); AddSubSearchPathFromEnv (TargetPaths, "CC65_HOME", "target");
#if defined(CL65_TGT) && !defined(_WIN32) #if defined(CL65_TGT) && !defined(_WIN32)
AddSearchPath (TargetPaths, STRINGIZE (CL65_TGT)); AddSearchPath (TargetPaths, CL65_TGT);
#endif #endif
AddSubSearchPathFromWinBin (TargetPaths, "target"); AddSubSearchPathFromWinBin (TargetPaths, "target");

View File

@@ -48,10 +48,6 @@
/* Convert argument to C string */
#define _STRINGIZE(arg) #arg
#define STRINGIZE(arg) _STRINGIZE(arg)
/* A search path is a pointer to the list */ /* A search path is a pointer to the list */
typedef struct Collection SearchPaths; typedef struct Collection SearchPaths;

View File

@@ -62,7 +62,7 @@ const char* GetVersionAsString (void)
{ {
static char Buf[60]; static char Buf[60];
#if defined(BUILD_ID) #if defined(BUILD_ID)
xsnprintf (Buf, sizeof (Buf), "%u.%u - %s", VER_MAJOR, VER_MINOR, STRINGIZE (BUILD_ID)); xsnprintf (Buf, sizeof (Buf), "%u.%u - %s", VER_MAJOR, VER_MINOR, BUILD_ID);
#else #else
xsnprintf (Buf, sizeof (Buf), "%u.%u", VER_MAJOR, VER_MINOR); xsnprintf (Buf, sizeof (Buf), "%u.%u", VER_MAJOR, VER_MINOR);
#endif #endif

View File

@@ -89,13 +89,13 @@ void InitSearchPaths (void)
/* Add some compiled-in search paths if defined at compile time. */ /* Add some compiled-in search paths if defined at compile time. */
#if defined(LD65_LIB) && !defined(_WIN32) #if defined(LD65_LIB) && !defined(_WIN32)
AddSearchPath (LibDefaultPath, STRINGIZE (LD65_LIB)); AddSearchPath (LibDefaultPath, LD65_LIB);
#endif #endif
#if defined(LD65_OBJ) && !defined(_WIN32) #if defined(LD65_OBJ) && !defined(_WIN32)
AddSearchPath (ObjDefaultPath, STRINGIZE (LD65_OBJ)); AddSearchPath (ObjDefaultPath, LD65_OBJ);
#endif #endif
#if defined(LD65_CFG) && !defined(_WIN32) #if defined(LD65_CFG) && !defined(_WIN32)
AddSearchPath (CfgDefaultPath, STRINGIZE (LD65_CFG)); AddSearchPath (CfgDefaultPath, LD65_CFG);
#endif #endif
/* Add paths relative to the parent directory of the Windows binary. */ /* Add paths relative to the parent directory of the Windows binary. */