-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
121 lines (92 loc) · 3.26 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
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
116
117
118
119
120
121
CXX = /usr/bin/gcc
CXXFLAGS = -Wall -Wno-unknown-pragmas -Iinc -Llib -O6
DBG = -g
DEFINES ?=
#LDFLAGS = -lpthread -lrt -lhb-file -lhrm-file
LDFLAGS = -lpthread -lrt -lhb-shared -lhrm-shared -lcpufreq
DOCDIR = doc
BINDIR = bin
LIBDIR = lib
INCDIR = ./inc
SCRATCH = ./scratch
OUTPUT = ./output
SRCDIR = ./src
ROOTS = application system tp lat core-allocator frequencyscaler frequencyscaler1 frequencyscaler2
TEST_ROOTS = test1 test2
BINS = $(ROOTS:%=$(BINDIR)/%)
TESTS = $(TEST_ROOTS:%=$(BINDIR)/%)
OBJS = $(ROOTS:%=$(BINDIR)/%.o)
TEST_OBJS = $(TEST_ROOTS:%=$(BINDIR)/%.o)
CUSTOM_BIN_NAMES = combined powerstates
CUSTOM_MODULE_NAMES = machine_states
CUSTOM_BINS = $(CUSTOM_BIN_NAMES:%=$(BINDIR)/%)
CUSTOM_OBJS = $(CUSTOM_BIN_NAMES:%=$(BINDIR)/%.o) $(CUSTOM_MODULE_NAMES:%=$(BINDIR)/%.o)
all: hb-shared
$(BINDIR):
-mkdir -p $(BINDIR)
$(LIBDIR):
-mkdir -p $(LIBDIR)
$(SCRATCH):
-mkdir -p $(SCRATCH)
$(OUTPUT):
-mkdir -p $(OUTPUT)
$(BINDIR)/%.o : $(SRCDIR)/%.c
$(CXX) -c $(CXXFLAGS) $(DEFINES) $(DBG) -o $@ $<
$(BINS) : $(OBJS)
$(BINS) : % : %.o
$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS)
$(TESTS) : $(TEST_OBJS)
$(TESTS) : % : %.o
$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS)
$(BINDIR)/combined $(BINDIR)/powerstates : % : %.o $(BINDIR)/machine_states.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
bench-tp:
$(MAKE) clean
$(MAKE) hb-shared
./bin/tp 1000 "" > $(OUTPUT)/tp_shmem_based.out
cat $(OUTPUT)/tp_shmem_based.out
#$(MAKE) clean
#$(MAKE) hb-filebased
#./bin/tp 1000 $(OUTPUT)/tp_file_based.log > $(OUTPUT)/tp_file_based.out
#cat $(OUTPUT)/tp_file_based.out
bench-lat:
$(MAKE) clean
$(MAKE) hb-shared
ls $(SCRATCH) | $(BINDIR)/lat 1000 $(OUTPUT)/log > $(OUTPUT)/lat_shmem_based.out
cat $(OUTPUT)/lat_shmem_based.out
#test:
# $(MAKE) clean
# $(MAKE) $(BINDIR) $(SCRATCH) $(OUTPUT) $(BINS) $(TESTS)
# Heartbeat shared memory version
hb-shared: $(BINDIR) $(LIBDIR) $(SCRATCH) hblib-shared $(OUTPUT) $(BINS) $(CUSTOM_BINS)
hblib-shared: $(LIBDIR)/libhb-shared.a $(LIBDIR)/libhrm-shared.a
$(LIBDIR)/libhb-shared.a: $(SRCDIR)/heartbeat-shared.c $(INCDIR)/heartbeat.h
$(MAKE) $(BINDIR)/heartbeat-shared.o
ar r $(LIBDIR)/libhb-shared.a $(BINDIR)/heartbeat-shared.o
ranlib $(LIBDIR)/libhb-shared.a
$(LIBDIR)/libhrm-shared.a: $(SRCDIR)/heart_rate_monitor-shared.c $(INCDIR)/heart_rate_monitor.h
$(MAKE) $(BINDIR)/heart_rate_monitor-shared.o
ar r $(LIBDIR)/libhrm-shared.a $(BINDIR)/heart_rate_monitor-shared.o
ranlib $(LIBDIR)/libhrm-shared.a
# Heartbeat file version
hb-filebased: $(BINDIR) $(LIBDIR) $(SCRATCH) hblib-filebased $(OUTPUT) $(BINS) $(CUSTOM_BINS)
hblib-filebased: $(LIBDIR)/libhb-file.a $(LIBDIR)/libhrm-file.a
$(LIBDIR)/libhb-file.a: $(SRCDIR)/heartbeat-file.c $(INCDIR)/heartbeat.h
$(MAKE) $(BINDIR)/heartbeat-file.o
ar r $(LIBDIR)/libhb-file.a $(BINDIR)/heartbeat-file.o
ranlib $(LIBDIR)/libhb-file.a
$(LIBDIR)/libhrm-file.a: $(SRCDIR)/heart_rate_monitor-file.c $(INCDIR)/heart_rate_monitor.h
$(MAKE) $(BINDIR)/heart_rate_monitor-file.o
ar r $(LIBDIR)/libhrm-file.a $(BINDIR)/heart_rate_monitor-file.o
ranlib $(LIBDIR)/libhrm-file.a
## cleaning
clean:
-rm -rf $(BINDIR) $(LIBDIR) $(SCRATCH) *.log *~ $(SRCDIR)/*~
squeaky: clean
-rm -rf $(OUTPUT)
# Documentation
documentation:
doxygen heartbeats_doc
clean-documentation:
-rm -rf $(DOCDIR)/html/*
-rm -rf $(DOCDIR)/latex/*