Makefile revision 10428
1# Copyright (c) 2012-2014, TU Delft
2# Copyright (c) 2012-2014, TU Eindhoven
3# Copyright (c) 2012-2014, TU Kaiserslautern
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met:
9#
10# 1. Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer.
12#
13# 2. Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in the
15# documentation and/or other materials provided with the distribution.
16#
17# 3. Neither the name of the copyright holder nor the names of its
18# contributors may be used to endorse or promote products derived from
19# this software without specific prior written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#
33# Authors: Matthias Jung, Omar Naji, Sven Goossens
34#
35
36ifeq ($(COVERAGE),1)
37	GCOVFLAGS := -fprofile-arcs -ftest-coverage
38else
39	GCOVFLAGS :=
40endif
41
42# Optimization flags. Usually you should not optimize until you have finished
43# debugging, except when you want to detect dead code.
44OPTCXXFLAGS ?=
45
46# Debugging flags.
47DBGCXXFLAGS ?= -g ${GCOVFLAGS}
48
49# Common warning flags shared by both C and C++.
50WARNFLAGS := -W -pedantic-errors -Wextra -Werror \
51             -Wformat -Wformat-nonliteral -Wpointer-arith \
52             -Wcast-align -Wconversion -Wall -Werror
53
54# Sum up the flags.
55CXXFLAGS := -O ${WARNFLAGS} ${DBGCXXFLAGS} ${OPTCXXFLAGS} -std=c++98
56
57DRAMPOWER_PATH ?= ../..
58MYPATH := ${DRAMPOWER_PATH}/test/libdrampowertest
59USE_XERCES ?= 1
60
61# Name of the generated binary.
62BINARY := ${MYPATH}/library_test
63
64ifeq ($(USE_XERCES),1)
65	LIBS := -lxerces-c -ldrampowerxml -ldrampower
66else
67	LIBS := -ldrampower
68endif
69
70all:
71	g++ ${MYPATH}/lib_test.cc ${CXXFLAGS} -iquote ${DRAMPOWER_PATH}/src -DUSE_XERCES=${USE_XERCES} -L${DRAMPOWER_PATH}/src/ ${LIBS} -o $(BINARY)
72
73clean:
74	rm -f $(BINARY)
75
76coverageclean:
77	$(RM) lib_test.gcno lib_test.gcda
78
79test: all
80	./$(BINARY) ${DRAMPOWER_PATH}/memspecs/MICRON_1Gb_DDR2-1066_16bit_H.xml
81
82.PHONY: clean test
83