forked from ephox-gcc-plugins/initify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (26 loc) · 1.18 KB
/
Makefile
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
32
33
34
CC := gcc
CXX := g++
GCCPLUGINS_DIR := $(shell $(CC) -print-file-name=plugin)
PLUGIN_FLAGS := -I$(GCCPLUGINS_DIR)/include -I$(GCCPLUGINS_DIR)/include/c-family #-Wno-unused-parameter -Wno-unused-variable #-fdump-passes
DESTDIR :=
LDFLAGS :=
PROG := initify_plugin.so
RM := rm
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
PLUGINCC := $(shell $(CONFIG_SHELL) gcc-plugin.sh "$(CC)" "$(CXX)" "$(CC)")
ifeq ($(PLUGINCC),$(CC))
PLUGIN_FLAGS += -std=gnu99 -O0
else
PLUGIN_FLAGS += -std=gnu++98 -fno-rtti -Wno-narrowing -Og
endif
PLUGIN_FLAGS += -fPIC -shared -ggdb -Wall -W -fvisibility=hidden
all: $(PROG)
$(PROG): initify_plugin.c
$(PLUGINCC) $(PLUGIN_FLAGS) -o $@ $^
run test: $(PROG)
$(CC) -fplugin=$(CURDIR)/$(PROG) -fplugin-arg-initify_plugin-search_init_exit_functions test.c -S -O2 -fdump-tree-all -fdump-ipa-all -fno-inline
$(CC) -fplugin=$(CURDIR)/$(PROG) -fplugin-arg-initify_plugin-verbose -fplugin-arg-initify_plugin-search_init_exit_functions test.c -o test -O2 -fdump-tree-all -fdump-ipa-all -fno-inline
clean:
$(RM) -f $(PROG) test test.c.* test.ltrans0.* test.wpa.* test_*.c.* test_* test.s