Advertisement

06.30.2008 at 10:54PM PDT, ID: 23529181
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.5

setting makefile variables from a shell script

Asked by billtouch in Linux Programming, C Programming Language

Tags:

I have a makefile system and it is designed to exec makefiles at each level - each higher level encompassing a greater set of files.  Each makefile can be at any level within the tree.  Each makefile needs to run the Rules.mk file from the top level of the source tree.

My problem is how to make the makefile aware of the top level path. I have a shell script, findtop.sh,  that will do just that. I am now having a problem inserting that into a makefile so that my include of the Rules.mk will work. The findtop script works when run from the command line, but I have had no joy getting it into the makefile. I placed it in the line:
TREE=$(/bin/bash -c findtop.sh)

I tryed placing it before the include with no success.

Can anyone help me find a way to solve this problem????

What would be even more helpful is if the findtop script could actually be placed in the makefile itself. That  will allow me to only have to put one file in each subdir - the makefile itself.

Thanks!
Bill


findtop.sh:
#!/bin/bash

#loop to test if we are in a proper tree
HERE=`pwd`
while [ 1 ]
    do
      cd ..
      CUR=`pwd`
      FIL=`basename $CUR`
      if [ $CUR == "/" ]
      then
      echo Not a Proper Tree!
              exit -1
      fi

      if [ -e "top" ];
      then
              export TREETOP=`pwd`
              cd $HERE
              break
      fi
    done
echo $TREETOP


makefile:
TREE=$(/bin/bash -c findtop.sh)
include $(TREE)/Rules.make

#
# This makefile sets up a dependancy file. This file contains a fully qualified
# list of file names that each source file depends upon.
# If the .depend file does not exist, it will be created.
#
ifeq (.depend,$(wildcard .depend))
all:    targets
include .depend
else
all:    depend targets
endif

# Here we define our target. In this case, the target was defined in
# Rules.make to be a binary file with the same name as sub directory this file
# is in. it is expected to be in the ./bin directory.
targets: $(BINDIR)/$(TARGET)

# This is an alternate method to compile. This will produce individual .o
# files and link them to produce the executable.
$(BINDIR)/$(TARGET): $(OBJS)
      $(CC) -o $(BINDIR)/$(TARGET) $(INCLIST) -L ../lib -lc $(wildcard $(BINDIR)/*.o)

.. etc....
Start Free Trial
[+][-]07.01.2008 at 12:14AM PDT, ID: 21905473

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 01:54AM PDT, ID: 21905885

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 02:16AM PDT, ID: 21905998

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Linux Programming, C Programming Language
Tags: makefile bash script
Sign Up Now!
Solution Provided By: evilrix
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.01.2008 at 11:05AM PDT, ID: 21910072

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 11:18AM PDT, ID: 21910179

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 01:02PM PDT, ID: 21911078

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 01:51PM PDT, ID: 21911521

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906