0
Когда я печатаю, ничего не происходит. Если я сделаю это с Linux Ubuntu, тогда создадим свои проекты. Почему он не будет работать с BSD? Makefile является:Как использовать makefile с OpenBSD 5.8
##################################################
## 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 [email protected] $^
# These programs can not be compiled as ANSI-standard C.
tst%.o: tst%.c
$(CC) -c $(CFLAGS) $< -o [email protected]
# But the rest should be ANSI-standard C.
%.o: %.c
$(CC) -c $(all_cflags) $< -o [email protected]
clean:
-rm -f *.o core $(execs)
Это сессия:
$ 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
$
Если я печатаю make malloc
тогда я получаю этот выход, который я не понимаю:
$ 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')
$
Что значит «ничего не происходит»? Что-то должно произойти. Вы получили сообщение об ошибке? Вы вообще ничего не получаете? Вы попадаете в следующее приглашение? Разве оболочка висит? Имя этого файла 'Makefile'? Какую версию 'make' вы используете? –
Я использую '/ usr/bin/make' из OpenBSD 5.8. Он не зависает, он представляет новое приглашение без вывода компилятора. Makefile работает с Ubuntu. –
Это удивительно. Каков код возврата от запуска make? (т. е. что делает 'make; echo" $? "'output?). Говоря, что это make-файл GNU make make и make-файл openbsd, определенно ** не ** GNU make, так что, вероятно, это не сработает , –