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

  • SEARCH
  • Home
  • 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 7679781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:57:24+00:00 2026-05-31T17:57:24+00:00

I have written a small makefile for a few simple C programs that compiles

  • 0

I have written a small makefile for a few simple C programs that compiles them and then tests their execution time:

CC = gcc
CFLAGS = -Wall
PTEST = /usr/bin/time -f "%Us"
ARCH=-march=native
OPTIMIZATION=
NOPTIMIZATION=

%comp : %.c
    $(CC) $(CFLAGS) $(NOPTIMIZATION) -o $* $<
    $(CC) $(CFLAGS) $(OPTIMIZATION) -o $*_opt $<
    $(CC) $(CFLAGS) $(NOPTIMIZATION) $(ARCH) -o $*_arch $<
    $(CC) $(CFLAGS) $(OPTIMIZATION) $(ARCH) -o $*_opt_arch $<

%test:  
    @echo ---$<---  
    @echo Bez optymalizacji, bez podowania architektury
    @$(PTEST) ./$*
    @echo Bez optymalizacji, uwzgledniana architektura
    @$(PTEST) ./$*_arch
    @echo Opcja $(OPTIMIZATION), bez podawania architektury
    @$(PTEST) ./$*_opt
    @echo Opcja $(OPTIMIZATION), uwzgledniania architektura
    @$(PTEST) ./$*_opt_arch

loop%:OPTIMIZATION=-O2
logic%:OPTIMIZATION=-O1
math%:OPTIMIZATION=-O1 -ffast-math
recursive%:OPTIMIZATION=-O2 -foptimize-sibling-calls
recursive%:NOPTIMIZATION=-O2 -fno-optimize-sibling-calls

#all: loopcomp logiccomp mathcomp recursivecomp looptest logictest mathtest  recursivetest 

loop:loopcomp looptest

clean:
    rm -rf loop loop_opt loop_arch loop_opt_arch \
    logic logic_opt logic_arch logic_opt_arch \
    math math_opt math_arch math_opt_arch \
    recursive recursive_opt recursive_arch recursive_opt_arch

When I type make loop it compiles and tests them but then it invokes strange implicit rule that does this:

gcc -Wall    loop.c loopcomp looptest   -o loop
gcc: error: loopcomp: No such file or directory
gcc: error: looptest: No such file or directory

I know that this is make implicit rule because when I invoke make -r loop everything goes OK. I can’t figure it out: which built-in implicit rule is make trying to invoke and how can I override it, preferably without adding -r option when invoking make? If it is possible, I would like to override it or somehow diasable make implicit rules inside makefile.

  • 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-31T17:57:25+00:00Added an answer on May 31, 2026 at 5:57 pm

    If you don’t want to create a file called “loop” and you just want to be able to say “make loop” as a way to bundle up other targets (like “make all”) then you should declare “loop” to be phony and make won’t search for implicit rules:

    .PHONY: loop
    loop: loopcomp looptest
    

    If you don’t want to do that but want to ensure that a given target doesn’t undergo implicit rule search, then you should declare an explicit rule for it. A simple way to do that is add a do-nothing recipe, like this:

    loop: loopcomp looptest
            @:
    

    (the “:” command is the shell’s “do-nothing” command).

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

Sidebar

Related Questions

I have written a small util in an app that syncs the time from
I have written a small chat app that uses mysql + php to facilitate
I have written a small app that puts my bluetooth in discoverable mode for
I have written a small XML validator, that takes in an XML file and
I have written a small app, that has a Activity to control and display
I have written a small game in 'c' that has 15 Levels. I am
I have written a small C program that embeds Python. I'm setting it up
I have written a small jquery application that allows a person to slide a
I have written a small wrapper for the dict built-in class that loads entries
I have written a small little script that looks up a work on wikipedia

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.