Link to home
Start Free TrialLog in
Avatar of huffmana
huffmanaFlag for United States of America

asked on

Using Makefile@1.1 to compile

I have to compile a C++ application (I think - but a lot looks like C code) that uses Makefile@1.1 make files.  I was never very good at MakeFile and I need help knowing how to do this compilation.  I am compiling under Solaris 10 gcc version 3.4.2.  The file names look like this (parserAdapter.cc@1.1  parserAdapter.h@1.1).  The following is an example of the
-  Makefile
-  A snippet of code
-  The includes used\
Please HELP, Allan


=====================================================
Example of a Makefile
=====================================================
# cat Makefile@1.1
LD = g++
LDFLAGS =
CC = g++

###
#
# compiler flags
#
# delivery:
# CFLAGS = -O2
#
# debug:
# CFLAGS = -g -Wall

CFLAGS = -g -Wall

OLD_PARSER_INCLUDE = ../../parser
RESOLVER_HEADER_INCLUDE = ../../resolver

OBJS = \
 parserAdapter.o

all: ${OBJS}

parserAdapter.o: parserAdapter.h parserAdapter.cc\
 ${OLD_PARSER_INCLUDE}/MenuDataNodes.h\
 ${RESOLVER_HEADER_INCLUDE}/contMenus.h
        ${CC} ${CFLAGS}\
 -I${OLD_PARSER_INCLUDE}\
 -I${RESOLVER_HEADER_INCLUDE}\
 -c parserAdapter.cc

clean:
        rm -rf ${OBJS}
#

=================================================
A snippet of code looks like this:
=================================================
# cat orderableItem.cc@1.1
#include "orderableItem.h"
#include "cdsObject.h"
#include "stringToUl.h"

orderableItem::orderableItem()
  : itemType(None), item(NULL), hasOrder(false), order(0)
{}

orderableItem::orderableItem(type t, cds_object_t * cdsi)
  : itemType(t), item(cdsi), hasOrder(false), order(0)
{
        hasOrder = extractOrder(cdsi, order);
}

orderableItem::orderableItem(type t, unsigned long o)
  : itemType(t), item(NULL), hasOrder(true), order(o)
{}

orderableItem::orderableItem(type t)
  : itemType(t), item(NULL), hasOrder(false), order(0)
{}

orderableItem::orderableItem(const orderableItem & rhs)
  : itemType(rhs.itemType),
        item(rhs.item),
        hasOrder(rhs.hasOrder),
        order(rhs.order)
{}

==========================================================
The includes are as follows
==========================================================
#include "cds.h"
#include "MenuDataNodes.h"
#include "parser.tab.h"
#include "scanner.h"
#include <stdio.h>
#include <string>
#include <vector>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctype.h>
#include <deque>
#include <Dt/Session.h>
#include <Dt/Wsm.h>
#include <errno.h>
#include <fstream>
#include <grp.h>
#include <io.h>
#include <iostream>
#include <list>
#include <malloc.h>
#include <map>
#include <pwd.h>
#include <queue>
#include <set>
#include <signal.h>
#include <stdarg.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <strings.h>
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <vector>
#include <wait.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/StringDefs.h>
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <Xm/CascadeB.h>
#include <Xm/DrawingA.h>
#include <Xm/Form.h>
#include <Xm/Frame.h>
#include <Xm/MainW.h>
#include <Xm/MessageB.h>
#include <Xm/MwmUtil.h>
#include <Xm/Protocols.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/ScrolledW.h>
#include <Xm/Separator.h>
#include <Xm/Text.h>
#include <Xm/ToggleB.h>
#include <Xm/Xm.h>
#include <Xm/XmAll.h>

      ${CC} ${CFLAGS} ${CDS_INCLUDE} -c cdsObject.cc
      ${CC} ${CFLAGS} ${INCLUDES} -c cdsDeleteClasses.c
      ${CC} ${CFLAGS} ${INCLUDES} -c cdsDeleteObjects.c
      ${CC} ${CFLAGS} ${INCLUDES} -c cdsDeleteOneObject.c
      ${CC} ${CFLAGS} ${INCLUDES} -c cdsDeleteTree.c
      ${CC} ${CFLAGS} ${INCLUDES} -c cdsVaCreateClass.c
      ${CC} ${CFLAGS} ${INCLUDES} -c cdsVaCreateObject.c
      ${CC} ${CFLAGS} ${INCLUDES} -c cleanCDSPath.c
      ${CC} ${CFLAGS} ${INCLUDES} -c getCDSNameDepth.c
      ${CC} ${CFLAGS} -I${UTIL_HEADER_INCLUDE} -c basicSegmentInfo.cc
      ${CC} ${CFLAGS} -I${UTIL_HEADER_INCLUDE} -c MakeLinkNamesUnique.cc
      ${CC} ${CFLAGS} -I${UTIL_HEADER_INCLUDE} -c orderByDependencies.cc
      ${CC} ${CFLAGS} -I${UTIL_HEADER_INCLUDE} -c RemoveCycles.cc

