87c7777b836a2753986f543ff8ca29ce8506ab1b
[staging/basesystem.git] / service / system / config / library / system_manager_config / order / Makefile
1 #
2 # @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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 #HOST TOOLS
18 HOST_CPP = cpp
19 HOST_ORDER_XML2CFG = ./launch_order_xml2cfg.pl
20
21 CONF_DIR = $(SDKTARGETSYSROOT)/etc/basesystem
22 CONF_WON_H = $(SDKTARGETSYSROOT)/usr/include/basesystem/agl_wakeup_order.h
23
24 LAUNCH_XMLFILES = $(shell cd $(CONF_DIR)/sm_launch; ls *.xml)
25 ORDER_XMLFILES = $(LAUNCH_XMLFILES:%.xml=%.order)
26 ORDER_CFGFILES = $(ORDER_XMLFILES:%.order=%.order.cfg)
27
28 INST_CONFDIR = $(SDKTARGETSYSROOT)/etc/basesystem/systemmanager
29
30 CLEAN_FILES = launch_order_body.xml $(ORDER_CFGFILES)
31
32 VPATH  = $(CONF_DIR)/sm_launch
33 VPATH += ../xml
34
35 install:install-pre install-cfg
36
37 install-pre:
38         install -m 644 -t  $(DESTDIR)/etc/basesystem/sm_launch system_launcher_main.xml 
39
40 install-cfg:$(ORDER_CFGFILES)
41         set -e                                 ;\
42         install -d -m 775  $(INST_CONFDIR)     ;\
43         for cfgfile in $(ORDER_CFGFILES);do   \
44                 install -m 644 -t $(INST_CONFDIR) $$cfgfile;\
45         done                                  ;\
46
47 #Create CFG file
48 %.order.cfg:%.order %.cfg
49         echo $@
50         set -e; \
51         $(HOST_CPP) $(CPPFLAGS) -P -include $(CONF_WON_H) $< > launch_in.order; \
52         $(HOST_ORDER_XML2CFG) launch_in.order $(filter %.cfg,$+) > $@ ; \
53         rm -fr launch_in.order;
54
55 %.order:
56         echo $@
57         set -e; \
58         if [ ! -e $@ ] ; then \
59           touch $@     ;      \
60         fi
61
62 PHONY:install-cfg
63
64 include ../../../../system_service.mk