Thread: I'm trying to use make and all it does is break

  1. #1
    Registered User
    Join Date
    Aug 2022
    Posts
    40

    I'm trying to use make and all it does is break

    Hi Guys,

    I'm learning about "Building a Multiple-File Program". The exercises at the back of the chapter require that I get the example in the book working. This required that I take the time to type up all of the .h and .c programs shown in the book.
    • justify.c
    • line.c
    • line.h
    • word.c
    • word.h
    • justify_make

    // see attached justify.zip

    I can't get them to compile. (see attached image) The chapter also covers 'make' so I decided to try that as a possible solution. It doesn't work for me. BTW: I'm on a windows laptop.

    I've tried "make justify_make" in both bash and on the windows CMD and both come back with:
    $ make justify_make
    make: Nothing to be done for 'justify_make'.

    I was wondering if someone could help me understand what is preventing me from compiling this code?
    Attached Images Attached Images I'm trying to use make and all it does is break-build-multiple-file-program-jpg 
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    May 2012
    Location
    Arizona, USA
    Posts
    945
    I noticed two issues right up front:

    1. To use a makefile with a different name from "Makefile" or "makefile", use make -f justify_make.
    2. You must use a tab to indent makefile recipes, not spaces. This catches a lot of people, even those with a lot of experience with makefiles (it's one of those things that I'm sure the original designer of make regrets).

  3. #3
    Registered User
    Join Date
    Aug 2022
    Posts
    40
    AAAAAHHH, it said to use tab not spaces in the chapter and I forgot! I even underlined it when I read it. Terrible of me. Thank you #christop for the reply. I put in the tabs:

    $ make justify_make
    make: Nothing to be done for 'justify_make'.

    I need to struggle a bit more with this and try to figure it out on my own. YouTube.

  4. #4
    Registered User
    Join Date
    Aug 2022
    Posts
    40
    Okay, after further investigation as well as some luck, I think the problem might be how I was trying to compile the files in code blocks which were all out side of a project. I'm guessing this because when I compile the files on the command line, the program works. Does that sound correct?
    Last edited by mpatters; 12-21-2022 at 08:49 PM.

  5. #5
    Registered User
    Join Date
    Apr 2021
    Posts
    138
    You haven't updated your zip file after being corrected.

    I assume you have fixed the tab problem, but I don't see you fixing the invocation problem that @christop pointed out: you need to either rename the makefile or invoke it using `-f`.

  6. #6
    Registered User
    Join Date
    Aug 2022
    Posts
    40
    Yes, removing spaces from justifymake and using -f "make -f justify_make" fixed the problem. Thank you christop and aghast. I found the documentation to make, reviewing it now: GNU make

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 'break' in c
    By erdemtuna in forum C Programming
    Replies: 2
    Last Post: 12-06-2015, 02:47 PM
  2. Is there something like break(2) (multiple break) ?
    By Phuzzillogic in forum C++ Programming
    Replies: 11
    Last Post: 05-11-2009, 04:05 AM
  3. How can i make a "letter could not be found" break?
    By Welshy in forum C++ Programming
    Replies: 14
    Last Post: 04-12-2005, 02:41 PM
  4. Take a break....
    By NANO in forum C++ Programming
    Replies: 9
    Last Post: 06-25-2002, 11:17 AM
  5. break == bad
    By Unregistered in forum C++ Programming
    Replies: 6
    Last Post: 03-28-2002, 01:08 AM

Tags for this Thread