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 6559201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:17:40+00:00 2026-05-25T13:17:40+00:00

Here is an easy makefile. I have 2 questions. all: $(SOURCES) $(EXECUTABLE) Why put

  • 0

Here is an easy makefile.

I have 2 questions.

  1. all: $(SOURCES) $(EXECUTABLE)
    Why put the SOURCE in the dependency.
  2. “.cpp.o:”
    Why not write “.o: .cpp”

    CC=g++
    
    CFLAGS=-c -Wall
    
    LDFLAGS=
    
    SOURCES=main.cpp hello.cpp factorial.cpp
    
    OBJECTS=$(SOURCES:.cpp=.o)
    
    EXECUTABLE=hello
    
    
    all: $(SOURCES) $(EXECUTABLE)
    
    $(EXECUTABLE): $(OBJECTS) 
    
        $(CC) $(LDFLAGS) $(OBJECTS) -o $@
    
    .cpp.o:
    
        $(CC) $(CFLAGS) $< -o $@
    
  • 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-25T13:17:41+00:00Added an answer on May 25, 2026 at 1:17 pm

    The dependency of all on $(SOURCES) is not necessary or even useful. The dependency information should be such that the executable depends on the object files, and the object files depend on the source files.

    The notation:

    .cpp.o:
    

    was the way the original (7th Edition UNIX™) version of make handled compilation rules. GNU Make (and Sun Make) used the % notation to allow:

    %.o: %.cpp
    

    Basically, it was a design decision that made sense at the time and maybe less sense in retrospect. It was not the most egregious problem (that would be tabs at the start of command lines).

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

Sidebar

Related Questions

here's an easy one (that I'm struggling with)! I have a textarea, a button,
This is most likely not an easy one but here is the situation: I
Here is an easy one :) on REGEX I have this regex ^\\$?(\\d{1,3},?(\\d{3},?)*\\d{3}(\\.\\d{2})?|\\d{1,3}(\\.\\d{2})?|\\.\\d{2}?)$ which
Here's what I have in VERY simple easy to grasp terms. My form background
I have been crafting a makefile for a while now. It supports easy creation
Ok, here's an easy one: I have a table in MySQL where I keep
Short and easy question, but I seem to have a writer's block here: Suppose
Here is an easy one, but can't figure out why is not working. Need
Afternoon all. Here's an easy one for you that I can't figure out. I
All, quick and easy one here... I'm writing an Evaluate function that runs through

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.