-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (22 loc) · 671 Bytes
/
Makefile
File metadata and controls
31 lines (22 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
PLUGIN = struct_layout.so
ifeq ($(DEBUG),1)
CFLAGS_DEBUG = -g
else
CFLAGS_DEBUG = -O2 -DNDEBUG
endif
all: $(PLUGIN)
$(PLUGIN): gcc_plugin/struct_layout.c
$(CXX) $(CFLAGS_DEBUG) -Wall -Werror -I`$(CC) -print-file-name=plugin`/include -fpic -shared -o $@ $<
run: $(PLUGIN) tests/test_struct.c
$(CC) -fplugin=./$(PLUGIN) -fplugin-arg-struct_layout-output=layout.txt -fplugin-arg-struct_layout-struct=test_struct tests/test_struct.c -c
@echo
@cat layout.txt
all.py: linux/include_all.c all
KDIR=$(KDIR) python3 linux/dump_structs.py $@
linux_all: all.py
test: $(PLUGIN)
python3 -m pytest -v tests
clean:
rm -f $(PLUGIN) all.py
format:
python3 -m ruff format