03-04-2005
makefile sh script
Hello World ! ! !
I need libraries to use grib files. I only know the C language at the moment and I am working at the University under Red Hat 9.0. I downloaded the g2clib library [url=(http://www.nco.ncep.noaa.gov/pmb/docs/grib2/] (the best that I found) but I did not success to run the makefile. Here is the original file. I modified some options and paths.
=======
SHELL=/bin/sh
# If you want to enable support for PNG or JPEG2000 encoding/decoding,
# you must specify -DUSE_PNG and/or -DUSE_JPEG2000 in the DEFS variable
# for the C pre-processor
# -DUSE_PNG requires libpng.a and libz.a
# ( and png.h pngconf.h zconf.h zlib.h include files).
# -DUSE_JPEG2000 requires libjasper.a
# ( and all the jasper/*.h include files).
#
# In addition, INC must include all directories where the above
# mentioned include files can be found.
DEFS=
INC=/home/lavigne/waves/g2lib/g2clib-1.0.2
#
# This "C" source code contains many uses of the C++
# comment style "//". Please make sure you include the
# appropriate compiler flag to allow the use of "//" comment indicators.
#
#CFLAGS=-q64 -O3 -qarch=auto -qcpluscmt $(INC) $(DEFS)
CFLAGS= $(INC)
CC=cc
LIB=libgrib2c.a
ARFLAGS=-X64
all: $(LIB)
$(LIB)(gridtemplates.o): gridtemplates.h
$(LIB)(pdstemplates.o): pdstemplates.h
$(LIB)(drstemplates.o): drstemplates.h
$(LIB): $(LIB)(gridtemplates.o) \
$(LIB)(drstemplates.o) \
$(LIB)(pdstemplates.o) \
$(LIB)(gbits.o) \
$(LIB)(g2_unpack1.o) \
$(LIB)(g2_unpack2.o) \
$(LIB)(g2_unpack3.o) \
$(LIB)(g2_unpack4.o) \
$(LIB)(g2_unpack5.o) \
$(LIB)(g2_unpack6.o) \
$(LIB)(g2_unpack7.o) \
$(LIB)(g2_free.o) \
$(LIB)(g2_info.o) \
$(LIB)(g2_getfld.o) \
$(LIB)(simunpack.o) \
$(LIB)(comunpack.o) \
$(LIB)(pack_gp.o) \
$(LIB)(reduce.o) \
$(LIB)(specpack.o) \
$(LIB)(specunpack.o) \
$(LIB)(rdieee.o) \
$(LIB)(mkieee.o) \
$(LIB)(int_power.o) \
$(LIB)(simpack.o) \
$(LIB)(compack.o) \
$(LIB)(cmplxpack.o) \
$(LIB)(misspack.o) \
$(LIB)(jpcpack.o) \
$(LIB)(jpcunpack.o) \
$(LIB)(pngpack.o) \
$(LIB)(pngunpack.o) \
$(LIB)(dec_jpeg2000.o) \
$(LIB)(enc_jpeg2000.o) \
$(LIB)(dec_png.o) \
$(LIB)(enc_png.o) \
$(LIB)(g2_create.o) \
$(LIB)(g2_addlocal.o) \
$(LIB)(g2_addgrid.o) \
$(LIB)(g2_addfield.o) \
$(LIB)(g2_gribend.o) \
$(LIB)(getdim.o) \
$(LIB)(g2_miss.o) \
$(LIB)(getpoly.o) \
$(LIB)(seekgb.o)
# $(LIB)(getfield.o) \
# $(LIB)(gettemplates.o) \
# $(LIB)(getlocal.o) \
# $(LIB)(gribinfo.o) \
# $(LIB)(ixgb2.o) \
# $(LIB)(getg2i.o) \
# $(LIB)(getg2ir.o) \
# $(LIB)(getgb2s.o) \
# $(LIB)(getgb2r.o) \
# $(LIB)(getgb2l.o) \
# $(LIB)(getgb2.o) \
# $(LIB)(putgb2.o) \
# $(LIB)(params.o)
.c.a:
$(CC) -c $(CFLAGS) $<
ar $(ARFLAGS) -ruv $@ $*.o
rm -f $*.o
Error :
./modified_makefile2: line 1: INC: command not found
./modified_makefile2: line 1: LIB: command not found
./modified_makefile2: line 28: all:: command not found
./modified_makefile2: line 30: syntax error near unexpected token `gridtemplates.o'
./modified_makefile2: line 30: `$(LIB)(gridtemplates.o): gridtemplates.h'
=======
So I tried to modify it with my little Shell Script knowledge :
#!/bin/csh
set INC=/home/lavigne/waves/g2lib/g2clib-1.0.2
set CFLAGS=$(INC)
set CC=cc
set LIBRARY=libgrib2c.a
set ARFLAGS=-X64
all: $(LIBRARY)
$(LIBRARY)(gridtemplates.o): gridtemplates.h
$(LIBRARY)(pdstemplates.o): pdstemplates.h
$(LIBRARY)(drstemplates.o): drstemplates.h
$(LIBRARY): $(LIBRARY)(gridtemplates.o) \
$(LIBRARY)(drstemplates.o) \
$(LIBRARY)(pdstemplates.o) \
$(LIBRARY)(gbits.o) \
$(LIBRARY)(g2_unpack1.o) \
$(LIBRARY)(g2_unpack2.o) \
$(LIBRARY)(g2_unpack3.o) \
$(LIBRARY)(g2_unpack4.o) \
$(LIBRARY)(g2_unpack5.o) \
$(LIBRARY)(g2_unpack6.o) \
$(LIBRARY)(g2_unpack7.o) \
$(LIBRARY)(g2_free.o) \
$(LIBRARY)(g2_info.o) \
$(LIBRARY)(g2_getfld.o) \
$(LIBRARY)(simunpack.o) \
$(LIBRARY)(comunpack.o) \
$(LIBRARY)(pack_gp.o) \
$(LIBRARY)(reduce.o) \
$(LIBRARY)(specpack.o) \
$(LIBRARY)(specunpack.o) \
$(LIBRARY)(rdieee.o) \
$(LIBRARY)(mkieee.o) \
$(LIBRARY)(int_power.o) \
$(LIBRARY)(simpack.o) \
$(LIBRARY)(compack.o) \
$(LIBRARY)(cmplxpack.o) \
$(LIBRARY)(misspack.o) \
$(LIBRARY)(jpcpack.o) \
$(LIBRARY)(jpcunpack.o) \
$(LIBRARY)(pngpack.o) \
$(LIBRARY)(pngunpack.o) \
$(LIBRARY)(dec_jpeg2000.o) \
$(LIBRARY)(enc_jpeg2000.o) \
$(LIBRARY)(dec_png.o) \
$(LIBRARY)(enc_png.o) \
$(LIBRARY)(g2_create.o) \
$(LIBRARY)(g2_addlocal.o) \
$(LIBRARY)(g2_addgrid.o) \
$(LIBRARY)(g2_addfield.o) \
$(LIBRARY)(g2_gribend.o) \
$(LIBRARY)(getdim.o) \
$(LIBRARY)(g2_miss.o) \
$(LIBRARY)(getpoly.o) \
$(LIBRARY)(seekgb.o)
# $(LIBRARY)(getfield.o) \
# $(LIBRARY)(gettemplates.o) \
# $(LIBRARY)(getlocal.o) \
# $(LIBRARY)(gribinfo.o) \
# $(LIBRARY)(ixgb2.o) \
# $(LIBRARY)(getg2i.o) \
# $(LIBRARY)(getg2ir.o) \
# $(LIBRARY)(getgb2s.o) \
# $(LIBRARY)(getgb2r.o) \
# $(LIBRARY)(getgb2l.o) \
# $(LIBRARY)(getgb2.o) \
# $(LIBRARY)(putgb2.o) \
# $(LIBRARY)(params.o)
.c.a:
$(CC) -c $(CFLAGS) $<
ar $(ARFLAGS) -ruv $@ $*.o
rm -f $*.o
Error :
./modified_makefile
Illegal variable name.
=======
Is anyone can advise me for debugging this?
Thanks
===========================================
// Akeson Chihiro Conspiracy
// Some exist through what they do...
// We exist through what we are
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I am new to shell scripting and makefile. I want a command's output in
makefile to process further, can anyone plz suggest me a way ?
I want ls -d *.dsm output in a variable and want to process it in makefile itself.
It's urgent
Thanks In advance (0 Replies)
Discussion started by: madhu12345
0 Replies
2. Shell Programming and Scripting
Hi,
Can we execute a shell script by makefile.
I mean we will write a shell script in a make file and it will be executed when we compile the C++ program using make file. (2 Replies)
Discussion started by: surjyap
2 Replies
3. Shell Programming and Scripting
Is there a way to write a makefile for all the source files in a directory with a shell script? (2 Replies)
Discussion started by: zzhan
2 Replies
4. UNIX for Advanced & Expert Users
Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error:
make: module: command not found
Why is this? Is there any way to run this command in a Makefile?
NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies
5. Shell Programming and Scripting
Hi All
I am creating a makefile and I want to do a clean section.
In the clean section I would like to check if the file exists and then delete it.
I always have an error 'unexpected end of file'
What's wrong in it?
Thanks
msntn
firstCpp: first.cpp
g++ -o first first.cpp
clean:
... (1 Reply)
Discussion started by: manustone
1 Replies
6. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies
7. Shell Programming and Scripting
I'm writing a VERY simple shell script. I need to call a makefile in a subdirectory. What's the command I need to use?
./dir/make and ./dir/makefile doesn't work.
Thanks in advance (1 Reply)
Discussion started by: yamahabob
1 Replies
8. Shell Programming and Scripting
Hello,
I have a Makefile that converts wrl (vrml) files to html files...
how can I use a shell script in that makefile which works on all html files after converting?
The Shell Script have to find and replace a String in every createt html file.
sorry I'm a Newbie, so I hope someone can... (0 Replies)
Discussion started by: Dan_78
0 Replies
9. Shell Programming and Scripting
How do we create a shell script that creates a makefile?
what if we want to use the #include header files too? (2 Replies)
Discussion started by: sslokhan
2 Replies
10. UNIX for Beginners Questions & Answers
Hi there! I am a undergraduate student and recently submitted an assignment for my coursework - however there was one function I could not get to work properly before the due date. Although I don't need to complete this work anymore I would still like to in order to know what was going wrong. If... (11 Replies)
Discussion started by: cherryTango
11 Replies