Avatar of wayside
wayside

There likely is one "master" makefile that will call all the others as part of a build. You need to find that makefile and examine it for targets to build.

For a regular makefile, you just type

> make target

if the makefile is well written it will cd to dependent directories and do a make there, and then put everything together into your app.

I assume it is something similar for Makefile1@1 files, I never heard of it before so I can;t say for sure.
Avatar of huffmana

ASKER

Thanks for your reply.  I feel much better to know that I am not alone in this :-)

I looked around for something that looks like a main make file but they all have the @1.1 ending (following).  This must be a version control mechanism.  

Is the "target" for "make target" a Makefile?  Or am I looking for something like the "Main-Line" .cc program of the application?

# find . -name "*ake*"
./IMM_cleaner/Makefile@1.1
./cdsHelper/Makefile@1.1
./resolver/MakeLinkNamesUnique.cc@1.1
./resolver/Makefile@1.1
./resolver/MakeLinkNamesUnique.h@1.1
./parser/Makefile@1.1
./IMM_executable/Makefile@1.1
./adapters/cds/Makefile@1.1
./adapters/parser/Makefile@1.1
./adapters/c_info_records/Makefile@1.1
./IMM_displayer/Makefile@1.1
./IMM_parser/Makefile@1.1
./util/Makefile@1.1
./basicPackgInfo/Makefile@1.1

# cd ./basicPackgInfo
# cat Makefile@1.1

LD = g++
LDFLAGS =
CC = g++

###
#
# compiler flags
#
# delivery:
# CFLAGS = -O2
#
# debug:
# CFLAGS = -g -Wall

UTIL_HEADER_INCLUDE = ../util

CFLAGS = -g -Wall

OBJS = \
 basicPackgInfo.o\
 orderByDependencies.o

all: ${OBJS}

basicPackgInfo.o: basicPackgInfo.h basicPackgInfo.cc
        ${CC} ${CFLAGS} -I${UTIL_HEADER_INCLUDE} -c basicPackgInfo.cc

orderByDependencies.o: orderByDependencies.h orderByDependencies.cc
        ${CC} ${CFLAGS} -I${UTIL_HEADER_INCLUDE} -c orderByDependencies.cc

clean:
        rm -rf ${OBJS}
I found something that looks a little different in one of the Makefile@1.1, see the following line with "g++ -v $(OBJS) -o $(PROG) $(LIBS)" for "parser."  Perhaps parser is the starting point....

Thanks, Allan
 
# find . -exec grep g++ {} \; -print
LD = g++
CC = g++
./IMM_cleaner/Makefile@1.1
LD = g++
CC = g++
./resolver/Makefile@1.1
LD = g++
CC = g++
./parser/Makefile@1.1
        g++ -v $(OBJS) -o $(PROG) $(LIBS)
./IMM_executable/Makefile@1.1
LD = g++
CC = g++
./adapters/cds/Makefile@1.1
LD = g++
CC = g++
./adapters/parser/Makefile@1.1
LD = g++
CC = g++
./adapters/c_info_records/Makefile@1.1
LD = g++
CC = g++
./IMM_displayer/Makefile@1.1
LD = g++
CC = g++
./IMM_parser/Makefile@1.1
LD = g++
CC = g++
./util/Makefile@1.1
LD = g++
CC = g++
./basicPackgInfo/Makefile@1.1
The Makefile@1.1 for parser only references programs that are in it's same directory - not all the other directories with the other parts to the application.  I can't find the main Makefile.... :-/
ASKER CERTIFIED SOLUTION
Avatar of wayside
wayside

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh, and a makefile doesn't have to be named "Makefile", it could be make.unix or anything really. You'll have to poke around the directories and see what you find, it should be in the top level directory of your source tree though.
I found that if I copy the C-code, header files, and Makefile to remove the @1.1 from the end, the "make" command actually executes the Makefile !!!  Now I'l tryiing to write a script that will strip off the @1.1 from all the files.  There are too many to do by hand...
Thanks, Allan
There are no "cd " in any of the Makefile files but there are a lot of references like this " ../../adapters/cds/cdsSource.o\."  So I presume that it is making relative paths instead of changing directories.  

And there 4 files that are not named .c, .cc, or .h as follows:
    /util/PackgInfolex.lex = c-code program
    /parser/parser.bison@ = c-code program
    /parser/scanner.lex = c-code program
    /parser/parser.output = looks like an output format in C-code for outputing some messages

So it seems that all the Makefile are actually called Makefile .....

You guys are a big help.  I am actually getting a feel for this application :-)  

Already I owe you a million thanks, Allan
Glad to help. I am curious about the @1.1 stuff though. I wonder what tool that is from.
Wayside,

I was just told that it is a CM tool that does this but I was not told which one.  If you are interested I'll ask about it.

BTW (with the help of Experts-Ecahcnge) this is the script I used to strip off the @1.1 extension:
for i in `find . -type f`
do
cp $i `echo $i | sed 's/@.*//'`
done

Thanks a million times :-) Allan