Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 817243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:57:45+00:00 2026-05-15T01:57:45+00:00

I have a make build system that I am trying to decipher that someone

  • 0

I have a make build system that I am trying to decipher that someone else wrote. I am getting an error when I run it on a redhat system, but not when I run it on my solaris system. The versions of gmake are the same major revision (one off on minor revision).

This is for building a C project, and the make system has a global Makefile.global that is inherited by each directory’s local Makefile

The Makefile.global has all the targets in it, starting with

 all: $(LIB) $(BIN)

The global file also has the following line

 ifndef INCLUDE_GEN_DEPS
 sinclude $(GEN_DEPS)
 endif

where LIB builds libs and BIN builds binaries.

jumping down the targets I have

 $(LIB) : $(GEN_LIB) 

 $(GEN_LIB) : $(GEN_DEPS) $(GEN_OBJS)
      $(AR) $(ARFLAGS) $(GEN_LIB) $(GEN_OBJS)
 $(GEN_DEPS) :
      @set -e; rm -f $@; \
      $(CC) $(CDEP_FLAG) $(CFLAGS) $(INCDIRS) `basename $@ | sed 's/\.d/\.c/' | sed 's,^,$(HOME_SRC)/,'` | sed 's,\(.*\)\.o: ,$(GEN_OBJDIR)/\1.o $@ :,g' > $@.tmp ; \
      cat $@.tmp > $@ ; \
      cat $@.tmp | cut -d: -f2 | grep '\.h' | sed 's,\.h,.h :,g' >> $@ ; \
      rm $@.tmp
  $(GEN_OBJS) :
       $(CC) $(CFLAGS) $(INCDIRS) -c $(*F).c -lmpi -o $@

I think these are all the relevant targets I need to include to answer my question.

Definitions of those variables:

 CC = icc
 CDEP_FLAG = -M
 CFLAGS = various compiler flags ifdef type flags
 INCDIRS = include directory where all .h files are
 GEN_OBJDIR = /lib/objs
 HOME_SRC = .
 GEN_LIB = lib/$(LIB)
 GEN_DEPDIR=/lib/deps
 GEN_DEPS = $(addprefix $(GEN_DEPDIR)/,$(addsuffix .d,$(basename $(OBJS))))

I think this has everything covered you need. Basically self explanatory from the names.

Now as best I can tell, this is generating in /lib/deps a .d file that has the object and source dependencies in it. In other words, for the utilities.a library, I will get a utils.o and utils.c dependency stack, all in the file utils.d

There is some syntax error that is being generated in that file I think, because I get the following error:

 ../lib/deps/util.d:25: *** target pattern contains no '%'. Stop.
 gmake[2]: *** [all] Error 2
 gmake[1]: *** [all] Error 2
 gmake: *** [all] Error 2

I am not sure if my error is in the dependency generation, or some further down part, like the object generation target?

If you need further info, let me know, I will add to post

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:57:45+00:00Added an answer on May 15, 2026 at 1:57 am

    Compare what gets written into lib/deps/util.d on your working (Solaris) machine with the non-working (redhat), paying particular attention to line 25. That will probably give you a good hint as to what’s going wrong.

    If they’re identical, the problem is the one-off make minor version.

    If thye’re different, the problem is probably some difference between the tools being run, or (more likely) different versions of icc installed.

    edit

    decoding make rule:

    $(GEN_DEPS) :
            @set -e; rm -f $@; \
            $(CC) $(CDEP_FLAG) $(CFLAGS) $(INCDIRS) `basename $@ | sed 's/\.d/\.c/' | sed 's,^,$(HOME_SRC)/,'` | sed 's,\(.*\)\.o: ,$(GEN_OBJDIR)/\1.o $@ :,g' > $@.tmp ; \
            cat $@.tmp > $@ ; \
            cat $@.tmp | cut -d: -f2 | grep '\.h' | sed 's,\.h,.h :,g' >> $@ ; \
            rm $@.tmp
    

    This rule makes the dependency files in $(GEN_DEPS), which correspond to all the source files with the .c changed to .d

    @set -e; rm -f $@;
    

    Cause any errors to immediately exit this rule with a failure, rather than continuing, and remove the target we’re about to regenerate

    $(CC) $(CDEP_FLAG) $(CFLAGS) $(INCDIRS) `basename $@ | sed 's/\.d/\.c/' | sed 's,^,$(HOME_SRC)/,'` | sed 's,\(.*\)\.o: ,$(GEN_OBJDIR)/\1.o $@ :,g' > $@.tmp ;
    

    Run icc on the .c file corresponding to the .d file we’re trying to generate with flags to automatically generate dependencies instead of compiling. The basename $@ | sed 's/\.d/\.c/' | sed 's,^,$(HOME_SRC)/,'
    clause is translating the .d name back to the .c name.

    Pipe the output (which is the depdendency rules) to the sed script sed 's,\(.*\)\.o: ,$(GEN_OBJDIR)/\1.o $@ :,g', which will add the dependency file itself as a something that depends on everything that icc found for the .o (object) file to depend on. Write all of this to a temp file.

    cat $@.tmp > $@ ;
    

    Copy the temp file to the output dependency file.

    cat $@.tmp | cut -d: -f2 | grep '\.h' | sed 's,\.h,.h :,g' >> $@ ;
    

    Append a second copy of the dependencies to the dependency file, modified by a little script which strips off the target and makes the first header into the target. So this is adding an additional set of dependencies for the first header file that appears in the source file.

    rm $@.tmp
    

    Remove the temp file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to make a schema for an XML format that's already being used.
When working in the unmanaged world, we have to make sure that we clean
I have a problem. I built a script to make a request to an
I have to make column charts in Excel using VBA only (no user input).
I have a control which I have to make large modifications to. I'd like
For my university assignment I have to make a networkable version of pacman. I
In our application we sometimes have to make minor GUI modifications for different customers:
I'm working on an application where users have to make a call and type
I'm busy with an asignment where i have to make a graphical interface for
In a WPF UserControl, I have to make to call to a WebService. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.