Commit 47fd7b08 authored by Baptiste Jonglez's avatar Baptiste Jonglez
Browse files

Ship pre-built messages.{cc,h} to avoid build dependency on kea-msg-compiler

parent d1343243
......@@ -3,6 +3,3 @@
*.so
*~
*.tar.gz
s-messages
src/messages.cc
src/messages.h
......@@ -10,18 +10,15 @@ LDFLAGS = -L $(KEA_LIB) -shared -lkea-dhcpsrv -lkea-dhcp++ -lkea-hooks -lkea-log
kea-hook-runscript.so: $(OBJECTS)
$(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $(OBJECTS)
%.o: %.cc src/messages.h src/messages.mes
%.o: %.cc
$(CXX) -c $(CXXFLAGS) -o $@ $<
# Compile messages (for logging)
# Both .h and .cc are generated by kea-msg-compiler, but this
# can't be expressed directly in a Makefile.
src/messages.h: src/messages.cc
src/messages.cc: src/messages.mes
# Compile logging messages, generates messages.h and messages.cc.
# Only needs to be done when changing messages.mes.
# You need to build kea with `./configure --enable-generate-messages` to obtain `kea-msg-compiler`
build-messages: src/messages.mes
$(KEA_MSG_COMPILER) -d src/ $<
clean:
rm -f src/*.o
rm -f src/messages.h src/messages.cc
rm -f kea-hook-runscript.so
// File created from src/messages.mes
#include <cstddef>
#include <log/message_types.h>
#include <log/message_initializer.h>
extern const isc::log::MessageID RUNSCRIPT_EXEC_FAILED = "RUNSCRIPT_EXEC_FAILED";
extern const isc::log::MessageID RUNSCRIPT_FORK_FAILED = "RUNSCRIPT_FORK_FAILED";
extern const isc::log::MessageID RUNSCRIPT_MISSING_PARAM = "RUNSCRIPT_MISSING_PARAM";
extern const isc::log::MessageID RUNSCRIPT_MISTYPED_PARAM = "RUNSCRIPT_MISTYPED_PARAM";
extern const isc::log::MessageID RUNSCRIPT_WAITING_SCRIPT = "RUNSCRIPT_WAITING_SCRIPT";
extern const isc::log::MessageID RUNSCRIPT_WAITPID_FAILED = "RUNSCRIPT_WAITPID_FAILED";
namespace {
const char* values[] = {
"RUNSCRIPT_EXEC_FAILED", "exec() failed, please check that the script exists and is executable. Error: %1",
"RUNSCRIPT_FORK_FAILED", "fork() failed with error: %1",
"RUNSCRIPT_MISSING_PARAM", "required parameter \"%1\" missing in configuration",
"RUNSCRIPT_MISTYPED_PARAM", "parameter \"%1\" in configuration has wrong type",
"RUNSCRIPT_WAITING_SCRIPT", "the user-defined script is running, and the main process is currently waiting",
"RUNSCRIPT_WAITPID_FAILED", "waitpid() failed with error: %1",
NULL
};
const isc::log::MessageInitializer initializer(values);
} // Anonymous namespace
// File created from src/messages.mes
#ifndef MESSAGES_H
#define MESSAGES_H
#include <log/message_types.h>
extern const isc::log::MessageID RUNSCRIPT_EXEC_FAILED;
extern const isc::log::MessageID RUNSCRIPT_FORK_FAILED;
extern const isc::log::MessageID RUNSCRIPT_MISSING_PARAM;
extern const isc::log::MessageID RUNSCRIPT_MISTYPED_PARAM;
extern const isc::log::MessageID RUNSCRIPT_WAITING_SCRIPT;
extern const isc::log::MessageID RUNSCRIPT_WAITPID_FAILED;
#endif // MESSAGES_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment