The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sun Java Platform, Standard Edition 6u6 (Java 6 branch) iBot Software Releases - RSS News 0 04-26-2008 01:10 AM
Sun Java Platform, Standard Edition 1.5.0_15 (Java 5 branch) iBot Software Releases - RSS News 0 03-06-2008 01:50 PM
Sun Java Platform, Standard Edition 6u5 (Java 6 branch) iBot Software Releases - RSS News 0 03-06-2008 01:50 PM
Using Subversion, NetBeans IDE, and Sun Java System Web Server With Java ME iBot UNIX and Linux RSS News 0 02-01-2008 01:00 PM
Sun Java Platform, Standard Edition 6u4 (Java 6 branch) iBot Software Releases - RSS News 0 01-14-2008 03:40 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-16-2005
Registered User
 

Join Date: Oct 2005
Posts: 29
java Makefile

Ive been trying to write a simple Makefile to compile *.java files to *.class files that reside in different directories.

[code]
-- main_dir ----subdir1
-----subdir2
[code]

here's my Makefile. it wont run what should i do? thanks for all the help!
Code:
JAVAC = javac
JFLAGS =

SUBDIRS = main_dir subdir1 subdir2

all:
        @@for file in $(SUBDIRS); do
                 $(JAVAC) $(JFLAGS) *.java
        done
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-16-2005
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,416
If my understanding is correct, each command is taken as one single line, so you need to write the loop as if on a single line.

Maybe you try this:

Code:
JAVAC = javac
JFLAGS =

SUBDIRS = main_dir subdir1 subdir2

all:
        @@for file in $(SUBDIRS); do \
                 $(JAVAC) $(JFLAGS) *.java; \
        done
Also make sure the whitespace before the command are all real tabs.

If you still have problems running it, please don't forget to post the error message to help others help you.

Why don't you use Ant (http://ant.apache.org)?
Reply With Quote
  #3 (permalink)  
Old 10-16-2005
Registered User
 

Join Date: Oct 2005
Posts: 29
Exclamation

we're asked to use makefile for this project.. i ran it and it gave me this error..
thanks for d help

Code:
/bin/sh: syntax error at line 1: `end of file' unexpected
make: *** [all] Error 2
Reply With Quote
  #4 (permalink)  
Old 10-16-2005
Moderator
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,416
Did you try my given version? It works on my machine without this error. Your version had this error.
Reply With Quote
  #5 (permalink)  
Old 10-17-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,636
This is a link I came across when I needed some info on makefiles - Java Makefile

vino
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0