-
Notifications
You must be signed in to change notification settings - Fork 70
/
Makefile.drvs
86 lines (72 loc) · 4.03 KB
/
Makefile.drvs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#---------------------------------------------------------------------
#
# Copyright (c) 2018 CloudMakers, s. r. o.
# All rights reserved.
#
# You can use this software under the terms of 'INDIGO Astronomy
# open-source license' (see LICENSE.md).
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS 'AS IS' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#---------------------------------------------------------------------
# This file is supposed to be called from within indigo_XXX_drivers folder.
include ../Makefile.inc
GROUP = $(notdir $(shell pwd))
FOLDERS = $(addsuffix /, $(filter-out $(EXCLUDED_DRIVERS), $(wildcard agent_*) $(wildcard ao_*) $(wildcard aux_*) $(wildcard ccd_*) $(wildcard dome_*) $(wildcard focuser_*) $(wildcard gps_*) $(wildcard guider_*) $(wildcard mount_*) $(wildcard wheel_*) $(wildcard system_*) $(wildcard rotator_*)))
EXCLUDED = $(addsuffix /, $(filter $(EXCLUDED_DRIVERS), $(wildcard agent_*) $(wildcard ao_*) $(wildcard aux_*) $(wildcard ccd_*) $(wildcard dome_*) $(wildcard focuser_*) $(wildcard gps_*) $(wildcard guider_*) $(wildcard mount_*) $(wildcard wheel_*) $(wildcard system_*)))
FOLDERS_WITH_MAKEFILE = $(dir $(wildcard agent_*/Makefile) $(wildcard ao_*/Makefile) $(wildcard aux_*/Makefile) $(wildcard ccd_*/Makefile) $(wildcard dome_*/Makefile) $(wildcard focuser_*/Makefile) $(wildcard gps_*/Makefile) $(wildcard guider_*/Makefile) $(wildcard mount_*/Makefile) $(wildcard wheel_*/Makefile) $(wildcard system_*/Makefile))
FOLDERS_WITHOUT_MAKEFILE = $(filter-out $(FOLDERS_WITH_MAKEFILE), $(FOLDERS))
.PHONY: all clean clean-all $(FOLDERS)
all: OP = all
all: folders $(FOLDERS_WITH_MAKEFILE) $(FOLDERS_WITHOUT_MAKEFILE)
status: OP = status
status: folders $(FOLDERS_WITH_MAKEFILE) $(FOLDERS_WITHOUT_MAKEFILE)
install: OP = install
install: folders $(filter-out $(addsuffix /, $(DEVELOPED_DRIVERS)), $(FOLDERS_WITH_MAKEFILE) $(FOLDERS_WITHOUT_MAKEFILE))
uninstall: OP = uninstall
uninstall: folders $(filter-out $(addsuffix /, $(DEVELOPED_DRIVERS)), $(FOLDERS_WITH_MAKEFILE) $(FOLDERS_WITHOUT_MAKEFILE))
clean: OP = clean
clean: folders $(FOLDERS_WITH_MAKEFILE) $(FOLDERS_WITHOUT_MAKEFILE)
clean-all: OP = clean-all
clean-all: folders $(FOLDERS_WITH_MAKEFILE) $(FOLDERS_WITHOUT_MAKEFILE)
$(FOLDERS_WITH_MAKEFILE):
@$(MAKE) -C $@ $(OP)
ifeq ($(MAKECMDGOALS),all)
$(BUILD_BIN)/indigo_driver_metadata $(BUILD_DRIVERS)/indigo_$@ >>$(BUILD_SHARE)/indigo/$(GROUP)
endif
ifeq ($(MAKECMDGOALS),install)
$(BUILD_BIN)/indigo_driver_metadata $(BUILD_DRIVERS)/indigo_$@ >>$(INSTALL_SHARE)/indigo/$(GROUP)
endif
$(FOLDERS_WITHOUT_MAKEFILE):
@$(MAKE) -C $@ -f ../../Makefile.drv $(OP)
ifeq ($(MAKECMDGOALS),all)
$(BUILD_BIN)/indigo_driver_metadata $(BUILD_DRIVERS)/indigo_$@ >>$(BUILD_SHARE)/indigo/$(GROUP)
endif
ifeq ($(MAKECMDGOALS),install)
$(BUILD_BIN)/indigo_driver_metadata $(BUILD_DRIVERS)/indigo_$@ >>$(INSTALL_SHARE)/indigo/$(GROUP)
endif
folders:
@printf "\n$(GROUP) -------------------------\n\n"
@printf "Folders with Makefile: $(FOLDERS_WITH_MAKEFILE)\n"
@printf "Folders without Makefile: $(FOLDERS_WITHOUT_MAKEFILE)\n"
@printf "Folders excluded: $(EXCLUDED)\n"
@printf "Folders excluded from install: $(filter $(addsuffix /, $(DEVELOPED_DRIVERS)), $(FOLDERS_WITH_MAKEFILE) $(FOLDERS_WITHOUT_MAKEFILE))\n"
ifeq ($(MAKECMDGOALS),all)
rm -f $(BUILD_SHARE)/indigo/$(GROUP)
endif
ifeq ($(MAKECMDGOALS),install)
rm -f $(INSTALL_SHARE)/indigo/$(GROUP)
endif
ifeq ($(MAKECMDGOALS),uninstall)
rm -f $(INSTALL_SHARE)/indigo/$(GROUP)
endif