Robert Schröder
Robert Schröder

Reputation: 188

Makefile does not recognize target definition

I'm working on a project with the Dialogic DivaSDK to be able to analyze telephone calls. Since the DivaSDK supports Java via JNI, I wanted to give the samples a try. Unfortunately: the whole Java documentation is not as complete as the C# one is. So it seems to be like fishing in murky waters. In my first step I wanted to look into the sample ( Link to DivaSDK with Sample Files )files and try them out. Each sample has a makefile which has to be run. The only part within the manual which scratches my problem sounds like this:

For details how to compile and link your application please have a look at any of the samples provided with the Diva SDK. In every sample subdirectory you will find a makefile, that describes the compilation and link process of that application. The evaluation of the makefile requires some knowledge of shell scripting and makefile syntax and is beyond the scope of this document.

My problem right now is that the given makefile doesn't work the way it is supposed to be. I get the error "No Targets" Since I have not that much knowledge of makefiles, I can't figure out what is wrong with that file.

#-------------------------------------------------------------------------------
#
#  makefile to geenrate the Diva SDK Java sample "SimpleApp".  This makefile 
#  generate the class files for teh framework and the sample and creates 
#  a SimpleApp.jar that can be executed via jav -jar SimpleApp
#  
#  The makefile assumes that the java development enmvironment is installed and 
#  the java tools are accessable from the command prompt.
#
#-------------------------------------------------------------------------------

FRAMEWORK_PATH=..\..\Framework
FRAMEWORK=$(FRAMEWORK_PATH)\DivaAPI.java $(FRAMEWORK_PATH)\DivaCallBase.java

BIN_DIR=.\bin
SRC_DIR=.\src

TRAGET=SimpleApp

#edited with hint from @Aaron Digulla
all : $(BIN_DIR)\$(TRAGET).jar

SRC=$(SRC_DIR)\SimpleApp.java \
    $(SRC_DIR)\AppCall.java


$(BIN_DIR)\$(TRAGET).jar: $(SRC)
@echo #-----------------------------------------------
@echo # Generate class files
@echo #-----------------------------------------------
javac -d $(BIN_DIR) -sourcepath $(FRAMEWORK_PATH) $(FRAMEWORK) $(SRC)
@echo #-----------------------------------------------
@echo # Generate jar files and clean class and manifest
@echo #-----------------------------------------------
copy $(SRC_DIR)\manifest.txt $(BIN_DIR)
cd $(BIN_DIR)
jar -cvfm $(TRAGET).jar manifest.txt *.class > nul
del *.class
del manifest.txt
cd ..
@echo #-----------------------------------------------
@echo # $(BIN_DIR)\$(TARGET).jar successfully created
@echo #-----------------------------------------------

It seems, that the target definition is wrong, but I don't know in which way. Any tips would be very much appreciated.

edit1: With the hint from @Aaron Digulla it works a little bit better. At least the target is recognized. But now there is an error which tells me, that there are no rules to create the jar.

edit2: Well... It seems that the filepaths are wrong. If I replace some of the backslashes ( "\" ) with normal slashes ( "/" ), the compiling starts. It stops at copy though...

Upvotes: 1

Views: 2046

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328556

The error means there is no target all in the Makefile and make cowardly refuses to continue.

My guess is that this Makefile is supposed to be called from another Makefile.

Add this line to the Makefile:

all : $(BIN_DIR)\$(TRAGET).jar

and it should work. If the error persist, make sure you use GNU make or try make all

Upvotes: 2

Related Questions