Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make file issue: error at every line

I try to build a library of some project. When I run it as ./MakeFile from terminal I get a bunch of errors for every line. Below is the makefile and the errors. What is wrong with it? For other project Makefie works fine, so it is not that the system does not know how to interpret this file. Thanks!

LIBDIR = ../../lib

IFLAGS = -I../../include -I/usr/local/include

CFLAGS = $(IFLAGS) -O3 -Wunused -m32 #-fPIC

CC = gcc

AR = ar

SRC =   allocfailed.c cleanup.c ECDFwd.c ECDLeadField.c ECDSolve.c ECDSolve2.c \
    GetBasis.c  GetCoeffs.c GetHull.c NLeadField.c NSolveFwd.c NSolveWts.c \
    rnynm.c xbd.c xlubksb.c xludcmp.c

OBJ =   $(SRC:.c=.o)

all:    liblfu.a

liblfu.a: $(OBJ)
    $(AR) cr liblfu.a $(OBJ)
    @mkdir -p $(LIBDIR)
    mv liblfu.a $(LIBDIR)

clean:
    /bin/rm -rf *.o *.il *.a core


./Makefile: line 1: LIBDIR: command not found
./Makefile: line 3: IFLAGS: command not found
./Makefile: line 5: IFLAGS: command not found
./Makefile: line 5: CFLAGS: command not found
./Makefile: line 7: CC: command not found
./Makefile: line 9: AR: command not found
./Makefile: line 11: SRC: command not found
./Makefile: line 15: SRC:.c=.o: command not found
./Makefile: line 15: OBJ: command not found
./Makefile: line 17: all:: command not found
./Makefile: line 19: OBJ: command not found
./Makefile: line 19: liblfu.a:: command not found
./Makefile: line 20: AR: command not found
./Makefile: line 20: OBJ: command not found
./Makefile: line 20: cr: command not found
./Makefile: line 21: LIBDIR: command not found
./Makefile: line 21: @mkdir: command not found
./Makefile: line 22: LIBDIR: command not found
like image 779
user1597969 Avatar asked Apr 25 '13 17:04

user1597969


1 Answers

You are running the make file as a script, just type make

The make command takes Makefile (or makefile) as a default input. It is not runnable.

You can make it runnable by adding (assuming make is in /usr/bin)

#!/usr/bin/make -f

as the first line of the file

like image 118
parkydr Avatar answered Oct 07 '22 18:10

parkydr