Don't try to build shared libraries if configured as --without-pic.

Specifically, avoid building all plugins as non-static objects,
as well as some supplementary libraries. In fact, a large amount
of plugins was already gated to build as shared objects only with
WITHPIC=1, but this was not done consistently.
This gating has been moved to */p/Makefile.

Building these shared objects is a waste of time and breaks
the --without-pic build unless CFLAGS is forced in the make
invocation.
This commit is contained in:
whitequark 2018-01-10 15:52:50 +00:00 committed by radare
parent 26ef0b9ca6
commit c816dc7e66
17 changed files with 84 additions and 56 deletions

View File

@ -17,7 +17,9 @@ ifeq ($(COMPILER),ios-sdk)
endif
preload:
ifeq ($(WITHPIC),1)
$(MAKE) -C preload
endif
install:
mkdir -p "${DESTDIR}${BINDIR}"
@ -32,10 +34,12 @@ install:
#cp -rf r2pm/d/* "${DESTDIR}${DATADIR}/radare2/${VERSION}/r2pm"
${INSTALL_SCRIPT} ragg2/ragg2-cc "${DESTDIR}${BINDIR}/ragg2-cc"
-cd "${DESTDIR}${BINDIR}" && rm -f r2 ; ln -fs radare2 r2
ifeq ($(WITHPIC),1)
${INSTALL_LIB} "preload/libr2.$(EXT_SO)" "${DESTDIR}${LIBDIR}"
-cd "${DESTDIR}${LIBDIR}" && \
mv libr2.$(EXT_SO) $(LIBR2) && \
ln -fs $(LIBR2) libr2.$(EXT_SO)
endif
ios_sign ios-sign ios-sdk-sign:
for a in $(BINS) ; do xcrun --sdk iphoneos codesign -s- --entitlements radare2/radare2.xml $$a ; done

View File

@ -8,7 +8,7 @@ LDFLAGS+=${LINK}
CURDIR=
ifeq ($(WITHPIC),1)
all: ${ALL_TARGETS} ;
all: ${ALL_TARGETS}
ALL_TARGETS=
# TODO: rename to enabled plugins

View File

@ -12,7 +12,8 @@ endif
CURDIR=
foo: all
ifeq ($(WITHPIC),1)
all: ${ALL_TARGETS}
ALL_TARGETS=
# TODO: rename to enabled plugins
@ -25,12 +26,15 @@ ARCHS+=lh5801.mk v810.mk mcs96.mk lm32.mk
ARCHS+=riscv.mk rsp.mk
include $(ARCHS)
all: ${ALL_TARGETS}
clean:
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}
mrproper: clean
-rm -f *.d ../arch/*/*/*.d
.PHONY: all clean foo mrproper
.PHONY: all clean mrproper
else
all clean mrproper:
.PHONY: all clean mrproper
endif

View File

