add a simple Makefile to build and clean up

add missing macros, static inline functions, etc.
add README to illustrate the purpose of this repo.

Signed-off-by: Yonghong Song <yhs@fb.com>
This commit is contained in:
Yonghong Song
2018-10-09 21:45:49 -07:00
parent 66684189f0
commit 8acf2635c3
8 changed files with 189 additions and 150 deletions

23
src/Makefile Normal file
View File

@@ -0,0 +1,23 @@
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
TOPDIR = ..
INCLUDES = -I. -I$(TOPDIR)/include -I$(TOPDIR)/include/uapi
CFLAGS = $(INCLUDES) -O2 -Werror -Wall
FEATURE_REALLOCARRAY := $(shell $(TOPDIR)/scripts/check-reallocarray.sh)
ifneq ($(FEATURE_REALLOCARRAY),)
CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
endif
OBJFILES = bpf.o btf.o libbpf.o libbpf_errno.o netlink.o nlattr.o str_error.o
all: libbpf.a
libbpf.a: $(OBJFILES)
/bin/rm -f $@; /bin/ar rcs $@ $^
%.o: %.c
gcc $(CFLAGS) -c $< -o $@
clean:
/bin/rm -f libbpf.a $(OBJFILES)