diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e809b9a..286aa99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,18 @@ on: pull_request: jobs: build: + name: Build netconsd runs-on: ubuntu-latest + strategy: + matrix: + include: + - cc: gcc + cxx: g++ + - cc: clang + cxx: clang++ + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/Makefile b/Makefile index a3b0c3e..1ff638b 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ -CC = gcc +CC ?= gcc -export LDFLAGS = -lpthread -lrt -ldl -export CFLAGS = -O2 -D_GNU_SOURCE -fno-strict-aliasing -Wall -Wextra \ - -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \ +LDFLAGS ?= -shared +LIBS = -lpthread -lrt -ldl +CFLAGS ?= -O2 -fPIC +CFLAGS += -D_GNU_SOURCE -fno-strict-aliasing -Wall -Wextra \ + -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \ -Wdeclaration-after-statement -Wno-missing-field-initializers \ -Wno-unused-parameter INCLUDES = -Incrx @@ -31,7 +33,7 @@ disasm: $(asm) -include $(obj:.o=.d) $(binary): $(lib) $(obj) - $(CC) $(LDFLAGS) $(lib) $(obj) -o $@ + $(CC) $(LDFLAGS) $(LIBS) $(lib) $(obj) -o $@ %.o: %.c $(CC) $< $(CFLAGS) $(INCLUDES) -c -o $@ diff --git a/README.md b/README.md index 0a54f20..89931d4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Netconsd: The Netconsole Daemon +[![Continuous Integration](https://github.com/facebook/netconsd/workflows/Continuous%20Integration/badge.svg?event=push)](https://github.com/facebook/netconsd/actions?query=workflow%3A%22Continuous+Integration%22) + This is a daemon for receiving and processing logs from the Linux Kernel, as emitted over a network by the kernel's netconsole module. It supports both the old "legacy" text-only format, and the new extended format added in v4.4. diff --git a/modules/Makefile b/modules/Makefile index d10d4d0..64a0182 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -1,5 +1,6 @@ -CC = gcc -CCC = g++ +CC ?= gcc +CXX ?= g++ +LDFLAGS ?= -shared -static-libstdc++ -static-libgcc override CFLAGS += -fPIC INCLUDES = -I../ncrx -I../include @@ -14,11 +15,11 @@ all: $(mods) %.so: %.c $(CC) $< $(CFLAGS) $(INCLUDES) $(LDFLAGS) -c -o $(<:.c=.o) - $(CC) $(<:.c=.o) $(LDFLAGS) -shared -o $@ + $(CC) $(<:.c=.o) $(LDFLAGS) -o $@ %.so: %.cc - $(CCC) $< $(CCFLAGS) $(INCLUDES) $(LDFLAGS) -c -o $(<:.cc=.o) - $(CCC) $(<:.cc=.o) $(LDFLAGS) -shared -static-libstdc++ -static-libgcc \ + $(CXX) $< $(CCFLAGS) $(INCLUDES) $(LDFLAGS) -c -o $(<:.cc=.o) + $(CXX) $(<:.cc=.o) $(LDFLAGS) \ -o $@ clean: diff --git a/ncrx/Makefile b/ncrx/Makefile index 4a928fc..6fe51fc 100644 --- a/ncrx/Makefile +++ b/ncrx/Makefile @@ -1,6 +1,7 @@ -CC = gcc +CC ?= gcc -CFLAGS = -O2 -D_GNU_SOURCE -fno-strict-aliasing -Wall -Wextra \ +CFLAGS ?= -O2 -fPIC +CFLAGS += -D_GNU_SOURCE -fno-strict-aliasing -Wall -Wextra \ -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \ -Wdeclaration-after-statement -Wno-missing-field-initializers \ -Wno-unused-function -Wno-unused-parameter diff --git a/util/Makefile b/util/Makefile index 9a590ac..67c67a4 100644 --- a/util/Makefile +++ b/util/Makefile @@ -1,7 +1,9 @@ -CFLAGS = -D_GNU_SOURCE -LDFLAGS = -lpthread +CFLAGS ?= -O2 -fPIC +CFLAGS += -D_GNU_SOURCE +LDFLAGS ?= -shared +LIBS = -lpthread all: netconsblaster netconsblaster: - $(CC) $(LDFLAGS) $(CFLAGS) netconsblaster.c -o netconsblaster + $(CC) $(LDFLAGS) $(CFLAGS) netconsblaster.c $(LIBS) -o netconsblaster