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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:49:37+00:00 2026-06-17T21:49:37+00:00

I am getting an error when running the following makefile with make -f makefile2

  • 0

I am getting an error when running the following makefile with make -f makefile2 install (apart install the rest is working):

all:myapp

#which compiler
CC = gcc

#Where to install
INSTDIR = /usr/local/bin

#where are include files kept
INCLUDE = .

#Options for development
CFLAGS = -g -Wall -ansi

#Options for release
# CFLAGS = -O -Wall -ansi

myapp: main.o 2.o 3.o
    $(CC) -o myapp main.o 2.o 3.o

main.o: main.c a.h
    $(CC) -I$(INCLUDE) $(CFLAGS) -c main.c

2.o: 2.c a.h b.h
    $(CC) -I$(INCLUDE) $(CFLAGS) -c 2.c

3.o: 3.c b.h c.h
    $(CC) -I$(INCLUDE) $(CFLAGS) -c 3.c         

clean:
    -rm main.o 2.o 3.o

install: myapp
    @if [ -d $(INSTDIR) ]; \
      then \
      cp myapp $(INSTDIR);\
      chmod a+x $(INSTDIR)/myapp;\
      chmod og-w $(INSTDIR)/myapp;\
      echo "Installed in $(INSTDIR)";\
    else
      echo "Sorry, $(INSTDIR) does not exist";\
    fi

I’m getting the following error:

error /bin/sh: 7: Syntax error: end of file unexpected
make: *** [install] Error 2

From what I understand it is a white space/tabulation/non unix character problem in the last lines of the makefile (after install:). But even trying to delete all spaces and replacing with tabulation I didn’t manage to run the makefile properly. The code comes directly from a programming book I’m reading and is an example. Any help appreciated!

  • 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-06-17T21:49:38+00:00Added an answer on June 17, 2026 at 9:49 pm

    You’re missing a trailing slash on your else under the install rule. It should be:

    install: myapp
        @if [ -d $(INSTDIR) ]; \
          then \
          cp myapp $(INSTDIR);\
          chmod a+x $(INSTDIR)/myapp;\
          chmod og-w $(INSTDIR)/myapp;\
          echo "Installed in $(INSTDIR)";\
        else\
          echo "Sorry, $(INSTDIR) does not exist";\
        fi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following error running make : Makefile:168: *** missing separator. Stop.
I am getting the following error while running my MVC application, which uses the
I am getting the following error while running my android project in which I
I am getting following error while running my application which is asp.net. Server Error
I'm getting the error message when running the following code from a C# console
Hey getting the following error when running my MVP Entity Framework App : Keyword
I am getting the following error when running my code: Typeerror: lambda() takes exactly
I'm getting the following error when running brew doctor: Error: Your Cellar and TEMP
I'm getting the following error when running warble under both jRuby 1.3 and 1.4.
I am getting the following error after running git svn rebase: 'update-index --refresh: command

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.