The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script in makefile surjyap Shell Programming and Scripting 2 05-12-2008 10:58 PM
embeding shell script in makefile madhu12345 Shell Programming and Scripting 0 04-29-2008 03:27 AM
Makefile NamrataGurav High Level Programming 7 10-07-2006 03:29 PM
Using cut within makefile wvdeijk UNIX for Dummies Questions & Answers 2 12-14-2005 05:11 PM
makefile help pieter023 Shell Programming and Scripting 1 06-06-2005 02:20 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-04-2005
Akeson Chihiro Akeson Chihiro is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 8
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
 

Bookmarks

Tags
linux commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:21 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0