LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices

Reply
 
Search this Thread
Old 06-17-2013, 06:07 AM   #1
surja
LQ Newbie
 
Registered: Jun 2013
Posts: 14

Rep: Reputation: Disabled
Makefile problem


Hi all,

I am facing the problem related to different Makefile in different directory. In linux environment $MAKE -C AGRIF FC="$CFT1" CPP="$CPP1" FFLAGS="$FFLAGS1" is working, but in AIX system $MAKE -C is not recognised flag. In AGRIF directory has multiple subdirectiory with.
When I have tried with cd AGRIF; make FC="$CFT1" CPP="$CPP1" FFLAGS="$FFLAGS1" option. Then the error is as

"Makefile", line 26: make: 1254-057 Shell command needs a leading tab.
"Makefile", line 109: make: 1254-057 Shell command needs a leading tab.
make: 1254-058 Fatal errors encountered -- cannot continue.

Please help to solve this problem.
Thanks in advance.
Surja
 
Old 06-17-2013, 09:40 AM   #2
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: MontaVista, Ubuntu, MINT
Posts: 1,013
Blog Entries: 7

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Makefile syntax requires a real TAB in lieu of a bunch of SPACES which match the same distance on the screen. This is a very common problem. Search for a string of SPACES and see if they fall in front of a command. Example:

Code:
%.o:	%.c
	$(GCC) $(CFLAGS) $(DFLAGS) -c $<

rebuild:
	make clean
	make myapp
	make install

myapp:	$(OBJS)
	$(GCC) $(OBJS) $(LFLAGS) -o myapp

install:
	cp -f myapp $(HOME)/myapp

clean:
	rm -f $(OBJS)
	rm -f $(HOME)/myapp
Before all those indented lines are TABS.
If ANY of them are spaces, there will be build problems.
This INCLUDES the gap between "myapp:" and "$(OBJS)", that must also be a TAB or there will be complaints.
Same for between "%.o:" and "%.c", that must also be a TAB

However do note that within each command such as "make clean", "make myapp", THOSE are spaces.
 
2 members found this post helpful.
Old 06-19-2013, 02:09 AM   #3
surja
LQ Newbie
 
Registered: Jun 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thanks for reply,
The Makefile I have used is as follows

#- Creation des elements relatifs a AGRIF (lib, config)
#---------------------------------------------------------------------
SHELL = /bin/sh
#---------------------------------------------------------------------

DIR_OBJS = AGRIF_OBJS
DIR_FILES = AGRIF_FILES
DIR_YOURFILES = AGRIF_YOURFILES

FILENAMES = modbc modcluster modinit modinitvars modinterp modinterpbasic \
modtypes modbcfunction modutil modcurgridfunctions \
modmask modsauv modupdate modmpp \
modupdatebasic modlinktomodel modarrays modflux modvariables

OBJS=$(addsuffix .o,$(addprefix $(DIR_OBJS)/,$(FILENAMES)))
FILES=$(addsuffix .F90,$(addprefix $(DIR_FILES)/,$(FILENAMES)))

all: conv libagrif.a
@echo
@echo ===================================================
@echo AGRIF is OK
@echo ===================================================
@echo

conv:
(cd LIB; $MAKE conv)
mv -f LIB/conv .

libagrif.a : prep_lib $(OBJS)
$(AR) -r $@ $(OBJS)
ranlib $@

prep_lib:
mkdir -p $(DIR_YOURFILES)
mkdir -p $(DIR_OBJS)

$(DIR_OBJS)/%.o : $(DIR_FILES)/%.F90
$(RM) $(DIR_YOURFILES)/$(*F).f90
$(CPP) $(CPPFLAGS) $(DIR_FILES)/$(*F).F90 > $(DIR_YOURFILES)/$(*F).f90
$(FC) $(FFLAGS) -I.. -c $(DIR_YOURFILES)/$(*F).f90 -o $(DIR_OBJS)/$(*F).o

