Statically link the binaries when using --with-libr

This commit is contained in:
pancake 2018-10-22 15:10:29 +02:00
parent 4c6aca5cd7
commit f97aded52a

View File

@ -19,7 +19,6 @@ OBJ+=${BIN}.o
BEXE=${BIN}${EXT_EXE}
LDFLAGS+=${DL_LIBS}
LDFLAGS+=${LINK}
ifneq (${ANDROID},1)
ifneq (${OSTYPE},windows)
ifneq (${OSTYPE},linux)
@ -40,24 +39,34 @@ endif
# Rules for programs #
#--------------------#
LDFLAGS+=-lm
# For some reason w32 builds contain -shared in LDFLAGS. boo!
ifneq ($(BIN)$(BINS),)
all: ${BEXE} ${BINS}
ifeq ($(WITH_LIBR),1)
${BINS}: ${OBJS}
${CC} ${CFLAGS} $@.c ${OBJS} ../../libr/libr.a -o $@ $(LDFLAGS)
${BEXE}: ${OBJ} ${SHARED_OBJ}
${CC} ${CFLAGS} $+ -L.. -o $@ ../../libr/libr.a $(LDFLAGS)
else
${BINS}: ${OBJS}
ifneq ($(SILENT),)
@echo CC $@
endif
${CC} ${CFLAGS} $@.c ${OBJS} ${REAL_LDFLAGS} -o $@
${CC} ${CFLAGS} $@.c ${OBJS} ${REAL_LDFLAGS} $(LINK) -o $@
# -static fails because -ldl -lpthread static-gcc ...
${BEXE}: ${OBJ} ${SHARED_OBJ}
ifneq ($(SILENT),)
@echo LD $@
endif
${CC} ${CFLAGS} $+ -L.. -o $@ $(REAL_LDFLAGS)
${CC} ${CFLAGS} $+ -L.. -o $@ $(REAL_LDFLAGS) $(LINK)
endif
endif
# Dummy myclean rule that can be overriden by the t/ Makefile