1# This Makefile is used when building with gcj.  It is separate from
2# the ordinary Makefile as it does special GNU-make-specific things,
3# and this avoids making other builds unnecessarily ugly.
4
5# A .list file is made by split-for-gcj.sh.
6# It lists all the files in a given package.
7all_list_files := $(shell echo lists/*.list)
8# The corresponding stamp files.
9# Each .class file depends on its package's stamp file.
10# Each stamp file depends on the corresponding list file.
11# Each list file depends on the java files in its package.
12# This way touching a single java source will cause the minimum
13# number of rebuilds.
14all_stamp_files := $(all_list_files:.list=.stamp)
15# The dependency file generated by gcj.
16all_deps_files := $(all_list_files:.list=.deps)
17
18all: $(all_stamp_files)
19
20# Ensure this is rebuilt whenever the list of classes changes.
21# The list will always exist when this Makefile is used.
22Makefile.deps: classes
23	$(SHELL) $(top_srcdir)/lib/split-for-gcj.sh
24
25-include Makefile.deps $(all_deps_files)
26
27## Like GCJ but include some common flags.
28GCJF = $(GCJ) -fsource=1.5 -ftarget=1.5 -g -Wno-deprecated --encoding=UTF-8 \
29    --bootclasspath '' --classpath $(compile_classpath) \
30    -C -d .
31
32# Rule to rebuild a stamp file and update the deps file.  Note that we
33# make the target be the stamp file.  This ensures that if a needed
34# source is changed, this rule is re-run for the appropriate package.
35%.stamp: %.list
36	$(GCJF) -MD -MF ${@:.stamp=.deps} -MT $@ -MP @$<
37	echo timestamp > $@
38