Updates/Fix on Legal/License Headers
[barometer.git] / src / pmu-tools / Makefile
1 # makefile to manage collectd package
2 #
3
4 # Copyright 2016-2019 Intel Corporation and OPNFV. All rights reserved.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18
19 #
20 # Contributors:
21 #   Aihua Li, Huawei Technologies.
22 #   Maryam Tahhan, Intel Corporation.
23
24 include ../mk/master.mk
25 include ../package-list.mk
26 export XDG_CACHE_HOME=/usr/local/src
27 WORK_DIR = pmu-tools
28 TAG_DONE_FLAG = $(WORK_DIR)/.$(PMUTOOLS_TAG).done
29 BUILD_CMD =
30 MAKEFILE = Makefile
31
32 .PHONY: install force_install force_make
33
34 # install depends on make
35 force_install: force_make
36
37 all: force_make
38         @echo "Finished making $(WORK_DIR) "
39
40 INSTALL_TARGET = force_install force_make
41
42 force_make: $(WORK_DIR) $(TAG_DONE_FLAG)
43         $(AT)cd $(WORK_DIR) && git pull $(PMUTOOLS_URL) $(PMUTOOLS_TAG)
44         @echo "git pull done"
45         $(AT)cd $(WORK_DIR)/jevents
46         $(AT)sed -i 's/lib64/lib/' $(WORK_DIR)/jevents/$(MAKEFILE)
47         $(AT)sed -i 's/CFLAGS := -g -Wall -O2 -Wno-unused-result/CFLAGS := -g -Wall -O2 -Wno-unused-result -fPIC/' $(WORK_DIR)/jevents/$(MAKEFILE)
48         $(AT)$(MAKE) -C $(WORK_DIR)/jevents
49         @echo "Make done"
50
51 force_install:
52         $(AT)sudo $(MAKE) -C $(WORK_DIR)/jevents install
53         $(AT)./$(WORK_DIR)/event_download.py --all
54
55 install: $(INSTALL_TARGET)
56
57 # hard way to clean and clobber
58 clean:
59         $(AT)cd $(WORK_DIR) && git clean -xfd *.o
60
61 clobber:
62         $(AT)rm -rf $(WORK_DIR)
63
64 # distclean is for developer who would like to keep the
65 # clone git repo, saving time to fetch again from url
66 distclean:
67         $(AT)cd $(WORK_DIR) && git clean -xfd && git checkout -f
68
69 test:
70         @echo "Make test in $(WORK_DIR) (stub) "
71
72 sanity:
73         @echo "Make sanity in $(WORK_DIR) (stub) "
74
75 $(WORK_DIR):
76         $(AT)git clone $(PMUTOOLS_URL)
77
78 $(TAG_DONE_FLAG): $(WORK_DIR)
79         $(AT)cd $(WORK_DIR); git checkout $(PMUTOOLS_TAG)
80 ifneq ($(PATCH_FILE),)
81         $(AT)cd $(WORK_DIR); patch -p1 < ../$(PATCH_FILE)
82 endif
83         $(AT)touch $@