Fix build on macOS and other non-GNU systems

This commit is contained in:
Přemysl Eric Janouch 2021-11-08 06:36:01 +01:00
parent 4598c45d2f
commit 6b871898d8
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 5 additions and 5 deletions

View File

@ -94,13 +94,13 @@ include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
set (actions ${PROJECT_BINARY_DIR}/nncmpp-actions.h) set (actions ${PROJECT_BINARY_DIR}/nncmpp-actions.h)
add_custom_command (OUTPUT ${actions} add_custom_command (OUTPUT ${actions}
COMMAND cpp -I${PROJECT_BINARY_DIR} -P ${PROJECT_SOURCE_DIR}/nncmpp.actions COMMAND cpp -I${PROJECT_BINARY_DIR} -P ${PROJECT_SOURCE_DIR}/nncmpp.actions
| grep . | tr [[\n]] [[\t]] | sed -ne [[y/\t/\n/]] > ${actions} | grep . | tr [[\n]] ^ | sed -ne [[h; s/,[^^]*/,/g]] -e [[s/$/COUNT/]]
-e [[h; s/,[^\n]*/,/g]] -e [[s/$/COUNT/]] -e [[s/[^^]*/\tACTION_&/g]] -e [[s/.*/enum action {\n&\n};\n/p]]
-e [[s/[^\n]*/\tACTION_&/g]] -e [[s/.*/enum action {\n&\n};\n/p]] -e [[g; s/,[^^]*//g; y/_/-/]] -e [[s/[^^]\{1,\}/\t"&",/g]]
-e [[g; s/,[^\n]*//g; y/_/-/]] -e [[s/[^\n]\{1,\}/\t"&",/g]]
-e [[s/.*/static const char *g_action_names[] = {\n&};\n/p]] -e [[s/.*/static const char *g_action_names[] = {\n&};\n/p]]
-e [[g; s/[^\n]*, //g;]] -e [[s/[^\n]\{1,\}/\t"&",/g]] -e [[g; s/[^^]*, *//g;]] -e [[s/[^^]\{1,\}/\t"&",/g]]
-e [[s/.*/static const char *g_action_descriptions[] = {\n&};/p]] -e [[s/.*/static const char *g_action_descriptions[] = {\n&};/p]]
| tr ^ [[\n]] > ${actions}
COMMAND test -s ${actions} COMMAND test -s ${actions}
DEPENDS ${PROJECT_BINARY_DIR}/config.h VERBATIM) DEPENDS ${PROJECT_BINARY_DIR}/config.h VERBATIM)