help with Makefile

help with Makefile

Post by Bill Danie » Thu, 02 Aug 1990 19:12:00



I am having trouble creating a reasonable Makefile for a system with sources
and executables in separate directories.  The current Makefile resides in the
bin directory, easily recognizing the executable dependencies. A preprocessor
required by UNIFY seems to need to be run from the source directory
seemingly forcing the ".o" dependency to chdir to the src directory before
executing (ucc for those of you familiar with UNIFY).  Here's a cut of the
current entry:

DEFS=../def
DIR1=../src
INC=/usr/include
UNINC=/unify/include
LOCINC=../src/include
UCC=/unify/bin/ucc -c -R -O
ULD=/unify/bin/uld

init_db: $(DIR1)/init_db.o
        /bin/sh $(ULD) init_db \
            $(DIR1)/init_db.o

$(DIR1)/init_db.o: $(DIR1)/init_db.c $(DEFS)/file.h \
                   $(LOCINC)/cr.h $(LOCINC)/input.h
        cd $(DIR1); $(UCC) init_db.c

This works ok!  My problems have appeared with the decision to install the
sources in sccs.  The augmented make does all the wonderfully proper things
about "get -p"ing if necessary but leaves ugly ".c"s around after the
compilation has completed.  Moving the Makefile into the src directory
leaves my executables in the source directory, which we would like to avoid.
HELP!!!
--
bill daniels
federal express, memphis, tn
{hplabs!csun,gatech!emcard,mit-eddie!premise}!fedeva!wrd3156

 
 
 

help with Makefile

Post by Rick Schneid » Thu, 02 Aug 1990 16:23:00



Quote:

> ... but leaves ugly ".c"s around after the
> compilation has completed.

< init_db: $(DIR1)/init_db.o
<    /bin/sh $(ULD) init_db \
<        $(DIR1)/init_db.o
<  
< $(DIR1)/init_db.o: $(DIR1)/init_db.c $(DEFS)/file.h \
<               $(LOCINC)/cr.h $(LOCINC)/input.h
<    cd $(DIR1); $(UCC) init_db.c
        rm -f init_db.c
        ^^^^^^^^^^^^^^^

or add a new directive:

clean:  rm -f $(DIR1)/*.c

and when you want to remove the source files type:

make clean

 
 
 

1. Help debug Makefile

Can someone PLEASE help!
I have tried every possible change to this makefile.
I have traced the error to this portion of the Makefile.
(I am trying to install X Consortiums R6.1).

System particulars are Gnu make, IBM 320 running
AIX3.2.5 (using xlc and cpp to compile).

Makefile fragment:

remote.o: remote.c ,'-DRSHCMD="$(RSHCMD)"'

         $(CC) -c $(CFLAGS) $*.c

remote.i: remote.c


restart.o: restart.c $(_NOOP_)

         $(CC) -c $(CFLAGS) '-DSYSTEM_INIT_FILE="'$(XSMDIR)'/system.xsm"'
$*.c

restart.i: restart.c $(_NOOP_)

         $(CC) -E $(CFLAGS) '-DSYSTEM_INIT_FILE="'$(XSMDIR)'/system.xsm"'

Fails every time on a syntax error (?).  There is another Makefile in the
package that has this same construct and it fails as well.  I have checked
the
obvious things like are the variables all defined (even went so far as to do
the
substitutions myself), with no luck.  I am sure it's something real obvious
to someone.
ANY help would be appreciated...AND Thanks in advance.

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Programmer/Analyst/Systems       http://www.mcsl.com
Matrix Computer Systems, Ltd            Phone: (248) 244-0909
2690 Crooks Road,  Suite 203                 Fax  : (248) 244-0975

2. Determining the IP address of a login

3. Help with MAKEFILE

4. /etc/security/.profile (V3.1.5)

5. Help in Makefile

6. DOOM-WAD Editor foe Linux

7. Help on Makefile

8. How to search for a lost ext2 filesystem?

9. Help with Makefile compiler Flags

10. Help: Corrupt makefile when building GENERIC in 2.2.5!

11. help on makefiles and system timer

12. Help: install/makefiles

13. need help writing makefile