This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (43 loc) · 1.59 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#
# Copyright (2019) Petr Ospalý <[email protected]>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
include Makefile.config
.PHONY: all clean install depend
all: $(BUILD_DIR)/$(LIBHOOK)
depend: $(BUILD_DIR)/.depend
$(BUILD_DIR)/.depend: $(SOURCE_FILES)
@printf '\n# MAKE -> Find header files dependencies...\n\n'
@mkdir -p "$(BUILD_DIR)"
echo $(CPP) -MM $(SOURCE_FILES)
$(CPP) -MM $(SOURCE_FILES) > "$(BUILD_DIR)"/.depend
@sed -i "s#.*#${BUILD_DIR}/&#" "$(BUILD_DIR)"/.depend
include $(BUILD_DIR)/.depend
$(BUILD_DIR)/$(LIBHOOK): $(OBJECTS)
@printf '\n# MAKE -> Build hook library: $@\n\n'
@mkdir -p "$(BUILD_DIR)"
$(CPP) $(CPPFLAGS) $(LIBS) -fpic -shared \
-I "${KEA_INSTALLPREFIX}"/include/kea \
-L "${KEA_INSTALLPREFIX}"/lib \
$^ -o $@
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.cc
@printf '\n# MAKE -> Build module: $@\n'
@printf ' Dependencies: $^\n\n'
@mkdir -p "$(BUILD_DIR)"
$(CPP) $(CPPFLAGS) $(LIBS) -fpic -shared \
-I "${KEA_INSTALLPREFIX}"/include/kea \
-L "${KEA_INSTALLPREFIX}"/lib \
-c $< -o $@
install: all
@printf "\n# MAKE -> Copy hook library into Kea\n\n"
@cp -av "$(BUILD_DIR)/$(LIBHOOK)" "${KEA_INSTALLPREFIX}"/lib/kea/hooks/
@echo "${KEA_INSTALLPREFIX}/lib/kea/hooks/$(LIBHOOK)" \
>> "${KEA_INSTALLPREFIX}/lib/kea/hooks/opennebula-hooks.list"
@printf '\n# MAKE -> INSTALLATION DONE\n\n'
clean:
@printf "\n# MAKE -> Delete all object files\n\n"
@rm -vf "$(BUILD_DIR)/"*.o
@printf '\n# MAKE -> CLEANUP DONE\n\n'