1#
2# %CopyrightBegin%
3#
4# Copyright Ericsson AB 2001-2016. All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# %CopyrightEnd%
19#
20SHELL=/bin/sh
21
22include $(ERL_TOP)/make/target.mk
23include $(ERL_TOP)/make/$(TARGET)/otp.mk
24
25ifdef HIPE_ENABLED
26HIPE_SUBDIRS = regalloc sparc ppc x86 amd64 arm opt tools llvm
27else
28HIPE_SUBDIRS =
29endif
30
31ALWAYS_SUBDIRS = misc main cerl icode flow util doc/src
32
33ifdef HIPE_ENABLED
34# "rtl" below must be the first directory so that file rtl/hipe_literals.hrl
35# which is needed by many other HiPE files is built first
36SUB_DIRECTORIES = rtl $(ALWAYS_SUBDIRS) $(HIPE_SUBDIRS)
37else
38SUB_DIRECTORIES = $(ALWAYS_SUBDIRS)
39endif
40
41
42include native.mk
43
44ifndef EBIN
45EBIN = ../ebin
46endif
47
48#
49# Default Subdir Targets
50#
51include $(ERL_TOP)/make/otp_subdir.mk
52
53# The overriding docs target have been removed so the default make rules work properly.
54
55edocs:
56	@if [ -d $(ERL_TOP)/lib/edoc/ebin ]; then \
57	  erl -noshell -pa $(ERL_TOP)/lib/edoc/ebin $(ERL_TOP)/lib/syntax_tools/ebin $(ERL_TOP)/lib/xmerl/ebin -run edoc_run application 'hipe' '"."' '[new,no_packages]' -s init stop ; \
58	fi
59
60all-subdirs:
61	$(V_at)for dir in $(SUB_DIRECTORIES); do \
62		(cd $$dir; $(MAKE) $(MAKETARGET) EBIN=$(EBIN); cd ..); \
63	done
64
65# distclean and realclean should clean the bootstrap files
66all-subdirs-x:
67	$(V_at)for dir in $(SUB_DIRECTORIES); do \
68		(cd $$dir; $(MAKE) $(MAKETARGET) EBIN=../boot_ebin; cd ..); \
69	done
70
71clean:
72	$(V_at)$(MAKE) MAKETARGET="clean" all-subdirs all-subdirs-x
73distclean:
74	$(V_at)$(MAKE) MAKETARGET="distclean" all-subdirs all-subdirs-x
75realclean:
76	$(V_at)$(MAKE) MAKETARGET="realclean" all-subdirs all-subdirs-x
77
78