File: Makefile.include

package info (click to toggle)
tinyos 2.1.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 47,476 kB
  • ctags: 36,607
  • sloc: ansic: 63,646; cpp: 14,974; java: 10,358; python: 5,215; makefile: 1,724; sh: 902; asm: 597; xml: 392; perl: 74; awk: 46
file content (114 lines) | stat: -rw-r--r-- 2,750 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#-*-makefile-*-
######################################################################
# 
# Contains the shared make rules for the tools/java tree.
#
# In each directory, create a Makefile that includes the lines
#    ROOT = <path to this directory>
#    include $(ROOT)/Makefile.include
#
# By default the Makefile will compile all .java source code in the
# current directory. You may also specify the following flags in 
# your Makefile, *before* including Makefile.include:
#
#   SUBDIRS = dir1 dir2 ...
#     Specify a list of subdirectories that 'make' should descend into
#
#   INITIAL_TARGETS = target1 target2 ...
#     Specify build targets to be compiled before compiling Java classes
#
#   FINAL_TARGETS = target1 target2 ...
#     Specify build targets to be compiled after compiling Java classes
#
#   OTHER_CLEAN = target1 target2 ...
#     Specify other targets to be executed when 'make clean' is run
#
# NOTE: this Makefile requires GNU make, as well as a number of 
#       standard UNIX shell tools.
#
######################################################################

SRC = $(wildcard *.java)
JAVA = $(SRC)
CLASSES = $(JAVA:.java=.class)

all: here subdirs $(FINAL_TARGETS)

# figure out useful variables
PWD = $(shell pwd)

# set compiler command
ifeq ($(JAVAC)_x, _x)
JAVAC = javac
endif

# general rule for java files
%.class: %.java
	$(JAVAC) $<

ifeq ($(SUBDIRS)_x, _x)

subdirs: here

subdirs-clean: here-clean

else
subdirs: here
	@for i in $(SUBDIRS); do \
		if [ -d $$i ]; then \
			if [ -f $$i/Makefile ]; then \
				$(MAKE) -C $$i; \
			else \
				echo "***" no Makefile in directory: $(PWD)/$$i; \
			fi \
		else \
			echo "***" skipping missing directory: $(PWD)/$$i; \
		fi; \
	done

subdirs-clean: here-clean
	@for i in $(SUBDIRS); do \
		if [ -d $$i ]; then \
			if [ -f $$i/Makefile ]; then \
				$(MAKE) -C $$i clean; \
			else \
				echo "***" no Makefile in directory: $(PWD)/$$i; \
			fi \
		else \
			echo "***" skipping missing directory: $$i; \
		fi; \
	done

subdirs-install: 
	@for i in $(INSTALLDIRS); do \
		if [ -d $$i ]; then \
			if [ -f $$i/Makefile ]; then \
				$(MAKE) -C $$i install; \
			else \
				echo "***" no Makefile in directory: $(PWD)/$$i; \
			fi \
		else \
			echo "***" skipping missing directory: $$i; \
		fi; \
	done

endif

here: printdir $(INITIAL_TARGETS) $(JAVA) $(CLASSES) FORCE

printdir:
	@echo "... $(PWD)"; 

here-clean: FORCE
	@rm -f *.class *~ javacore*.txt
	@echo "cleaning $(PWD)" 

clean: here-clean subdirs-clean $(OTHER_CLEAN)

install: subdirs-install
# some phony targets - FORCE forces a command to be run on all dependencies,
# and .PHONY prevents badness if a phony target coincides with a filename

FORCE:

.PHONY: all $(SUBDIRS) $(SUBDIRSCLEAN) clean