$(DIR_OBJS)/modarrays.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modbc.o: $(DIR_OBJS)/modinterp.o

$(DIR_OBJS)/modbcfunction.o: $(DIR_OBJS)/modupdate.o \
$(DIR_OBJS)/modbc.o \
$(DIR_OBJS)/modinterp.o \
$(DIR_OBJS)/modtypes.o \
$(DIR_OBJS)/modflux.o

$(DIR_OBJS)/modcluster.o: $(DIR_OBJS)/modtypes.o \
$(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modsauv.o \
$(DIR_OBJS)/modinitvars.o \
$(DIR_OBJS)/modcurgridfunctions.o

$(DIR_OBJS)/modcurgridfunctions.o: $(DIR_OBJS)/modinit.o \
$(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modinit.o: $(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modinitvars.o: $(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modinterpbasic.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modinterp.o: $(DIR_OBJS)/modcurgridfunctions.o \
$(DIR_OBJS)/modmask.o \
$(DIR_OBJS)/modarrays.o \
$(DIR_OBJS)/modmpp.o \
$(DIR_OBJS)/modinterpbasic.o

$(DIR_OBJS)/modlinktomodel.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modmask.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modsauv.o: $(DIR_OBJS)/modarrays.o \
$(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modtypes.o $(DIR_OBJS)/modvariables.o

$(DIR_OBJS)/modupdatebasic.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modupdate.o: $(DIR_OBJS)/modmask.o \
$(DIR_OBJS)/modcurgridfunctions.o \
$(DIR_OBJS)/modarrays.o \
$(DIR_OBJS)/modmpp.o \
$(DIR_OBJS)/modupdatebasic.o

$(DIR_OBJS)/modutil.o: $(DIR_OBJS)/modtypes.o \
$(DIR_OBJS)/modcurgridfunctions.o \
$(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modsauv.o \
$(DIR_OBJS)/modcluster.o

$(DIR_OBJS)/modmpp.o: $(DIR_OBJS)/modtypes.o \
$(DIR_OBJS)/modarrays.o

.PHONY: doc

doc:
(cd doc ; doxygen Doxyfile )

clean: clean-conv
$(RM) $(OBJS) libagrif.a *.mod $(DIR_YOURFILES)/*

clean-all: clean
( cd LIB; $MAKE clean-all)

clean-conv:
(cd LIB; $MAKE clean-all)
$(RM) conv

I have changed the red mark flag.
The error is coming as

"Makefile", line 26: make: 1254-057 Shell command needs a leading tab.
"Makefile", line 109: make: 1254-057 Shell command needs a leading tab.
"Makefile", line 112: make: 1254-057 Shell command needs a leading tab.
"Makefile", line 113: make: 1254-057 Shell command needs a leading tab.
make: 1254-058 Fatal errors encountered -- cannot continue.
mv: 0653-401 Cannot rename AGRIF/conv to ROMSFILES/./conv:
A file or directory in the path name does not exist.
make: 1254-004 The error code from the last command is 127

Please help.
Surja
 
Old 06-19-2013, 03:59 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,023

Rep: Reputation: 519Reputation: 519Reputation: 519Reputation: 519Reputation: 519Reputation: 519
You need to put the Makefile in code blocks so that indentation would not be lost.

It might also help to attach the file so that individual characters within that file that could be causing problems (such as using spaces instead of tabs) could be checked.
 
1 members found this post helpful.
Old 06-19-2013, 04:56 AM   #5
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,490

Rep: Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221
please use [code]your code comes here[/code] to keep original formatting (try to edit your post)
as it was reported, shell command lines need a leading tab, probably you used spaces or maybe your editor replaced them. You must start those lines with a tab.
 
1 members found this post helpful.
Old 06-19-2013, 08:14 AM   #6
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: MontaVista, Ubuntu, MINT
Posts: 1,013
Blog Entries: 7

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
I see:
Quote:
"Makefile", line 26: make: 1254-057 Shell command needs a leading tab.
"Makefile", line 109: make: 1254-057 Shell command needs a leading tab.
"Makefile", line 112: make: 1254-057 Shell command needs a leading tab.
"Makefile", line 113: make: 1254-057 Shell command needs a leading tab.
make: 1254-058 Fatal errors encountered -- cannot continue.
That's pretty much definitive explanation what the problem is, especially when a bunch of people tell you what to look for. EDIT your Makefile and put in leading TAB characters, recommend you start with lines 26, 109, 112, and 113. Read my original recommendations about where TAB characters should be, and heed the notation that TAB is NOT 4, or 8 SPACES together, but an actual TAB.

Keep fixing it and running it until these particular errors are gone. If you find additional errors, then post those in code markers as jpollard and pan64 have mentioned.
 
1 members found this post helpful.
Old 06-20-2013, 05:38 AM   #7
surja
LQ Newbie
 
Registered: Jun 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thank you all,
The problem is solved using tab before starting line.
Now new problem is coming as

The Makefile is in attached file and in bellow
#- Creation des elements relatifs a AGRIF (lib, config)
#---------------------------------------------------------------------
SHELL = /bin/sh
#---------------------------------------------------------------------

DIR_OBJS = AGRIF_OBJS
DIR_FILES = AGRIF_FILES
DIR_YOURFILES = AGRIF_YOURFILES

FILENAMES = modbc modcluster modinit modinitvars modinterp modinterpbasic \
modtypes modbcfunction modutil modcurgridfunctions \
modmask modsauv modupdate modmpp \
modupdatebasic modlinktomodel modarrays modflux modvariables

OBJS=$(addsuffix .o,$(addprefix $(DIR_OBJS)/,$(FILENAMES)))
FILES=$(addsuffix .F90,$(addprefix $(DIR_FILES)/,$(FILENAMES)))

all: conv libagrif.a
@echo
@echo ===================================================
@echo AGRIF is OK
@echo ===================================================
@echo

conv:
( cd LIB; make conv)
mv -f LIB/conv .

libagrif.a : prep_lib $(OBJS)
$(AR) -r $@ $(OBJS)
ranlib $@

prep_lib:
mkdir -p $(DIR_YOURFILES)
mkdir -p $(DIR_OBJS)

$(DIR_OBJS)/%.o : $(DIR_FILES)/%.F90
$(RM) $(DIR_YOURFILES)/$(*F).f90
$(CPP) $(CPPFLAGS) $(DIR_FILES)/$(*F).F90 > $(DIR_YOURFILES)/$(*F).f90
$(FC) $(FFLAGS) -I.. -c $(DIR_YOURFILES)/$(*F).f90 -o $(DIR_OBJS)/$(*F).o

$(DIR_OBJS)/modarrays.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modbc.o: $(DIR_OBJS)/modinterp.o

$(DIR_OBJS)/modbcfunction.o: $(DIR_OBJS)/modupdate.o \
$(DIR_OBJS)/modbc.o \
$(DIR_OBJS)/modinterp.o \
$(DIR_OBJS)/modtypes.o \
$(DIR_OBJS)/modflux.o

$(DIR_OBJS)/modcluster.o: $(DIR_OBJS)/modtypes.o \
$(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modsauv.o \
$(DIR_OBJS)/modinitvars.o \
$(DIR_OBJS)/modcurgridfunctions.o

$(DIR_OBJS)/modcurgridfunctions.o: $(DIR_OBJS)/modinit.o \
$(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modinit.o: $(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modinitvars.o: $(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modinterpbasic.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modinterp.o: $(DIR_OBJS)/modcurgridfunctions.o \
$(DIR_OBJS)/modmask.o \
$(DIR_OBJS)/modarrays.o \
$(DIR_OBJS)/modmpp.o \
$(DIR_OBJS)/modinterpbasic.o

$(DIR_OBJS)/modlinktomodel.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modmask.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modsauv.o: $(DIR_OBJS)/modarrays.o \
$(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modtypes.o $(DIR_OBJS)/modvariables.o

$(DIR_OBJS)/modupdatebasic.o: $(DIR_OBJS)/modtypes.o

$(DIR_OBJS)/modupdate.o: $(DIR_OBJS)/modmask.o \
$(DIR_OBJS)/modcurgridfunctions.o \
$(DIR_OBJS)/modarrays.o \
$(DIR_OBJS)/modmpp.o \
$(DIR_OBJS)/modupdatebasic.o

$(DIR_OBJS)/modutil.o: $(DIR_OBJS)/modtypes.o \
$(DIR_OBJS)/modcurgridfunctions.o \
$(DIR_OBJS)/modlinktomodel.o \
$(DIR_OBJS)/modsauv.o \
$(DIR_OBJS)/modcluster.o

$(DIR_OBJS)/modmpp.o: $(DIR_OBJS)/modtypes.o \
$(DIR_OBJS)/modarrays.o

.PHONY: doc

doc:
(cd doc ; doxygen Doxyfile )

clean: clean-conv
$(RM) $(OBJS) libagrif.a *.mod $(DIR_YOURFILES)/*

clean-all: clean
( cd LIB ; make clean-all)

clean-conv:
( cd LIB ; make clean-all)
$(RM) conv


in AGRIF directory has the following subdirectory
AGRIF_FILES/ LIB/ Makefile* doc/

the Makefile is in attached file.
in AGRIF_FILES/ has following scripts.

modarrays.F90* modflux.F90* modlinktomodel.F90* modupdate.F90*
modbc.F90* modinit.F90* modmask.F90* modupdatebasic.F90*
modbcfunction.F90* modinitvars.F90* modmpp.F90* modutil.F90*
modcluster.F90* modinterp.F90* modsauv.F90* modvariables.F90*
modcurgridfunctions.F90* modinterpbasic.F90* modtypes.F90*

LIB derictory has following 'C' program scripts

DiversListe.c* WorkWithAllocatelist.c* WriteInFile.c*
Makefile* WorkWithParameterlist.c* Writedeclarations.c*
SubLoopCreation.c* WorkWithglobliste.c* decl.h*
UtilAgrif.c* WorkWithlistdatavariable.c* dependfile.c*
UtilCharacter.c* WorkWithlistmoduleinfile.c* fortran.c*
UtilFile.c* WorkWithlistofcoupled.c* main.c*
UtilFortran.c* WorkWithlistofmodulebysubroutine.c* run*
UtilListe.c* WorkWithlistvarindoloop.c* toamr.c*
UtilNotGridDep.c* WorkWithvarofsubroutineliste.c*

I think the red coloured line part is not working. After working LIB directory it leaving Makefile.
The detail error is as
( cd LIB; make conv)
cc -O -c main.c
cc -O -c WriteInFile.c
cc -O -c toamr.c
cc -O -c fortran.c
1500-030: (I) INFORMATION: fortran_lex: Additional optimization may be attained by recompiling and specifying MAXMEM option with a value greater than 8192.
cc -O -c dependfile.c
cc -O -c SubLoopCreation.c
cc -O -c WorkWithlistvarindoloop.c
cc -O -c WorkWithvarofsubroutineliste.c
cc -O -c WorkWithParameterlist.c
cc -O -c Writedeclarations.c
cc -O -c WorkWithglobliste.c
cc -O -c UtilFortran.c
cc -O -c UtilNotGridDep.c
cc -O -c WorkWithlistdatavariable.c
cc -O -c DiversListe.c
cc -O -c UtilAgrif.c
cc -O -c WorkWithAllocatelist.c
cc -O -c UtilCharacter.c
cc -O -c UtilListe.c
cc -O -c UtilFile.c
cc -O -c WorkWithlistofmodulebysubroutine.c
cc -O -c WorkWithlistmoduleinfile.c
cc -O -c WorkWithlistofcoupled.c
cc -O main.o WriteInFile.o toamr.o fortran.o dependfile.o SubLoopCreation.o WorkWithlistvarindoloop.o WorkWithvarofsubroutineliste.o WorkWithParameterlist.o Writedeclarations.o WorkWithglobliste.o UtilFortran.o UtilNotGridDep.o WorkWithlistdatavariable.o DiversListe.o UtilAgrif.o WorkWithAllocatelist.o UtilCharacter.o UtilListe.o UtilFile.o WorkWithlistofmodulebysubroutine.o "Lime"]WorkWithlistmoduleinfile.o WorkWithlistofcoupled.o -o conv
mv -f LIB/conv .
mkdir -p AGRIF_YOURFILES
mkdir -p AGRIF_OBJS
ar -r libagrif.a
ar: Creating an archive file libagrif.a.
ranlib libagrif.a

===================================================
AGRIF is OK
==================================================
= LEAVING Makefile
/lib/cpp -P -I/usr/local/include -IROMSFILES/AGRIF_INC main.F | ./mpc > ROMSFILES/main.F
(cd ROMSFILES ; ./conv amr.scrum -rm -comdirin ./ -comdirout AGRIF_MODELFILES/. -convfile main.F)
syntax error line 115, file .//main.F motclef = |86400.,| curbuf = ||
/lib/cpp -P -I/usr/local/include -IROMSFILES/AGRIF_INC -IROMSFILES/AGRIF_INC ROMSFILES/AGRIF_MODELFILES/main.F > main_.f

Please help.
Thanks again.
Surja
Attached Files
File Type: txt Makefile.txt (4.2 KB, 3 views)
 
Old 06-20-2013, 06:03 AM   #8
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,490

Rep: Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221
please use code tags to keep formatting
have you checked the error message:
syntax error line 115, file .//main.F motclef
 
Old 06-20-2013, 07:21 AM   #9
surja
LQ Newbie
 
Registered: Jun 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thank you for reply,
You are suggesting me in main.F 1n 115 line has syntax error, but I have checked the code there is no error. I think it is not compiling *.F90 file. So the problem is coming.
 
Old 06-20-2013, 08:29 AM   #10
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,599

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You might be smarter than the compiler, but it is more stubborn than you... Perhaps you should quote the line in question.
PS: the problem has nothing to do with Makefile
PS2: Please use [code] and [/code] tags, can't you?
 
Old 06-22-2013, 04:31 AM   #11
surja
LQ Newbie
 
Registered: Jun 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Hi NevemTeve,
I don't understand your answer.
Can you tell in-detail, or give reference.
Thanks for reply.
I am waiting for reply.
Surja.
 
Old 06-22-2013, 09:29 AM   #12
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,599

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
1. quote the line in question (main.F line 115)
2. the problem has nothing to do with Makefile
3. Please use [code] and [/code] tags
Which of these three sentences is problematic?
 
Old 06-23-2013, 02:31 AM   #13
surja
LQ Newbie
 
Registered: Jun 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
The 115 no line in main.F is
do tile=0,NSUB_X*NSUB_E-1
I have used Makefile in [code].
 
Old 06-23-2013, 03:27 AM   #14
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,599

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Are NSUB_X and NSUB_E defined at this point?
What command did you use to compile?
(You don't have to use [code] tag in your Makefile; you have to use in this forum, when you quote source code. See #2 in this topic.)
 
Old 06-23-2013, 06:05 AM   #15
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,023

Rep: Reputation: 519Reputation: 519Reputation: 519Reputation: 519Reputation: 519Reputation: 519
You also need to specify which fortran compiler you are using.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] need of makefile info ? how the linux make file is different from simple c makefile ? rpittala Linux - Newbie 2 05-07-2012 08:04 PM
make: Warning: Both `makefile' and `Makefile' exist ? malli42108 Solaris / OpenSolaris 5 10-24-2009 09:09 AM
Is it mandatory to have the name of the makefile as 'Makefile' for kernal module comp narender.d Linux - Kernel 3 05-29-2009 06:26 AM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 03:57 AM


All times are GMT -5. The time now is 08:32 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration