blob: 3e180b958507fd01bebda5a2cd164900e4c4e245 [file] [log] [blame]
# Copyright 2015 Big Switch Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DYNASM := ../dynasm
CFLAGS := -Wall -Werror -Iinc -I$(DYNASM) -O2 -g
LDLIBS := -lm
ifeq ($(COVERAGE),1)
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -fprofile-arcs
endif
ifeq ($(ASAN),1)
CFLAGS += -fsanitize=address
LDFLAGS += -fsanitize=address
endif
all: libubpf.a test
%.c: %.dasm minilua
LUA_PATH=$(DYNASM)/?.lua ./minilua $(DYNASM)/dynasm.lua -o $@ $<
ubpf_jit_x86_64.o: ubpf_jit_x86_64.c ubpf_jit_x86_64.h
libubpf.a: ubpf_vm.o ubpf_jit_x86_64.o ubpf_loader.o
ar rc $@ $^
test: test.o libubpf.a
minilua: ../luajit-2.0/src/host/minilua.c
$(CC) -o $@ $< -lm
clean:
rm -f test libubpf.a *.o ubpf_jit.c