-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add makefile and resolve PR comments
- Loading branch information
Ubuntu
committed
Jun 15, 2022
1 parent
ee28577
commit 7cb88d7
Showing
11 changed files
with
262 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
RM := rm -rf | ||
EVENTD_TARGET := eventd | ||
EVENTD_TEST := tests/tests | ||
EVENTD_TOOL := tools/events_tool | ||
RSYSLOG-PLUGIN_TARGET := rsyslog_plugin | ||
RSYSLOG-PLUGIN_TEST: rsyslog_plugin_tests/tests | ||
CP := cp | ||
MKDIR := mkdir | ||
CC := g++ | ||
MV := mv | ||
LIBS := -levent -lhiredis -lswsscommon -lpthread -lboost_thread -lboost_system -lzmq -lboost_serialization -luuid | ||
TEST_LIBS := -L/usr/src/gtest -lgtest -lgtest_main -lgmock -lgmock_main | ||
|
||
CFLAGS += -Wall -std=c++17 -fPIE -I$(PWD)/../sonic-swss-common/common | ||
PWD := $(shell pwd) | ||
|
||
ifneq ($(MAKECMDGOALS),clean) | ||
ifneq ($(strip $(C_DEPS)),) | ||
-include $(C_DEPS) $(OBJS) | ||
endif | ||
endif | ||
|
||
-include src/subdir.mk | ||
-include tests/subdir.mk | ||
-include tools/subdir.mk | ||
-include rsyslog_plugin/subdir.mk | ||
|
||
all: sonic-eventd eventd-tests eventd-tool rsyslog-plugin rsyslog-plugin-tests | ||
|
||
sonic-eventd: $(OBJS) | ||
@echo 'Building target: $@' | ||
@echo 'Invoking: G++ Linker' | ||
$(CC) $(LDFLAGS) -o $(EVENTD_TARGET) $(OBJS) $(LIBS) | ||
@echo 'Finished building target: $@' | ||
@echo ' ' | ||
|
||
eventd-tool: $(TOOL_OBJS) | ||
@echo 'Building target: $@' | ||
@echo 'Invoking: G++ Linker' | ||
$(CC) $(LDFLAGS) -o $(EVENTD_TOOL) $(TOOL_OBJS) $(LIBS) | ||
@echo 'Finished building target: $@' | ||
@echo ' ' | ||
|
||
rsyslog-plugin: $(RSYSLOG-PLUGIN_OBJS) | ||
@echo 'Buidling Target: $@' | ||
@echo 'Invoking: G++ Linker' | ||
$(CC) $(LDFLAGS) -o $(RSYSLOG-PLUGIN_TARGET) $(RSYSLOG-PLUGIN_OBJS) $(LIBS) | ||
@echo 'Finished building target: $@' | ||
@echo ' ' | ||
|
||
eventd-tests: $(TEST_OBJS) | ||
@echo 'Building target: $@' | ||
@echo 'Invoking: G++ Linker' | ||
$(CC) $(LDFLAGS) -o $(EVENTD_TEST) $(TEST_OBJS) $(LIBS) $(TEST_LIBS) | ||
@echo 'Finished building target: $@' | ||
$(EVENTD_TEST) | ||
@echo 'Finished running tests' | ||
@echo ' ' | ||
|
||
rsyslog-plugin-tests: $(RSYSLOG-PLUGIN-TEST_OBJS) | ||
@echo 'BUILDING target: $@' | ||
@echo 'Invoking G++ Linker' | ||
$(CC) $(LDFLAGS) -o $(RSYSLOG-PLUGIN_TEST) $(RSYSLOG-PLUGIN-TEST_OBJS) $(LIBS) $(TEST_LIBS) | ||
@echo 'Finished building target: $@' | ||
$(RSYSLOG-PLUGIN_TEST) | ||
@echo 'Finished running tests' | ||
@echo ' ' | ||
|
||
install: | ||
$(MKDIR) -p $(DESTDIR)/usr/sbin | ||
$(MV) $(EVENTD_TARGET) $(DESTDIR)/usr/sbin | ||
$(MV) $(EVENTD_TOOL) $(DESTDIR)/usr/sbin | ||
$(MV) $(RSYSLOG-PLUGIN_TARGET) $(DESTDIR)/usr/sbin | ||
|
||
deinstall: | ||
$(RM) $(DESTDIR)/usr/sbin/$(EVENTD_TARGET) | ||
$(RM) $(DESTDIR)/usr/sbin/$(RSYSLOG-PLUGIN_TARGET) | ||
$(RM) -rf $(DESTDIR)/usr/sbin | ||
|
||
clean: | ||
-@echo ' ' | ||
|
||
.PHONY: all clean dependents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CC := g++ | ||
|
||
RSYSLOG-PLUGIN_TEST_OBJS += ./rsyslog_plugin/rsyslog_plugin.o ./rsyslog_plugin/syslog_parser.o | ||
RSYSLOG-PLUGIN_OBJS += ./rsyslog_plugin/rsyslog_plugin.o ./rsyslog_plugin/syslog_parser.o ./rsyslog_plugin/main.o | ||
|
||
C_DEPS += ./rsyslog_plugin/rsyslog_plugin.d ./rsyslog_plugin/syslog_parser.d ./rsyslog_plugin/main.d | ||
|
||
rsyslog_plugin/%.o: rsyslog_plugin/%.cpp | ||
@echo 'Building file: $<' | ||
@echo 'Invoking: GCC C++ Compiler' | ||
$(CC) -D__FILENAME__="$(subst rsyslog_plugin/,,$<)" $(CFLAGS) -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$(@)" "$<" | ||
@echo 'Finished building: $< | ||
'@echo ' ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.