ea5e34e2212665cfa3a7a85a2c566687b7faf318
[barometer.git] / src / librdkafka / Makefile
1 # makefile to manage collectd package
2 # Copyright 2017 OPNFV
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 #
17 # Contributors:
18 #   Aihua Li, Huawei Technologies.
19 #   Maryam Tahhan, Intel Corporation.
20
21 include ../mk/master.mk
22 include ../package-list.mk
23
24 WORK_DIR = librdkafka
25 TAG_DONE_FLAG = $(WORK_DIR)/.$(KAFKA_TAG).done
26 CONFIG_CMD =
27 CONFIG_CMD += ./configure
28 CONFIG_CMD += --prefix=/usr
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 checkout -b $(KAFKA_TAG) $(KAFKA_TAG); $(CONFIG_CMD); cd -
42         $(AT)$(MAKE) -C $(WORK_DIR)
43         @echo "Make done"
44
45 force_install:
46         $(AT)sudo $(MAKE) -C $(WORK_DIR) install
47
48 install: $(INSTALL_TARGET)
49
50 # hard way to clean and clobber
51 clean:
52         $(AT)cd $(WORK_DIR) && git clean -xfd *.o
53 clobber:
54         $(AT)rm -rf $(WORK_DIR)
55
56 # distclean is for developer who would like to keep the
57 # clone git repo, saving time to fetch again from url
58 distclean:
59         $(AT)cd $(WORK_DIR) && git clean -xfd && git checkout -f
60
61 test:
62         @echo "Make test in $(WORK_DIR) (stub) "
63
64 sanity:
65         @echo "Make sanity in $(WORK_DIR) (stub) "
66
67 $(WORK_DIR):
68         $(AT)git clone $(KAFKA_URL)
69
70 $(TAG_DONE_FLAG): $(WORK_DIR)
71         $(AT)cd $(WORK_DIR); git checkout $(KAFKA_TAG)
72 ifneq ($(PATCH_FILE),)
73         $(AT)cd $(WORK_DIR); patch -p1 < ../$(PATCH_FILE)
74 endif
75         $(AT)touch $@