• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1########################################################
2# Copyright 2015 ARM Limited. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without modification,
5# are permitted provided that the following conditions are met:
6#
7# 1. Redistributions of source code must retain the above copyright notice,
8# this list of conditions and the following disclaimer.
9#
10# 2. Redistributions in binary form must reproduce the above copyright notice,
11# this list of conditions and the following disclaimer in the documentation
12# and/or other materials provided with the distribution.
13#
14# 3. Neither the name of the copyright holder nor the names of its contributors
15# may be used to endorse or promote products derived from this software without
16# specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29########################################################################
30#
31# Make file for snapshot parser library.
32#
33########################################################################
34
35CXX := $(MASTER_CXX)
36LINKER := $(MASTER_LINKER)
37LIB := $(MASTER_LIB)
38
39# avoid build warnings in donated test code
40WSUPPRESS= -Wno-deprecated-declarations -Wno-unused-variable -Wno-reorder
41
42CXXFLAGS += $(WSUPPRESS)
43
44LIB_NAME = libsnapshot_parser
45
46BUILD_DIR=./$(PLAT_DIR)
47
48PARSER_ROOT=$(OCSD_TESTS)/snapshot_parser_lib
49PARSER_SOURCE=$(PARSER_ROOT)/source
50PARSER_INCLUDE=$(PARSER_ROOT)/include
51
52VPATH=	$(PARSER_SOURCE)
53
54
55CXX_INCLUDES= \
56				-I$(PARSER_INCLUDE) \
57				-I$(OCSD_INCLUDE)
58
59OBJECTS=$(BUILD_DIR)/device_info.o \
60		$(BUILD_DIR)/device_parser.o \
61		$(BUILD_DIR)/snapshot_parser.o \
62		$(BUILD_DIR)/snapshot_parser_util.o \
63		$(BUILD_DIR)/snapshot_reader.o \
64		$(BUILD_DIR)/ss_to_dcdtree.o
65
66all: $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a
67
68$(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a: $(OBJECTS) | build_dir
69	mkdir -p $(LIB_TEST_TARGET_DIR)
70	$(LIB) $(ARFLAGS) $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS)
71
72build_dir:
73	mkdir -p $(BUILD_DIR)
74
75##### build rules
76
77## object dependencies
78DEPS := $(OBJECTS:%.o=%.d)
79
80-include $(DEPS)
81
82## object compile
83$(BUILD_DIR)/%.o : %.cpp | build_dir
84	$(CXX) $(CXXFLAGS) $(CXX_INCLUDES) -MMD $< -o $@
85
86### clean
87.PHONY: clean
88clean:
89	-rm $(OBJECTS)
90	-rm $(DEPS)
91	-rm $(LIB_TEST_TARGET_DIR)/$(LIB_NAME).a
92	-rmdir $(BUILD_DIR) $(LIB_TEST_TARGET_DIR)
93