@ -13,7 +13,8 @@ LDFLAGS+=-L$(LTOP)/io -lr_io
endif
SHLR=$(LTOP)/../shlr
foo: all
ifeq ($(WITHPIC),1)
all: ${ALL_TARGETS}
ALL_TARGETS=
FORMATS=any.mk elf.mk elf64.mk pe.mk pe64.mk te.mk mach0.mk
@ -28,13 +29,15 @@ FORMATS+=xtr_fatmach0.mk
include $(FORMATS)
all: ${ALL_TARGETS}
@true
clean:
-rm -f *.so *.o ${STATIC_OBJ}
mrproper: clean
-rm -f *.d $(TOP)/libr/bin/format/*/*.d
.PHONY: all clean foo mrproper
.PHONY: all clean mrproper
else
all clean mrproper:
.PHONY: all clean mrproper
endif

View File

@ -1,26 +1,25 @@
include ../../config.mk
include ../../../mk/platform.mk
ifeq ($(WITHPIC),1)
ifeq ($(WITHPIC),1)
CFLAGS+=-I../../include -I../arch/ -I../arch/include -Wall ${PIC_CFLAGS} ${LDFLAGS_LIB}
CFLAGS+=-D__UNIX__
foo: all
all: ${ALL_TARGETS}
ALL_TARGETS=
ARCHS=x86.mk arm.mk
include $(ARCHS)
all: ${ALL_TARGETS}
@true
clean:
-rm -f *.so *.o ${STATIC_OBJ}
mrproper: clean
-rm -f *.d
.PHONY: all clean foo mrproper
.PHONY: all clean mrproper
else
all:
all clean mrproper:
.PHONY: all clean mrproper
endif

View File

@ -22,16 +22,13 @@ include $(STOP)/windbg/deps.mk
#CFLAGS+=-L../../anal -lr_anal -L../../core -lr_core
LDFLAGS+=${LINK}
foo: all
ifeq ($(WITHPIC),1)
all: ${ALL_TARGETS}
ALL_TARGETS=
PLUGS=java.mk anal.mk
include $(PLUGS)
all: ${ALL_TARGETS}
@true
clean:
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}
@ -39,3 +36,8 @@ mrproper: clean
-rm -f *.d
.PHONY: all clean foo mrproper
else
all clean mrproper:
.PHONY: all clean mrproper
endif

View File

@ -4,22 +4,23 @@ include ../../../mk/platform.mk
LINK+=-L../../util -lr_util
LDFLAGS+=${LINK}
nop:
foo: all
ifeq ($(WITHPIC),1)
all: ${ALL_TARGETS}
ALL_TARGETS=
CFLAGS+=-I../../include
#ALGOS=aes.mk aes_cbc.mk
include $(ALGOS)
all: ${ALL_TARGETS}
@true
clean:
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}
mrproper: clean
-rm -f *.d
.PHONY: all clean foo mrproper
.PHONY: all clean mrproper
else
all clean mrproper:
.PHONY: all clean mrproper
endif

View File

@ -3,15 +3,12 @@ include ../../config.mk
ifeq ($(WITHPIC),1)
CFLAGS+=-I../../include -Wall ${PIC_FLAGS} ${LDFLAGS_LIB} ${LDFLAGS_LINKPATH}.. -DCORELIB
foo: all
all: ${ALL_TARGETS}
ALL_TARGETS=
DEBUGS=native.mk gdb.mk qnx.mk windbg.mk bochs.mk
include $(DEBUGS)
all: ${ALL_TARGETS}
@true
pre:
@cd libgdbwrap && ${MAKE}
@ -21,7 +18,9 @@ clean:
mrproper: clean
-rm -f *.d */*.d
.PHONY: all clean foo mrproper
.PHONY: all clean mrproper
else
all:
all clean mrproper:
.PHONY: all clean mrproper
endif

View File

@ -6,20 +6,23 @@ GRUB=$(LIBR)../shlr/grub/libgrub.a
#CFLAGS+=-I../../include
LDFLAGS+=${LINK}
foo: all
ifeq ($(WITHPIC),1)
all:
#FILESYSTEMS=hfs.mk iso9660.mk jfs.mk
#FILESYSTEMS=hfsplus.mk
FILESYSTEMS=ext2.mk fat.mk ntfs.mk reiserfs.mk tar.mk udf.mk ufs2.mk ufs.mk xfs.mk hfs.mk
include $(FILESYSTEMS)
all:
clean:
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}
mrproper: clean
-rm -f *.d ../arch/*/*/*.d
.PHONY: all clean foo mrproper
.PHONY: all clean mrproper
else
all clean mrproper:
.PHONY: all clean mrproper
endif

View File

@ -12,7 +12,7 @@ ifeq (${OSTYPE},windows)
CFLAGS+=-lws2_32
endif
foo: all
all: ${ALL_TARGETS}
ALL_TARGETS=
PLUGINS=ptrace.mk debug.mk gdb.mk malloc.mk shm.mk mach.mk w32dbg.mk procpid.mk windbg.mk bochs.mk qnx.mk r2k.mk ar.mk rbuf.mk
@ -22,9 +22,6 @@ include ${PLUGINS}
#ALL_TARGETS+=io_ewf.so
all: ${ALL_TARGETS}
@true
BINDEPS=
io_ewf.${LIB_SO}: io_ewf.o
@ -36,9 +33,9 @@ clean:
mrproper: clean
-rm -f *.d
.PHONY: all clean foo mrproper
.PHONY: all clean mrproper
else
clean all:
all clean mrproper:
.PHONY: all
.PHONY: all clean mrproper
endif

View File

