Reputation: 26647
When I type make nothing happens. If I do it with Linux Ubuntu then make builds my projects. Why won't it work with BSD? The makefile is:
##################################################
## General configuration
## =====================
# Every Makefile should contain this line:
SHELL=/bin/sh
# Program for compiling C programs.
CC=gcc
# What allocation strategy to use, and number of quick fit lists.
STRATEGY=4
NRQUICKLISTS=6
# Extra flags to give to the C preprocessor and programs that use it (the C and Fortran compilers).
CFLAGS=-DSTRATEGY=$(STRATEGY) -DNRQUICKLISTS=$(NRQUICKLISTS)
# Default plus extra flags for C preprocessor and compiler.
all_cflags=$(CFLAGS) -Wall -Wextra -ansi -O4
# Malloc source file to use. Set to empty (with `make MALLOC=`) for system default.
MALLOC=malloc.c
##################################################
## Setup files variables
## =====================
# Source files to compile and link together
srcs=$(MALLOC) tstalgorithms.c tstcrash.c tstcrash_complex.c tstcrash_simple.c \
tstextreme.c tstmalloc.c tstmemory.c tstmerge.c tstrealloc.c \
tstbestcase.c tstworstcase.c
# Executables
execs=$(patsubst tst%.c, tst%, $(filter tst%.c, $(srcs)))
##################################################
## Ordinary targets
## ================
# http://www.gnu.org/software/make/manual/make.html#Phony-Targets
# These are not the name of files that will be created by their recipes.
.PHONY: all clean
all: $(execs)
tst%: tst%.o $(MALLOC:.c=.o)
$(CC) $(all_cflags) -o $@ $^
# These programs can not be compiled as ANSI-standard C.
tst%.o: tst%.c
$(CC) -c $(CFLAGS) $< -o $@
# But the rest should be ANSI-standard C.
%.o: %.c
$(CC) -c $(all_cflags) $< -o $@
clean:
-rm -f *.o core $(execs)
This is the session:
$ strings `which make` | grep -B1 MAKE_VERSION
$ which make
/usr/bin/make
$ make -V MAKE_VERSION
$ make
$ ls
Makefile tstbestcase_time.gnuplot
README tstcommon.h
README.md tstcrash.c
RUN_TESTS tstcrash_complex.c
a.out tstcrash_simple.c
best.c tstextreme.c
brk.h tstmalloc.c
first.c tstmemory.c
malloc.c tstmerge.c
malloc.h tstrealloc.c
quick.c tstworstcase.c
tst.h tstworstcase.dat.tgz
tstalgorithms.c tstworstcase_memory.gnuplot
tstbestcase.c tstworstcase_time.gnuplot
tstbestcase.dat.tgz worst.c
tstbestcase_memory.gnuplot
$
If I type make malloc
then I get this output which I don't understand:
$ make malloc
gcc -DSTRATEGY=4 -DNRQUICKLISTS=6 -o malloc malloc.c
/usr/lib/crt0.o: In function `_start':
(.text+0xa4): undefined reference to `main'
collect2: ld returned 1 exit status
*** Error 1 in /home/niklas/malloc-master (<sys.mk>:85 'malloc')
$
Upvotes: 1
Views: 2453
Reputation: 676
That's a GNUmakefile
. pkg_add gmake
and then type gmake
, or, rewrite the Makefile
to work under make
.
Upvotes: 3