Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame^] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Daniel Borkmann | e306e2c | 2013-03-20 12:11:47 +0000 | [diff] [blame] | 2 | prefix = /usr |
| 3 | |
| 4 | CC = gcc |
Daniel Borkmann | 3f35638 | 2013-12-11 23:43:44 +0100 | [diff] [blame] | 5 | LEX = flex |
| 6 | YACC = bison |
Daniel Borkmann | e306e2c | 2013-03-20 12:11:47 +0000 | [diff] [blame] | 7 | |
Kamal Mostafa | d7475de | 2015-11-11 14:24:27 -0800 | [diff] [blame] | 8 | CFLAGS += -Wall -O2 |
| 9 | CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include |
| 10 | |
Daniel Borkmann | 3f35638 | 2013-12-11 23:43:44 +0100 | [diff] [blame] | 11 | %.yacc.c: %.y |
| 12 | $(YACC) -o $@ -d $< |
| 13 | |
| 14 | %.lex.c: %.l |
| 15 | $(LEX) -o $@ $< |
| 16 | |
| 17 | all : bpf_jit_disasm bpf_dbg bpf_asm |
Daniel Borkmann | e306e2c | 2013-03-20 12:11:47 +0000 | [diff] [blame] | 18 | |
Kamal Mostafa | d7475de | 2015-11-11 14:24:27 -0800 | [diff] [blame] | 19 | bpf_jit_disasm : CFLAGS += -DPACKAGE='bpf_jit_disasm' |
Daniel Borkmann | e306e2c | 2013-03-20 12:11:47 +0000 | [diff] [blame] | 20 | bpf_jit_disasm : LDLIBS = -lopcodes -lbfd -ldl |
| 21 | bpf_jit_disasm : bpf_jit_disasm.o |
| 22 | |
Daniel Borkmann | fd981e3 | 2013-12-11 23:43:43 +0100 | [diff] [blame] | 23 | bpf_dbg : LDLIBS = -lreadline |
| 24 | bpf_dbg : bpf_dbg.o |
| 25 | |
Daniel Borkmann | 3f35638 | 2013-12-11 23:43:44 +0100 | [diff] [blame] | 26 | bpf_asm : LDLIBS = |
| 27 | bpf_asm : bpf_asm.o bpf_exp.yacc.o bpf_exp.lex.o |
| 28 | bpf_exp.lex.o : bpf_exp.yacc.c |
| 29 | |
Daniel Borkmann | e306e2c | 2013-03-20 12:11:47 +0000 | [diff] [blame] | 30 | clean : |
Daniel Borkmann | 3f35638 | 2013-12-11 23:43:44 +0100 | [diff] [blame] | 31 | rm -rf *.o bpf_jit_disasm bpf_dbg bpf_asm bpf_exp.yacc.* bpf_exp.lex.* |
Daniel Borkmann | e306e2c | 2013-03-20 12:11:47 +0000 | [diff] [blame] | 32 | |
| 33 | install : |
| 34 | install bpf_jit_disasm $(prefix)/bin/bpf_jit_disasm |
Daniel Borkmann | fd981e3 | 2013-12-11 23:43:43 +0100 | [diff] [blame] | 35 | install bpf_dbg $(prefix)/bin/bpf_dbg |
Daniel Borkmann | 3f35638 | 2013-12-11 23:43:44 +0100 | [diff] [blame] | 36 | install bpf_asm $(prefix)/bin/bpf_asm |