KIM API V2
Makefile
Go to the documentation of this file.
1 #
2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the Common Development
5 # and Distribution License Version 1.0 (the "License").
6 #
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.
10 #
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:
15 #
16 # Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
17 #
18 # CDDL HEADER END
19 #
20 
21 #
22 # Copyright (c) 2013--2018, Regents of the University of Minnesota.
23 # All rights reserved.
24 #
25 # Contributors:
26 # Ryan S. Elliott
27 #
28 
29 
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)
34  endif
35 endif
36 include $(shell $(KIM_API_BUILD_CONFIG) --master-config)
37 
38 
39 export MODELS_LIST := $(filter-out .,$(shell find . -type d | sed -e's|^\./||'))
40 
41 all: $(patsubst %,%-all,$(MODELS_LIST))
42 
43 install-system-all: $(patsubst %,%-install-system,$(MODELS_LIST))
44 install-user-all: $(patsubst %,%-install-user,$(MODELS_LIST))
45 
46 uninstall-system-all: $(patsubst %,%-uninstall-system,$(MODELS_LIST))
47 uninstall-user-all: $(patsubst %,%-uninstall-user,$(MODELS_LIST))
48 
49 clean: $(patsubst %,%-clean,$(MODELS_LIST))
50 
51 .PHONY: all clean $(patsubst %,%-all,$(MODELS_LIST)) $(patsubst %,%-clean,$(MODELS_LIST)) \
52  $(patsubst %,%-install-system,$(MODELS_LIST)) $(patsubst %,%-install-user,$(MODELS_LIST)) \
53  $(patsubst %,%-uninstall-system,$(MODELS_LIST)) $(patsubst %,%-uninstall-user,$(MODELS_LIST))
54 
55 ########### for internal use ###########
56 %-making-echo:
57  @printf "\n%79s\n" " " | sed -e 's/ /*/g'
58  @printf "%-77s%2s\n" "** Building... `printf "$(patsubst %-all,%,$*)" | sed -e 's/@/ /g'`" "**"
59  @printf "%79s\n" " " | sed -e 's/ /*/g'
60 
61 $(patsubst %,%-all,$(MODELS_LIST)): %: Makefile Model..........@%-making-echo
62  $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-all,%,$@) all
63 
64 $(patsubst %,%-clean,$(MODELS_LIST)):
65  $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-clean,%,$@) clean
66 
67 $(patsubst %,%-install-system,$(MODELS_LIST)): %: Makefile Model..........@%-making-echo
68  $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-install-system,%,$@) install-system
69 
70 $(patsubst %,%-install-user,$(MODELS_LIST)): %: Makefile Model..........@%-making-echo
71  $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-install-user,%,$@) install-user
72 
73 $(patsubst %,%-uninstall-system,$(MODELS_LIST)): %: Makefile Model..........@%-making-echo
74  $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-uninstall-system,%,$@) uninstall-system
75 
76 $(patsubst %,%-uninstall-user,$(MODELS_LIST)): %: Makefile Model..........@%-making-echo
77  $(QUELL)$(MAKE) $(MAKE_FLAGS) -C $(patsubst %-uninstall-user,%,$@) uninstall-user