내가이 메이크 건너 온 (오픈 소스 프로젝트라고 sendip를 통해 발견)
I가이 파일에 대한이 혼란 -
.c
파일로 지정되고
- 여기에 종속?
ipv6.so
,tcp.so
과 같은 모든 라이브러리가 제대로 생성되지만 여기에는 어떤 라인이 포함되어 있습니까?
나는이 줄이 .....라고 생각한다.
%.so: %.c $(LIBS)
$(CC) -o [email protected] $(CFLAGS) $(LIBCFLAGS) $+ $(LIBS)
그러나 $(LIBS)
은 일부 .o 파일 만 지정합니다. 이 $+
은 무엇인가하고 있습니까?
2. 나는 $+
을 들어 본 적이 없습니다. 나는 그것을 찾으려고 노력했고 $?
, [email protected]
, $<
, 등등과 같은 많은 다른 사람을 우연히 만났지만 결코 이것을 보지 못했습니다. 나는 그것이 $?
처럼 행동한다고 생각하지만, 여전히 .c
depndencies가 요구된다.
메이크 :
이들 중 일부는 GNU에 대한 확장입니다#configureable stuff
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man/man1
LIBDIR ?= $(PREFIX)/lib/sendip
#For most systems, this works
INSTALL ?= install
#For Solaris, you may need
#INSTALL=/usr/ucb/install
CFLAGS= -fPIC -fsigned-char -pipe -Wall -Wpointer-arith -Wwrite-strings \
-Wstrict-prototypes -Wnested-externs -Winline -Werror -g -Wcast-align \
-DSENDIP_LIBS=\"$(LIBDIR)\"
#-Wcast-align causes problems on solaris, but not serious ones
LDFLAGS= -g -rdynamic -lm -ldl
#LDFLAGS_SOLARIS= -g -lsocket -lnsl -lm
LDFLAGS_SOLARIS= -g -lsocket -lnsl -lm -ldl
LDFLAGS_LINUX= -g -rdynamic -lm -ldl
LIBCFLAGS= -shared
CC= gcc-4.4
PROGS= sendip
BASEPROTOS= ipv4.so ipv6.so
IPPROTOS= tcp.so udp.so icmp.so
UDPPROTOS= rip.so ripng.so ntp.so
TCPPROTOS= bgp.so
PROTOS= $(BASEPROTOS) $(IPPROTOS) $(UDPPROTOS) $(TCPPROTOS)
LIBS= libsendipaux.a
LIBOBJS= csum.o compact.o protoname.o headers.o parseargs.o
cryptomod.o crc32.o
SUBDIRS= mec
all: $(LIBS) subdirs sendip $(PROTOS) sendip.1 sendip.spec
#there has to be a nice way to do this
sendip: sendip.o gnugetopt.o gnugetopt1.o compact.o
sh -c "if [ `uname` = Linux ] ; then \
$(CC) -o [email protected] $(LDFLAGS_LINUX) $(CFLAGS) $+ ; \
elif [ `uname` = SunOS ] ; then \
$(CC) -o [email protected] $(LDFLAGS_SOLARIS) $(CFLAGS) $+ ;\
else \
$(CC) -o [email protected] $(LDFLAGS) $(CFLAGS) $+ ; \
fi"
libsendipaux.a: $(LIBOBJS)
ar vr [email protected] $?
subdirs:
for subdir in $(SUBDIRS) ; do \
cd $$subdir ;\
make ;\
cd .. ;\
done
protoname.o: mec/protoname.c
$(CC) -o [email protected] -c -I. $(CFLAGS) $+
headers.o: mec/headers.c
$(CC) -o [email protected] -c -I. $(CFLAGS) $+
parseargs.o: mec/parseargs.c
$(CC) -o [email protected] -c -I. $(CFLAGS) $+
cryptomod.o: mec/cryptomod.c
$(CC) -o [email protected] -c -I. $(CFLAGS) $+
crc32.o: mec/crc32table.h mec/crc32.c
$(CC) -o [email protected] -c -I. $(CFLAGS) mec/crc32.c
mec/crc32table.h: mec/gen_crc32table
mec/gen_crc32table > mec/crc32table.h
sendip.1: ./help2man $(PROGS) $(PROTOS) subdirs VERSION
./help2man -n "Send arbitrary IP packets" -N >sendip.1