@ -7,22 +7,24 @@ CFLAGS+=-I../../include -Wall ${PIC_CFLAGS} ${LDFLAGS_LIB} ${LDFLAGS_LINKPATH}..
CFLAGS+=-DCORELIB
LDFLAGS+=${LINK}
foo: all
ifeq ($(WITHPIC),1)
all: ${ALL_TARGETS}
ALL_TARGETS=
ARCHS=att2intel.mk x86_pseudo.mk mreplace.mk
ARCHS+=arm_pseudo.mk z80_pseudo.mk ppc_pseudo.mk 6502_pseudo.mk
ARCHS+=m68k_pseudo.mk sh_pseudo.mk avr_pseudo.mk
include $(ARCHS)
all: ${ALL_TARGETS}
@true
clean:
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}
mrproper: clean
-rm -f *.d */*.d
.PHONY: all clean foo mrproper
.PHONY: all clean mrproper
else
all clean mrproper:
.PHONY: all clean mrproper
endif

View File

@ -39,7 +39,9 @@ lib:
lib/$(LIBNAME).$(EXT_AR): lib $(SRC_O)
mkdir -p lib
ifeq ($(WITHPIC),1)
$(LD) $(PIC_CFLAGS) $(LDFLAGS_SHARED) -o lib/$(LIBFILE) $(CFLAGS) $(SRC_O) $(LDFLAGS) $(LINK)
endif
$(AR) rvs lib/$(LIBNAME).$(EXT_AR) $(SRC_O)
$(RANLIB) lib/$(LIBNAME).$(EXT_AR)

View File

@ -64,7 +64,9 @@ $(LIB):
mkdir -p $(LIB)
$(LIB)/$(LIBNAME).${EXT_AR}: $(LIB) $(SRC_O)
ifeq ($(WITHPIC),1)
$(LD) $(PIC_CFLAGS) $(LDFLAGS_SHARED) -o $(LIB)/$(LIBFILE) $(CFLAGS) $(SRC_O) $(LDFLAGS) $(LINK)
endif
$(AR) rvs $(LIB)/$(LIBNAME).${EXT_AR} $(SRC_O)
# required for solaris and w32
$(RANLIB) $(LIB)/$(LIBNAME).${EXT_AR}

View File

@ -59,7 +59,9 @@ $(LIB):
mkdir -p $(LIB)
$(LIB)/$(LIBNAME).$(EXT_AR): $(LIB) $(SRC_O)
ifeq ($(WITHPIC),1)
$(LD) $(PIC_CFLAGS) $(LDFLAGS_SHARED) -o $(LIB)/$(LIBFILE) $(CFLAGS) $(SRC_O) $(LDFLAGS) $(LINK)
endif
$(AR) rvs $(LIB)/$(LIBNAME).$(EXT_AR) $(SRC_O)
# required for solaris and w32
$(RANLIB) $(LIB)/$(LIBNAME).$(EXT_AR)
@ -68,7 +70,7 @@ clean:
-rm -f $(SRC_O)
-rm -rf lib
unit: lib
unit: lib
$(CC) $(CFLAGS) $(TEST_INCLUDES) -c $(UNIT_TEST) -o $(TEST_D)/unit.o
$(LD) $(TEST_D)/unit.o -o $(TEST_D)/unit -L$(LIB) -lqnxr -lglib-2.0

View File

@ -13,7 +13,9 @@ BIN=sdb${EXT_EXE}
all: ${BIN} sdb_version.h
${MAKE} static
ifeq ($(WITHPIC),1)
${MAKE} shared
endif
bin: $(BIN)

View File

@ -89,7 +89,10 @@ LIBNAME=libr_zip.${SOVER}
LIBAR=libr_zip.$(EXT_AR)
all: ${LIBNAME} ${LIBAR}
all:: ${LIBAR}
ifeq ($(WITHPIC),1)
all:: ${LIBNAME}
endif
${LIBNAME}: ${OBJS}
ifneq ($(SILENT),)

View File

@ -61,7 +61,10 @@ CFLAGS+=-I../../libr/include -I../include/
LIBNAME=libr_z.${SOVER}
LIBAR=libr_z.$(EXT_AR)
all: ${LIBNAME} ${LIBAR}
all:: ${LIBAR}
ifeq ($(WITHPIC),1)
all:: ${LIBNAME}
endif
${LIBNAME}: ${OBJS}
ifneq ($(SILENT),)