File: Rules.mk

package info (click to toggle)
jhdf 2.8.0-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 14,356 kB
  • sloc: java: 74,277; ansic: 22,284; sh: 1,992; makefile: 1,519
file content (126 lines) | stat: -rw-r--r-- 3,171 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
115
116
117
118
119
120
121
122
123
124
125
126
# A line that starts with a # is a comment
SRCDIR=.

JAVADOC_FLAGS   = -version -author

#make this relative to the source root...
LIBDIR=$(JH45INSTALLDIR)/lib
BINDIR=$(JH45INSTALLDIR)/bin
DOCDIR= $(JH45INSTALLDIR)/docs
UGDIR= $(JH45INSTALLDIR)/UsersGuide

CLASS_DIR=$(TOP)/lib
CP="$(CLASSPATH):$(CLASS_DIR):. "

RM = rm -f

# New suffixes
.SUFFIXES: .java .class .h

# Temp file for list of files to compile
COMPILEME = .compileme$(USER)
COPYME = .copyme$(USER)

CURRENTDIR = .
JAR_DIR=$(CLASS_DIR)
OUT_DIR=$(CLASS_DIR)/$(DIR)

JFLAGS= -source 1.5 -g -deprecation -d $(CLASS_DIR)	-classpath $(CP)
RMICFLAGS= -g -d $(CLASS_DIR)
JARFLAGS = cfm

JAVAH	= $(JAVAH) -jni
RMIC	= rmic	$(RMICFLAGS)
JC	= $(JAVAC) $(JFLAGS)

PACKAGE		= $(subst /,.,$(DIR))

JAVA_OBJS	= $(JAVA_SRCS:%.java=$(OUT_DIR)/%.class)
RMI_OBJS	= $(RMI_SRCS:%.java=$(OUT_DIR)/%.class)
STUB_OBJS	= $(RMI_OBJS:%.class=%_Stub.class)
SKEL_OBJS	= $(RMI_OBJS:%.class=%_Skel.class)

H_FILES		= $(JNI_SRCS:%.java=$(JNI_DIR)/%.h)

# Notice that each line that starts with an @ is ONE LONG LINE
# It may not show up or print out like that in the FAQ

# Walk down the SUBDIRS first
all::
	@echo "subdirs is " $(SUBDIRS); \
	 if test "$(SUBDIRS)" != "NULL" ; then \
		for i in $(SUBDIRS) ; do \
		    (cd $$i ; echo "making" all "in $(CURRENTDIR)/$$i"; \
		    $(MAKE) CURRENTDIR=$(CURRENTDIR)/$$i all); \
		done \
	 fi

# Then compile each file in each subdir
all:: $(JAVA_OBJS) $(RMI_OBJS) $(JNI_OBJS)
	@if test -r ${COMPILEME}; then CFF=`cat ${COMPILEME}`; fi; \
          $(RM) ${COMPILEME}; if test "$${CFF}" != ""; then  \
          echo $(JC) $${CFF}; fi; if test "$${CFF}" != ""; then \
          $(JC) $${CFF}; fi
 
	@$(RM) ${COMPILEME}



# "make clean" will delete all your class files to start fresh
clean::
	$(RM) $(OUT_DIR)/*.class *~ $(COMPILEME)
	$(RM) $(OUT_DIR)/*.gif *~ $(COMPILEME)
	$(RM) $(OUT_DIR)/*.jpg *~ $(COMPILEME)
	$(RM) $(OUT_DIR)/*.py *~ $(COMPILEME)

# SUBDIRS
clean::
	@echo "2nd check: subdirs is " $(SUBDIRS); \
	 if test  "$(SUBDIRS)" != "NULL"; then \
		echo "Past the 2nd if then"; \
		for i in $(SUBDIRS) ;\
		    do \
		    (cd $$i ; echo "making" clean "in $(CURRENTDIR)/$$i"; \
		    $(MAKE) CURRENTDIR=$(CURRENTDIR)/$$i clean); \
		    done \
	 fi

clean::
	@if [ "$(H_FILES)" != "/" ] && [ "$(H_FILES)" != "" ]; then \
		echo $(RM) $(H_FILES); \
		$(RM) $(H_FILES); \
	fi
	@if [ "$(RMI_OBJS)" != "/" ] && [ "$(RMI_OBJS)" != "" ]; then \
		echo $(RM) $(RMI_OBJS); \
		$(RM) $(RMI_OBJS); \
	fi
	@if [ "$(STUB_OBJS)" != "/" ] && [ "$(STUB_OBJS)" != "" ]; then \
		echo $(RM) $(STUB_OBJS); \
		$(RM) $(STUB_OBJS); \
	fi
	@if [ "$(SKEL_OBJS)" != "/" ] && [ "$(SKEL_OBJS)" != "" ]; then \
		echo $(RM) $(SKEL_OBJS); \
		$(RM) $(SKEL_OBJS); \
	fi


all::  $(STUB_OBJS) $(SKEL_OBJS) $(H_FILES)


### Rules

# .class.java rule, add file to list
$(OUT_DIR)/%.class : %.java
	@echo $< >> $(COMPILEME)

# Rule for compiling  a Stub/Skel files
$(OUT_DIR)/%_Skel.class :: $(OUT_DIR)/%_Stub.class

$(OUT_DIR)/%_Stub.class:: %.java
	$(RMIC) $(PACKAGE).$(notdir $(basename $(<F)))	


# Rule for compiling a .h file
$(JNI_DIR)/%.h : %.java
	$(JAVAH) -o $@ $(PACKAGE).$(notdir $(basename $< ))