Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Looking for Makefile example/help
man make on my linux box is not much help.
Don't have a make book.

This directory is getting too crowded.
I would like to have it seperated out into the following directories

src
include
obj/Linux
obj/Solaris
bin/Linux
bin/Solaris
test/Linux
test/Solaris

The method below takes me a lot of time to maintain dependancies
makedepend does not recognize that some of the files are in a .a

Everything is currently in RCS


I don't use any ide, just a shell, nedit and a makefile.

Need example please.
Here's what I'd like to see.  I know I'm close but syntax errors are
killing me:
define  Cpu_type
if   [ `/bin/uname -s` = 'SunOS'    ] ; then echo SunOS ; \
elif [ `/bin/uname -s` = 'Linux'    ] ; then echo Linux ; \
fi
endef

define  Inst
if   [ `/bin/uname -s` = 'SunOS'    ] ; then echo
/usr/local/bin/install ; \
elif [ `/bin/uname -s` = 'Linux'    ] ; then echo /usr/bin/install ; \
fi
endef

define  Date_time
/bin/date '+%d%h%y/%H:%M\(%Z\)'
endef



CPP           = purify -windows=no -log-file=purify.log g++
CPP           = purify g++
CPP           = g++
INC           = -Iinclude
CPPFLAGS      = -g3 -Wall -DDEBUG_LAFFREAD $(INC)
CPPFLAGS      = -O3 -Wall $(INC)
CPPFLAGS      = -g3 -O2 -Wall $(INC)
CPPFLAGS      = -g3 -Wall $(INC)
OS            = $(shell $(Cpu_type))
INSTALL       = $(shell $(Inst))
OLIBS         =
MKDIR         = /bin/mkdir -p
PREFIX        = .
MAKE_SH       = /data/cdmg/dev/cdmg_toolbox/programs/make_sh
INS_DIR       = $(PREFIX)/bin/$(OS)
LIBS          = $(OS)/libcdmg.a $(OS)/lib/libpcre.a
LIB           = $(OS)/libcdmg.a
TLIB          = $(OS)/libcdmgT.a
AR            = ar
AR_OPT        = rv
AR_CREATE_OPT = cr
SRCDIR        = src

# no syntax error to there
OBJ_FILES     =  \
$(LIB)(break_pyr.o) \
$(LIB)(ControlFile.o) \

T_OBJ_FILES   = \
$(TLIB)(t_ListDirectory.o) \
$(TLIB)(t_MakePath.o) \
$(TLIB)(t_ExCommand.o) \
$(TLIB)(t_Ui.o) \

PROGRAMS      = \
BreakPyrName \
CleanLaff \
FigsOnLayer \


.SUFFIXES:
.SUFFIXES: .cxx .cpp .c .a

all : $(LIB) \
$(addprefix $(OS)/,$(PROGRAMS))   <<<<< MISSING SPPERATOR HERE

.cxx.a : $(LIB)
$(CPP) -c $(CPPFLAGS) $<
$(AR) $(AR_OPT) $@ $*.o > /dev/null
rm $*.o

$(OS)/% : %.cxx
@if [ ! -d $(OS) ]; then \
$(MKDIR) $(OS) ; \
fi;
$(CPP) $(CPPFLAGS) $< -o $@ $(OLIBS) $(LIBS)

TEST : $(LIB) $(TLIB) TEST.cxx
$(CPP) $(CPPFLAGS) -o $(OS)/$@ TEST.cxx $(OLIBS)  $(TLIB) $(LIBS) -lm

test : TEST
$(OS)/TEST 1> /dev/null

$(LIB) : $(OBJ_FILES)
$(AR) $(AR_CREATE_OPT) $(LIB)

$(TLIB) : $(T_OBJ_FILES)
$(AR) $(AR_CREATE_OPT) $(TLIB)


--
___  _ ____       ___       __  __
/ _ )(_) / /_ __  / _ \___ _/ /_/ /____  ___
/ _  / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/   \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455,  b-patton@ti.com

Report this thread to moderator Post Follow-up to this message
Old Post
Billy N. Patton
10-18-04 09:00 PM


Re: Looking for Makefile example/help
Billy N. Patton wrote:

> man make on my linux box is not much help.
> Don't have a make book.

I don't know enough about make to answer your question, but "info make"
provides more complete information than "man make".

> This directory is getting too crowded.
> I would like to have it seperated out into the following directories

Have a look at "info make recursion".

Hope I could help (a little),

Heiko

Report this thread to moderator Post Follow-up to this message
Old Post
Heiko
10-18-04 09:00 PM


Re: Looking for Makefile example/help
"Heiko" <heiko.noordhof_A_xs4all.nl> wrote:

> Have a look at "info make recursion".

Ha. Have a look at:

http://www.tip.net.au/~millerp/rmch...-cons-harm.html

Peter Miller's "Recursive Make Considered Harmful".

Even if you don't agree with the author's points - and it's a well written
paper IMHO - there are some interesting insights into make for the
intermediate user.




Report this thread to moderator Post Follow-up to this message
Old Post
Martin Carpenter
10-19-04 02:05 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Unix Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:54 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.