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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
diff --git a/Makefile b/Makefile
index 887ffea..4c28b2f 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ COREFREQ_MINOR = 98
COREFREQ_REV = 5
HW = $(shell uname -m)
CC ?= cc
-WARNING = -Wall -Wfatal-errors
+WARNING = -w
SYMLINK ?= ln -s
INSTALL ?= install
DEPMOD ?= depmod
@@ -55,14 +55,18 @@ ccflags-y += -D COREFREQ_MAJOR=$(COREFREQ_MAJOR) \
ccflags-y += $(WARNING)
ifeq ($(OPTIM_LVL),0)
-OPTIM_FLG = -O$(OPTIM_LVL)
+CFLAGS += -O$(OPTIM_LVL)
+LDFLAGS += -O$(OPTIM_LVL)
ccflags-y += -fno-inline
else ifneq ($(OPTIM_LVL),)
-OPTIM_FLG = -O$(OPTIM_LVL)
+CFLAGS += -O$(OPTIM_LVL)
+LDFLAGS += -O$(OPTIM_LVL)
ccflags-y += -D OPTIM_LVL=$(OPTIM_LVL)
-ccflags-y += $(OPTIM_FLG)
+ccflags-y += $(OPTIM_LVL)
endif
+CFLAGS += $(WARNING)
+
DEFINITIONS = -D COREFREQ_MAJOR=$(COREFREQ_MAJOR) \
-D COREFREQ_MINOR=$(COREFREQ_MINOR) \
-D COREFREQ_REV=$(COREFREQ_REV) \
@@ -249,17 +253,17 @@ clean:
$(BUILD)/corefreqm.o: $(HW)/corefreqm.c
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " CC [$@]"; fi; \
- $(CC)) $(OPTIM_FLG) $(WARNING) -pthread $(DEFINITIONS) \
- -c $(HW)/corefreqm.c -o $(BUILD)/corefreqm.o
+ $(CC)) -c $(HW)/corefreqm.c -o $(BUILD)/corefreqm.o \
+ $(CFLAGS) $(DEFINITIONS) -pthread
$(BUILD)/corefreqd.o: $(HW)/corefreqd.c
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " CC [$@]"; fi; \
- $(CC)) $(OPTIM_FLG) $(WARNING) -pthread $(DEFINITIONS) \
- -c $(HW)/corefreqd.c -o $(BUILD)/corefreqd.o
+ $(CC)) -pthread -c $(HW)/corefreqd.c -o $(BUILD)/corefreqd.o \
+ $(CFLAGS) $(DEFINITIONS) -pthread
$(BUILD)/corefreqd: $(BUILD)/corefreqd.o $(BUILD)/corefreqm.o
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " LD [$@]"; fi; \
- $(CC)) $(OPTIM_FLG) -o $(BUILD)/corefreqd \
+ $(CC)) $(LDFLAGS) -o $(BUILD)/corefreqd \
$(BUILD)/corefreqd.o $(BUILD)/corefreqm.o -lpthread -lm -lrt -lc
.PHONY: corefreqd
@@ -267,28 +271,28 @@ corefreqd: $(BUILD)/corefreqd
$(BUILD)/corefreq-ui.o: $(HW)/corefreq-ui.c
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " CC [$@]"; fi; \
- $(CC)) $(OPTIM_FLG) $(WARNING) $(DEFINITIONS) \
- -c $(HW)/corefreq-ui.c -o $(BUILD)/corefreq-ui.o
+ $(CC)) -c $(HW)/corefreq-ui.c -o $(BUILD)/corefreq-ui.o \
+ $(CFLAGS) $(DEFINITIONS)
$(BUILD)/corefreq-cli.o: $(HW)/corefreq-cli.c
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " CC [$@]"; fi; \
- $(CC)) $(OPTIM_FLG) $(WARNING) $(DEFINITIONS) $(LAYOUT) \
- -c $(HW)/corefreq-cli.c -o $(BUILD)/corefreq-cli.o
+ $(CC)) -c $(HW)/corefreq-cli.c -o $(BUILD)/corefreq-cli.o \
+ $(CFLAGS) $(DEFINITIONS) $(LAYOUT)
$(BUILD)/corefreq-cli-rsc.o: $(HW)/corefreq-cli-rsc.c
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " CC [$@]"; fi; \
- $(CC)) $(OPTIM_FLG) $(WARNING) $(DEFINITIONS) $(LAYOUT) \
- -c $(HW)/corefreq-cli-rsc.c -o $(BUILD)/corefreq-cli-rsc.o
+ $(CC)) -c $(HW)/corefreq-cli-rsc.c -o $(BUILD)/corefreq-cli-rsc.o \
+ $(CFLAGS) $(DEFINITIONS) $(LAYOUT)
$(BUILD)/corefreq-cli-json.o: $(HW)/corefreq-cli-json.c
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " CC [$@]"; fi; \
- $(CC)) $(OPTIM_FLG) $(WARNING) $(DEFINITIONS) \
- -c $(HW)/corefreq-cli-json.c -o $(BUILD)/corefreq-cli-json.o
+ $(CC)) -c $(HW)/corefreq-cli-json.c -o $(BUILD)/corefreq-cli-json.o \
+ $(CFLAGS) $(DEFINITIONS)
$(BUILD)/corefreq-cli-extra.o: $(HW)/corefreq-cli-extra.c
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " CC [$@]"; fi; \
- $(CC)) $(OPTIM_FLG) $(WARNING) $(DEFINITIONS) \
- -c $(HW)/corefreq-cli-extra.c -o $(BUILD)/corefreq-cli-extra.o
+ $(CC)) -c $(HW)/corefreq-cli-extra.c -o $(BUILD)/corefreq-cli-extra.o \
+ $(CFLAGS) $(DEFINITIONS)
$(BUILD)/corefreq-cli: $(BUILD)/corefreq-cli.o \
$(BUILD)/corefreq-ui.o \
@@ -296,7 +300,7 @@ $(BUILD)/corefreq-cli: $(BUILD)/corefreq-cli.o \
$(BUILD)/corefreq-cli-json.o \
$(BUILD)/corefreq-cli-extra.o
$(if $(V), $(CC), @if [ ${SILENT} -eq 0 ]; then echo " LD [$@]"; fi; \
- $(CC)) $(OPTIM_FLG) -o $(BUILD)/corefreq-cli \
+ $(CC)) $(LDFLAGS) -o $(BUILD)/corefreq-cli \
$(BUILD)/corefreq-cli.o $(BUILD)/corefreq-ui.o \
$(BUILD)/corefreq-cli-rsc.o $(BUILD)/corefreq-cli-json.o \
$(BUILD)/corefreq-cli-extra.o -lm -lrt -lc
@@ -308,6 +312,8 @@ corefreq-cli: $(BUILD)/corefreq-cli
info:
$(info HW [$(HW)])
$(info CC [$(shell whereis -b $(CC))])
+ $(info CFLAGS [$(CFLAGS)])
+ $(info LDFLAGS [$(LDFLAGS)])
$(info WARNING [$(WARNING)])
$(info PWD [$(PWD)])
$(info BUILD [$(BUILD)])
|