Skip to content

Commit

Permalink
Make the CI actually work (facebook#1)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#1

- add CI badge to the README
- do not hardcode the compiler and the compiler flags
- fix link flags

Reviewed By: kernelslacker

Differential Revision: D31489684

fbshipit-source-id: c0c983545bcb102d22e8d091126f526bca77c239
  • Loading branch information
davide125 authored and facebook-github-bot committed Oct 7, 2021
1 parent 8ad824b commit cb8df2a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 $@
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
11 changes: 6 additions & 5 deletions modules/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions ncrx/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 5 additions & 3 deletions util/Makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cb8df2a

Please sign in to comment.