LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-09-2015, 04:11 PM   #1
danielhilst
LQ Newbie
 
Registered: Apr 2010
Location: Brazil
Distribution: Gentoo,Archlinux
Posts: 24

Rep: Reputation: 1
Problems while "svn exporting" inside Makefile


I'm writing an Makefile to build a JNI header and .so file. The .java files needed to generate .class and then the .h file are on svn. I can copy the svn files (.java) but this would generate dupplicate code on svn since this Makefile goes to the same svn but on different tree location.

The svn design is this way because java people uses different tree of mine (the C guy), but when JNI comes in place this gets dirty..

The problem is: After export .java files the next rule gives-me an error (No rule to make target). If then I run make again it compiles the .java files. I think that gmake is stating the target files for that rule prior executing the exporting rule, but I'm not aware of gmake internals to have shure.

Here is the Makefile
Code:
CLASSES  = build/class/com/csi/arm/base/digital/Input.class \
	   build/class/com/csi/arm/base/digital/Output.class
HEADERS  = build/com_csi_arm_base_digital_Output.h \
	   build/com_csi_arm_base_digital_Input.h

JAVA_HOME  = /opt/java6
JAVAC     ?= $(JAVA_HOME)/bin/javac
JAR       ?= $(JAVA_HOME)/bin/jar
JAVA      ?= $(JAVA_HOME)/bin/java
JAVAH     ?= $(JAVA_HOME)/bin/javah
JFLAGS    ?= -g -source 5 -target 5 -bootclasspath $(JAVA_HOME)/jre/lib/rt.jar
JAVADOC   ?= $(JAVA_HOME)/bin/javadoc

.PHONY: all clean

all: build/class build/src/com/csi/arm/base/digital $(CLASSES) $(HEADERS)

build/class: 
	mkdir -p $(CURDIR)/build/class

build/src/com/csi/arm/base/digital:
	svn export http://X.X.X.X/svn/root/CSI/Arm/software/code1/trunk/armcomcsi/src/com/csi/arm/base/digital/ build/src/com/csi/arm/base/digital/

clean:
	rm -rf build

# ------------------ RULES -------------------------- #
build/class/com/csi/arm/base/digital/%.class: build/src/com/csi/arm/base/digital/%.java
	$(JAVAC) $(JFLAGS) -d build/class -cp 'build/class:lib/*' $<

build/com_csi_arm_base_digital_%.h: build/class/com/csi/arm/base/digital/%.class
	$(JAVAH) -classpath 'build/class' -bootclasspath $(JAVA_HOME)/jre/lib/rt.jar -jni -d build/ com.csi.arm.base.digital.$*
Here is the output, from a fresh start:
Code:
[geckos@arch digitalio]$ make
mkdir -p /home/geckos/Embedded/mx6-software/jni-layer/digitalio/build/class
svn export http://X.X.X.X/svn/root/CSI/Arm/software/code1/trunk/armcomcsi/src/com/csi/arm/base/digital/ build/src/com/csi/arm/base/digital/
A    build/src/com/csi/arm/base/digital
A    build/src/com/csi/arm/base/digital/Input.java
A    build/src/com/csi/arm/base/digital/Output.java
Exported revision 13467.
make: *** No rule to make target 'build/class/com/csi/arm/base/digital/Input.class', needed by 'all'.  Stop.
[geckos@arch digitalio]$ 
[geckos@arch digitalio]$ 
[geckos@arch digitalio]$ make
/opt/java6/bin/javac -g -source 5 -target 5 -bootclasspath /opt/java6/jre/lib/rt.jar -d build/class -cp 'build/class:lib/*' build/src/com/csi/arm/base/digital/Input.java
/opt/java6/bin/javac -g -source 5 -target 5 -bootclasspath /opt/java6/jre/lib/rt.jar -d build/class -cp 'build/class:lib/*' build/src/com/csi/arm/base/digital/Output.java
/opt/java6/bin/javah -classpath 'build/class' -bootclasspath /opt/java6/jre/lib/rt.jar -jni -d build/ com.csi.arm.base.digital.Output
/opt/java6/bin/javah -classpath 'build/class' -bootclasspath /opt/java6/jre/lib/rt.jar -jni -d build/ com.csi.arm.base.digital.Input
[geckos@arch digitalio]$ 
[geckos@arch digitalio]$ 
[geckos@arch digitalio]$ make
make: Nothing to be done for 'all'.
Any ideas?
Thanks in advance, best regards!
 
Old 03-09-2015, 04:19 PM   #2
danielhilst
LQ Newbie
 
Registered: Apr 2010
Location: Brazil
Distribution: Gentoo,Archlinux
Posts: 24

Original Poster
Rep: Reputation: 1
Well adding this solves, but I still don't known what was happeining

Makefile:
Code:
build/src/com/csi/arm/base/digital/Output.java \
build/src/com/csi/arm/base/digital/Input.java:  build/src/com/csi/arm/base/digital
 
Old 03-10-2015, 02:41 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,786

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Quote:
Originally Posted by danielhilst View Post
Well adding this solves, but I still don't known what was happeining
Code:
build/src/com/csi/arm/base/digital:
	svn export http...
This tells make that svn export will create build/src/com/csi/arm/base/digital, you never said anything about Input.java and Output.java. When make starts there are no .java files, so it can't see a way to make the .class files (it would be too inefficient to recheck the filesystem after every command).
 
1 members found this post helpful.
  


Reply

Tags
make



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gigabyte U7300 "edit Makefile" command returns "error" drobin Linux - Newbie 8 09-04-2013 04:20 AM
[SOLVED] Meaningless error message from SVN "svn: generic failure" Skaperen Linux - Software 4 05-08-2012 09:38 PM
How to force "configure" and "Makefile" to look for dependencies in non sys folder? Dstruct0 Linux - Software 2 04-05-2011 08:01 AM
How can I convert makefile argument "toupper" (and "tolower")? daat99 Programming 4 12-04-2010 10:49 AM
C++ - "snprintf" inside "for" doesn't work as expected. (int to char*) Repgahroll Programming 14 08-31-2010 08:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration