4 # The contents of this file are subject to the terms of the Common Development
5 # and Distribution License Version 1.0 (the "License").
7 # You can obtain a copy of the license at
8 # http://www.opensource.org/licenses/CDDL-1.0. See the License for the
9 # specific language governing permissions and limitations under the License.
11 # When distributing Covered Code, include this CDDL HEADER in each file and
12 # include the License file in a prominent location with the name LICENSE.CDDL.
13 # If applicable, add the following below this CDDL HEADER, with the fields
14 # enclosed by brackets "[]" replaced with your own identifying information:
16 # Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
22 # Copyright (c) 2013--2018, Regents of the University of Minnesota.
23 # All rights reserved.
30 ifneq (clean,$(MAKECMDGOALS))
31 KIM_API_BUILD_CONFIG = kim-api-v2-build-config
32 ifeq ($(shell $(KIM_API_BUILD_CONFIG) --version 2> /dev/null),)
33 $(error $(KIM_API_BUILD_CONFIG) utility is not available. Something is wrong with your KIM API package setup)
36 include $(shell $(KIM_API_BUILD_CONFIG) --master-config)
39 MODEL_DRIVERS_LIST = $(filter-out .,$(shell find . -type d | sed -e's|^\./||'))
41 all: $(patsubst %,%-all,$(MODEL_DRIVERS_LIST))
43 install-system-all: $(patsubst %,%-install-system,$(MODEL_DRIVERS_LIST))
44 install-user-all: $(patsubst %,%-install-user,$(MODEL_DRIVERS_LIST))
46 uninstall-system-all: $(patsubst %,%-uninstall-system,$(MODEL_DRIVERS_LIST))
47 uninstall-user-all: $(patsubst %,%-uninstall-user,$(MODEL_DRIVERS_LIST))
49 clean: $(patsubst %,%-clean,$(MODEL_DRIVERS_LIST))
51 .PHONY: all clean $(patsubst %,%-all,$(MODEL_DRIVERS_LIST)) $(patsubst %,%-clean,$(MODEL_DRIVERS_LIST)) \
52 $(patsubst %,%-install-system,$(MODEL_DRIVERS_LIST)) $(patsubst %,%-install-user,$(MODEL_DRIVERS_LIST)) \
53 $(patsubst %,%-uninstall-system,$(MODEL_DRIVERS_LIST)) $(patsubst %,%-uninstall-user,$(MODEL_DRIVERS_LIST))
56 ########### for internal use ###########
58 @printf "\n%79s\n" " " | sed -e 's/ /*/g'
59 @printf "%-77s%2s\n" "** Building... `printf "$(patsubst %-all,%,$*)" | sed -e 's/@/ /g'`" "**"
60 @printf "%79s\n" " " | sed -e 's/ /*/g'
62 $(patsubst %,%-all,$(MODEL_DRIVERS_LIST)): %: Makefile Model.Driver...@%-making-echo
63 $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-all,%,$@) all
65 $(patsubst %,%-clean,$(MODEL_DRIVERS_LIST)):
66 $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-clean,%,$@) clean
68 $(patsubst %,%-install-system,$(MODEL_DRIVERS_LIST)):
69 $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-install-system,%,$@) install-system
71 $(patsubst %,%-install-user,$(MODEL_DRIVERS_LIST)):
72 $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-install-user,%,$@) install-user
74 $(patsubst %,%-uninstall-system,$(MODEL_DRIVERS_LIST)):
75 $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-uninstall-system,%,$@) uninstall-system
77 $(patsubst %,%-uninstall-user,$(MODEL_DRIVERS_LIST)):
78 $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-uninstall-user,%,$@) uninstall-user