summaryrefslogtreecommitdiff
path: root/lib/Makefile.gcj
blob: 7bac691e8eb0da0e632e645ec549572486e470da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# This Makefile is used when building with gcj.  It is separate from
# the ordinary Makefile as it does special GNU-make-specific things,
# and this avoids making other builds unnecessarily ugly.

# A .list file is made by split-for-gcj.sh.
# It lists all the files in a given package.
all_list_files := $(shell echo lists/*.list)
# The corresponding stamp files.
# Each .class file depends on its package's stamp file.
# Each stamp file depends on the corresponding list file.
# Each list file depends on the java files in its package.
# This way touching a single java source will cause the minimum
# number of rebuilds.
all_stamp_files := $(all_list_files:.list=.stamp)
# The dependency file generated by gcj.
all_deps_files := $(all_list_files:.list=.deps)

all: $(all_stamp_files)

# Ensure this is rebuilt whenever the list of classes changes.
# The list will always exist when this Makefile is used.
Makefile.deps: classes
	$(SHELL) $(top_srcdir)/lib/split-for-gcj.sh

-include Makefile.deps $(all_deps_files)

## Like GCJ but include some common flags.
GCJF = $(GCJ) -Wno-deprecated --encoding=UTF-8 \
    --bootclasspath '' --classpath $(compile_classpath) \
    -C -d .

# Rule to rebuild a stamp file and update the deps file.  Note that we
# make the target be the stamp file.  This ensures that if a needed
# source is changed, this rule is re-run for the appropriate package.
%.stamp: %.list
	$(GCJF) -MD -MF ${@:.stamp=.deps} -MT $@ -MP @$<
	echo timestamp > $@