Fix the Makefile for intel-cmt-cat so it can be build without errors on
[barometer.git] / src / libpqos / Makefile
1 # makefile to manage collectd package
2 #
3
4 # Copyright 2016 OPNFV
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 # Contributors:
20 #   Aihua Li, Huawei Technologies.
21 #   Maryam Tahhan, Intel Corporation.
22
23 include ../mk/master.mk
24 include ../package-list.mk
25
26 WORK_DIR = intel-cmt-cat
27 TAG_DONE_FLAG = $(WORK_DIR)/.$(LIBPQOS_TAG).done
28 BUILD_CMD =
29
30 .PHONY: install force_install force_make
31
32 # install depends on make
33 force_install: force_make
34
35 all: force_make
36         @echo "Finished making $(WORK_DIR) "
37
38 INSTALL_TARGET = force_install force_make
39
40 force_make: $(WORK_DIR)
41         $(AT)cd $(WORK_DIR) && git pull $(LIBPQOS_URL) $(LIBPQOS_TAG)
42         @echo "git pull done"
43         $(AT)$(MAKE) -C $(WORK_DIR)/lib $(MORE_MAKE_FLAGS)
44         $(AT)$(MAKE) -C $(WORK_DIR)/pqos $(MORE_MAKE_FLAGS)
45         $(AT)$(MAKE) -C $(WORK_DIR)/rdtset $(MORE_MAKE_FLAGS)
46         @echo "Make done"
47
48 force_install:
49         $(AT)sudo $(MAKE) -C $(WORK_DIR) install PREFIX=/usr
50 ifndef DOCKER
51         $(AT)sudo modprobe msr
52 endif
53
54 install: $(INSTALL_TARGET)
55
56 # hard way to clean and clobber
57 clean:
58         $(AT)cd $(WORK_DIR) && git clean -xfd *.o
59 clobber:
60         $(AT)rm -rf $(WORK_DIR)
61
62 # distclean is for developer who would like to keep the
63 # clone git repo, saving time to fetch again from url
64 distclean:
65         $(AT)cd $(WORK_DIR) && git clean -xfd && git checkout -f
66
67 test:
68         @echo "Make test in $(WORK_DIR) (stub) "
69
70 sanity:
71         @echo "Make sanity in $(WORK_DIR) (stub) "
72
73 $(WORK_DIR):
74         $(AT)git clone $(LIBPQOS_URL)
75
76 $(TAG_DONE_FLAG): $(WORK_DIR)
77         $(AT)cd $(WORK_DIR); git checkout $(LIBPQOS_TAG)
78 ifneq ($(PATCH_FILE),)
79         $(AT)cd $(WORK_DIR); patch -p1 < ../$(PATCH_FILE)
80 endif
81         $(AT)touch $@