mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 13:19:54 +00:00
* Lot of makefile refactoring and cleanup
- Make use of some gnu extensions to make it cleaner - Fixes (mostly) build system
This commit is contained in:
parent
05b40f0e75
commit
fcb58f1ff7
4
AUTHORS
Normal file
4
AUTHORS
Normal file
@ -0,0 +1,4 @@
|
||||
Main developers aka /dev/radare
|
||||
|
||||
- pancake <nopcode.org>
|
||||
- nibble.ds <gmail.com>
|
@ -1,8 +1,8 @@
|
||||
# XXX
|
||||
PREFIX=/tmp/libr-install
|
||||
PREFIX=../prefix
|
||||
|
||||
# Libraries
|
||||
LIBLIST=io io/p util lib lang bin macro hash line cons print config flags syscall range socket cmd asm search diff debug reg core
|
||||
LIBLIST=io util lib lang flags bin macro hash line cons line print config syscall range socket cmd asm search diff debug reg core
|
||||
|
||||
|
||||
# Under development
|
||||
@ -31,10 +31,11 @@ install:
|
||||
cp -f include/* ${PREFIX}/include
|
||||
# programs
|
||||
@mkdir -p ${PREFIX}/bin
|
||||
cp -f util/t/rax2 ${PREFIX}/bin
|
||||
@for a in `find */t -perm /u+x -type f | grep 2`; \
|
||||
do echo " $$a"; cp $$a ${PREFIX}/bin ; done
|
||||
# test programs
|
||||
@mkdir -p ${PREFIX}/bin-test
|
||||
@for a in `find */t -perm /u+x -type f`; \
|
||||
@for a in `find */t -perm /u+x -type f | grep -v 2`; \
|
||||
do echo " $$a"; cp $$a ${PREFIX}/bin-test ; done
|
||||
@echo libr aka radare2 has been installed in PREFIX=${PREFIX}
|
||||
|
||||
|
@ -6,6 +6,11 @@
|
||||
|
||||
----------------------------------------[ todo
|
||||
|
||||
|| search ||
|
||||
------------
|
||||
- implement r_search_xrefs
|
||||
- configure before throw the search
|
||||
|
||||
|| asm ||
|
||||
---------
|
||||
- Add support for more architectures
|
||||
|
@ -1,5 +1,7 @@
|
||||
NAME=r_asm
|
||||
OBJ=asm.o
|
||||
DEPS=r_util
|
||||
|
||||
CFLAGS+=-Iarch/include
|
||||
# XXX
|
||||
CFLAGS+=-DLIL_ENDIAN=1
|
||||
|
@ -1,31 +1,33 @@
|
||||
LDFLAGS=-L../../util -lr_util -L../ -lr_asm
|
||||
LDFLAGS_BIN=${LDFLAGS} -lr_bin -L../../bin
|
||||
all: disasm_x86 disasm_arm disasm_mips disasm_sparc disasm_ppc disasm_bf asm_x86 rasm2 realloc_x86
|
||||
|
||||
disasm_x86:
|
||||
${CC} -g -I ../../include disasm_x86.c ../libr_asm.a ../../util/*.a -o disasm_x86
|
||||
${CC} -g -I ../../include disasm_x86.c ${LDFLAGS} -o disasm_x86
|
||||
|
||||
disasm_arm:
|
||||
${CC} -g -I ../../include disasm_arm.c ../libr_asm.a ../../util/*.a -o disasm_arm
|
||||
${CC} -g -I ../../include disasm_arm.c ${LDFLAGS} -o disasm_arm
|
||||
|
||||
disasm_mips:
|
||||
${CC} -g -I ../../include disasm_mips.c ../libr_asm.a ../../util/*.a -o disasm_mips
|
||||
${CC} -g -I ../../include disasm_mips.c ${LDFLAGS} -o disasm_mips
|
||||
|
||||
disasm_sparc:
|
||||
${CC} -g -I ../../include disasm_sparc.c ../libr_asm.a ../../util/*.a -o disasm_sparc
|
||||
${CC} -g -I ../../include disasm_sparc.c ${LDFLAGS} -o disasm_sparc
|
||||
|
||||
disasm_ppc:
|
||||
${CC} -g -I ../../include disasm_ppc.c ../libr_asm.a ../../util/*.a -o disasm_ppc
|
||||
${CC} -g -I ../../include disasm_ppc.c ${LDFLAGS} -o disasm_ppc
|
||||
|
||||
disasm_bf:
|
||||
${CC} -g -I ../../include disasm_bf.c ../libr_asm.a ../../util/*.a -o disasm_bf
|
||||
${CC} -g -I ../../include disasm_bf.c ${LDFLAGS} -o disasm_bf
|
||||
|
||||
asm_x86:
|
||||
${CC} -g -I ../../include asm_x86.c ../libr_asm.a ../../util/*.a -o asm_x86
|
||||
${CC} -g -I ../../include asm_x86.c ${LDFLAGS} -o asm_x86
|
||||
|
||||
rasm2:
|
||||
${CC} -g -I ../../include rasm2.c ../libr_asm.a ../../util/*.a -o rasm2
|
||||
${CC} -g -I ../../include rasm2.c ${LDFLAGS} -o rasm2
|
||||
|
||||
realloc_x86:
|
||||
${CC} -g -I ../../include realloc_x86.c ../libr_asm.a ../../bin/*.a ../../util/*.a -o realloc_x86
|
||||
${CC} -g -I ../../include realloc_x86.c ${LDFLAGS_BIN} -o realloc_x86
|
||||
|
||||
clean:
|
||||
rm -f disasm_x86 disasm_arm disasm_mips disasm_sparc disasm_ppc disasm_bf asm_x86 rasm2 realloc_x86
|
||||
|
@ -43,11 +43,13 @@ static int rasm_disasm(char *buf, u64 offset, char *arch, char *syntax, int big_
|
||||
r_asm_set_arch(&a, R_ASM_ARCH_ARM);
|
||||
else r_asm_set_arch(&a, R_ASM_ARCH_X86);
|
||||
|
||||
if (!strcmp(syntax, "att"))
|
||||
r_asm_set_syntax(&a, R_ASM_SYN_ATT);
|
||||
else if (!strcmp(syntax, "olly"))
|
||||
r_asm_set_syntax(&a, R_ASM_SYN_OLLY);
|
||||
else r_asm_set_syntax(&a, R_ASM_SYN_INTEL);
|
||||
if (syntax != NULL) {
|
||||
if (!strcmp(syntax, "att"))
|
||||
r_asm_set_syntax(&a, R_ASM_SYN_ATT);
|
||||
else if (!strcmp(syntax, "olly"))
|
||||
r_asm_set_syntax(&a, R_ASM_SYN_OLLY);
|
||||
else r_asm_set_syntax(&a, R_ASM_SYN_INTEL);
|
||||
}
|
||||
|
||||
r_asm_set_big_endian(&a, big_endian);
|
||||
r_asm_set_pc(&a, offset);
|
||||
|
@ -15,7 +15,8 @@ imports:
|
||||
data_resize:
|
||||
${CC} -g -I ../../include data_resize.c ../*.o -o data_resize
|
||||
rabin2:
|
||||
${CC} -g -I ../../include rabin2.c ../*.a ../../util/*.a ../../flags/*.a -o rabin2
|
||||
${CC} -g -I ../../include rabin2.c -lr_bin -lr_util -lr_flags \
|
||||
-L.. -L../..bin -L../../flags -L../../util -o rabin2
|
||||
|
||||
clean:
|
||||
rm -f baddr entry info sections symbols imports data_resize rabin2
|
||||
|
@ -1,4 +1,5 @@
|
||||
NAME=r_cmd
|
||||
OBJ=cmd.o
|
||||
DEPS=r_util
|
||||
|
||||
include ../rules.mk
|
||||
|
@ -1,7 +1,6 @@
|
||||
all: test
|
||||
BIN=test
|
||||
OBJ=test.o
|
||||
BINDEPS=r_util r_cmd
|
||||
|
||||
test:
|
||||
${CC} -g -I ../../include test.c ../*.o ../../util/*.a -o test
|
||||
|
||||
clean:
|
||||
rm -f test test.o
|
||||
include ../../rules.mk
|
||||
include ../../tests.mk
|
||||
|
@ -1,4 +1,5 @@
|
||||
NAME=r_config
|
||||
DEPS=r_util
|
||||
|
||||
OBJ=config.o callback.o
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
NAME=r_cons
|
||||
OBJ=cons.o strsub.o pipe.o print.o input.o color.o
|
||||
LINK=../line/*.o ../util/*.a
|
||||
DEPS=r_util
|
||||
#r_line ??
|
||||
#LINK=../line/*.o ../util/*.a
|
||||
|
||||
include ../rules.mk
|
||||
|
@ -1,5 +1,7 @@
|
||||
OBJ=hello.o
|
||||
BINDEPS=r_line r_util r_cons
|
||||
BIN=hello
|
||||
LIBS=../*.o ../../line/*.a ../../util/*.a
|
||||
#LIBS=../*.o ../../line/*.a ../../util/*.a
|
||||
|
||||
include ../../rules.mk
|
||||
include ../../tests.mk
|
||||
|
@ -1,4 +1,5 @@
|
||||
NAME=r_core
|
||||
DEPS=r_config r_cons r_line r_io r_cmd r_util r_print r_flags r_asm r_lib r_macro r_debug r_hash r_bin r_lang r_io r_asm r_config r_macro r_print
|
||||
|
||||
OBJ=core.o cmd.o file.o config.o visual.o io.o
|
||||
|
||||
|
@ -97,7 +97,7 @@ int r_core_init(struct r_core_t *core)
|
||||
&__lib_dbg_cb, &__lib_dbg_dt, core);
|
||||
r_lib_add_handler(&core->lib, R_LIB_TYPE_LNG, "language plugins",
|
||||
&__lib_lng_cb, &__lib_lng_dt, core);
|
||||
r_lib_opendir(&core->lib, "/home/pancake/prg/radare/src/libr/io/plugins");
|
||||
r_lib_opendir(&core->lib, getenv("LIBR_PLUGINS"));
|
||||
{
|
||||
char *homeplugindir = r_str_home(".radare/plugins");
|
||||
r_lib_opendir(&core->lib, homeplugindir);
|
||||
|
@ -1,42 +1,44 @@
|
||||
OBJ=radare2.o
|
||||
BIN=radare2
|
||||
BINDEPS=r_core r_cons r_macro r_util r_flags r_lib r_io r_hash r_cmd r_config r_asm r_lang r_debug r_print r_line r_bin
|
||||
|
||||
## shared
|
||||
LIBS=../*.o \
|
||||
-Wl,-R../../config/ \
|
||||
-Wl,-R../../cons/ \
|
||||
-Wl,-R../../line/ \
|
||||
-Wl,-R../../io/ \
|
||||
-Wl,-R../../cmd/ \
|
||||
-Wl,-R../../util/ \
|
||||
-Wl,-R../../print/ \
|
||||
-Wl,-R../../flags/ \
|
||||
-Wl,-R../../asm/ \
|
||||
-Wl,-R../../lib/ \
|
||||
-Wl,-R../../macro/ \
|
||||
-Wl,-R../../debug/ \
|
||||
-Wl,-R../../hash/ \
|
||||
-Wl,-R../../bin/ \
|
||||
-Wl,-R../../lang/ \
|
||||
-Wl,-R../ \
|
||||
-L../../config/ \
|
||||
-L../../cons/ \
|
||||
-L../../lang/ \
|
||||
-L../../line/ \
|
||||
-L../../io/ \
|
||||
-L../../cmd/ \
|
||||
-L../../util/ \
|
||||
-L../../print/ \
|
||||
-L../../flags/ \
|
||||
-L../../asm/ \
|
||||
-L../../lib/ \
|
||||
-L../../macro/ \
|
||||
-L../../debug/ \
|
||||
-L../../hash/ \
|
||||
-L../../bin/ \
|
||||
-L../ \
|
||||
-lr_core -lr_config -lr_cons -lr_line -lr_cmd -lr_util -lr_print \
|
||||
-lr_flags -lr_asm -lr_lib -lr_macro -lr_debug -lr_bin -lr_io -lr_hash -lr_lang
|
||||
#LIBS=-lr_core -L..
|
||||
### shared
|
||||
#LIBS=../*.o \
|
||||
# -Wl,-R../../config/ \
|
||||
# -Wl,-R../../cons/ \
|
||||
# -Wl,-R../../line/ \
|
||||
# -Wl,-R../../io/ \
|
||||
# -Wl,-R../../cmd/ \
|
||||
# -Wl,-R../../util/ \
|
||||
# -Wl,-R../../print/ \
|
||||
# -Wl,-R../../flags/ \
|
||||
# -Wl,-R../../asm/ \
|
||||
# -Wl,-R../../lib/ \
|
||||
# -Wl,-R../../macro/ \
|
||||
# -Wl,-R../../debug/ \
|
||||
# -Wl,-R../../hash/ \
|
||||
# -Wl,-R../../bin/ \
|
||||
# -Wl,-R../../lang/ \
|
||||
# -Wl,-R../ \
|
||||
# -L../../config/ \
|
||||
# -L../../cons/ \
|
||||
# -L../../lang/ \
|
||||
# -L../../line/ \
|
||||
# -L../../io/ \
|
||||
# -L../../cmd/ \
|
||||
# -L../../util/ \
|
||||
# -L../../print/ \
|
||||
# -L../../flags/ \
|
||||
# -L../../asm/ \
|
||||
# -L../../lib/ \
|
||||
# -L../../macro/ \
|
||||
# -L../../debug/ \
|
||||
# -L../../hash/ \
|
||||
# -L../../bin/ \
|
||||
# -L../ \
|
||||
# -lr_core -lr_config -lr_cons -lr_line -lr_cmd -lr_util -lr_print \
|
||||
# -lr_flags -lr_asm -lr_lib -lr_macro -lr_debug -lr_bin -lr_io -lr_hash -lr_lang
|
||||
LIBS+=-ldl
|
||||
|
||||
# static
|
||||
@ -57,4 +59,5 @@ LIBS+=-ldl
|
||||
../../hash/*.a
|
||||
LIBS+=-ldl
|
||||
|
||||
include ../../rules.mk
|
||||
include ../../tests.mk
|
||||
|
@ -1,4 +1,5 @@
|
||||
NAME=r_diff
|
||||
OBJ=diff.o
|
||||
DEPS=r_util
|
||||
|
||||
include ../rules.mk
|
||||
|
@ -1,10 +1,17 @@
|
||||
BINDEPS=r_diff r_util
|
||||
|
||||
include ../../rules.mk
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
all: test radiff2
|
||||
|
||||
test:
|
||||
${CC} -g -I ../../include test.c ../*.o ../../util/*.a -o test
|
||||
${CC} -g -I ../../include test.c ${LDFLAGS} -o test
|
||||
|
||||
radiff2:
|
||||
${CC} -g -I ../../include radiff2.c ../*.o ../../util/*.a -o radiff2
|
||||
${CC} -g -I ../../include radiff2.c ${LDFLAGS} -o radiff2
|
||||
|
||||
clean:
|
||||
rm -f test test.o radiff2
|
||||
|
||||
|
@ -40,9 +40,9 @@ struct r_flag_item_t *r_flag_list(struct r_flag_t *f, int rad)
|
||||
struct list_head *pos;
|
||||
list_for_each_prev(pos, &f->flags) {
|
||||
struct r_flag_item_t *flag = list_entry(pos, struct r_flag_item_t, list);
|
||||
if (rad) r_cons_printf("f %s %d @ 0x%08llx\n", flag->name,
|
||||
if (rad) printf("f %s %d @ 0x%08llx\n", flag->name,
|
||||
flag->size, flag->offset);
|
||||
else r_cons_printf("0x%08llx %d %s\n",
|
||||
else printf("0x%08llx %d %s\n",
|
||||
flag->offset, flag->size, flag->name);
|
||||
}
|
||||
return NULL;
|
||||
|
@ -10,6 +10,7 @@ enum {
|
||||
R_SEARCH_REGEXP,
|
||||
R_SEARCH_PATTERN,
|
||||
R_SEARCH_STRING,
|
||||
R_SEARCH_XREFS,
|
||||
R_SEARCH_AES
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
CFLAGS=-I../../include -Wall
|
||||
BINDEPS=
|
||||
|
||||
all: ptrace.so dbg.so malloc.so
|
||||
@true
|
||||
@ -12,7 +13,7 @@ ptrace.so: ptrace.o
|
||||
#strip -s ptrace.so
|
||||
|
||||
dbg.so: dbg.o
|
||||
${CC} ${CFLAGS} -fPIC -shared -o dbg.so dbg.c -lr_io -L../../io
|
||||
${CC} ${CFLAGS} -fPIC -shared -o dbg.so dbg.c -lr_io -L../../io -Wl,-R..
|
||||
#strip -s ptrace.so
|
||||
|
||||
clean:
|
||||
|
@ -5,7 +5,7 @@ plugin.so:
|
||||
gcc -Wall -o plugin.so -shared plugin.c -I../../include
|
||||
|
||||
test-plugin:
|
||||
gcc -Wall -o test-plugin test-plugin.c -I ../../include ../../lib/*.a -ldl
|
||||
gcc -Wall -o test-plugin test-plugin.c -I ../../include ../../lib/*.o -ldl
|
||||
|
||||
clean:
|
||||
-rm -f plugin.so test-plugin
|
||||
|
@ -1,5 +1,6 @@
|
||||
NAME=r_line
|
||||
DEPS=r_util r_cons
|
||||
OBJ=dietline.o
|
||||
LINK=-L../cons -lr_cons -Wl,-R../cons ../util/*.a
|
||||
#LINK=-L../cons -lr_cons -Wl,-R../cons ../util/*.a
|
||||
|
||||
include ../rules.mk
|
||||
|
@ -1,6 +1,11 @@
|
||||
OBJ=hello.o
|
||||
BIN=hello
|
||||
LIBS=../*.o -L../../cons -Wl,-R../../cons -lr_cons \
|
||||
../../util/*.a
|
||||
BINDEPS=r_cons r_line r_util
|
||||
#LIBS=../*.o -L../../cons -Wl,-R../../cons -lr_cons \
|
||||
# ../../util/*.a
|
||||
|
||||
#hello: ${OBJ}
|
||||
# ${CC} ${LDFLAGS} ${OBJ} -o hello
|
||||
|
||||
include ../../rules.mk
|
||||
include ../../tests.mk
|
||||
|
@ -1,7 +1,6 @@
|
||||
all: hex
|
||||
BIN=hex
|
||||
OBJ=hex.o
|
||||
BINDEPS=r_cons r_util r_line r_print
|
||||
|
||||
hex:
|
||||
${CC} ${CFLAGS} -I ../../include hex.c ../*.o ../../cons/*.o ../../util/*.a ../../line/*.a -o hex
|
||||
|
||||
clean:
|
||||
rm -f hex
|
||||
include ../../rules.mk
|
||||
include ../../tests.mk
|
||||
|
@ -1,7 +1,18 @@
|
||||
ifeq (${BINDEPS},)
|
||||
include ../config.mk
|
||||
else
|
||||
include ../../config.mk
|
||||
endif
|
||||
|
||||
CFLAGS+=-DUSE_RIO=${USE_RIO}
|
||||
CFLAGS+=${CFLAGS_APPEND}
|
||||
LDFLAGS+=$(subst r_,-lr_,$(DEPS))
|
||||
LDFLAGS+=$(subst r_,-L../,$(DEPS))
|
||||
|
||||
LDFLAGS+=$(subst r_,-lr_,$(BINDEPS))
|
||||
LDFLAGS+=$(subst r_,-L../../,$(BINDEPS))
|
||||
BOO=-Wl,-R../../
|
||||
LDFLAGS+=$(subst r_,${BOO},$(BINDEPS))
|
||||
|
||||
# Compiler
|
||||
CC?=gcc
|
||||
@ -19,21 +30,27 @@ EXT_SO=so
|
||||
LIB=lib${NAME}
|
||||
LIBAR=${LIB}.${EXT_AR}
|
||||
LIBSO=${LIB}.${EXT_SO}
|
||||
|
||||
# ${LIBAR}
|
||||
# Rules
|
||||
all: ${OBJ} ${LIBSO} ${LIBAR}
|
||||
@if [ -e t/Makefile ]; then (cd t && ${MAKE} all) ; else true ; fi
|
||||
@if [ -e plugins/Makefile ]; then (cd plugins && ${MAKE} all) ; else true ; fi
|
||||
ifneq ($(NAME),)
|
||||
all: ${LIBSO}
|
||||
echo $(NAME)
|
||||
@-if [ -e t/Makefile ]; then (cd t && ${MAKE} all) ; fi
|
||||
@-if [ -e p/Makefile ]; then (cd p && ${MAKE} all) ; fi
|
||||
@true
|
||||
|
||||
${LIBSO}:
|
||||
${LIBSO}: ${OBJ}
|
||||
${CC_LIB} ${LDFLAGS} ${LINK} ${OBJ}
|
||||
@sh ../stripsyms.sh ${LIBSO} ${NAME}
|
||||
@if [ -f "../stripsyms.sh" ]; then sh ../stripsyms.sh ${LIBSO} ${NAME} ; fi
|
||||
|
||||
${LIBAR}:
|
||||
${LIBAR}: ${OBJ}
|
||||
${CC_AR} ${OBJ}
|
||||
|
||||
clean:
|
||||
-rm -f ${LIBSO} ${LIBAR} ${OBJ} ${BIN} *.so a.out *.a
|
||||
@if [ -e t/Makefile ]; then (cd t && ${MAKE} clean) ; else true ; fi
|
||||
-rm -f ${LIBSO} ${LIBAR} ${OBJ} ${BIN} *.so a.out *.a *.exe
|
||||
@if [ -e t/Makefile ]; then (cd t && ${MAKE} clean) ; fi
|
||||
@if [ -e p/Makefile ]; then (cd p && ${MAKE} clean) ; fi
|
||||
@true
|
||||
|
||||
.PHONY: all clean ${LIBSO} ${LIBAR}
|
||||
endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
NAME=r_search
|
||||
OBJ=search.o bytepat.o stripstr.o aes-find.o
|
||||
DEPS=r_util
|
||||
CFLAGS+=-g
|
||||
#OBJ+=binparse.o
|
||||
# on solaris only
|
||||
|
@ -1,10 +1,15 @@
|
||||
BINDEPS=r_util r_search
|
||||
|
||||
include ../../rules.mk
|
||||
|
||||
all: test test-str
|
||||
|
||||
test:
|
||||
${CC} -g -I ../../include test.c ../*.o ../../util/*.a -o test
|
||||
${CC} -g -I ../../include test.c ${LDFLAGS} -o test
|
||||
|
||||
test-str:
|
||||
${CC} -g -I ../../include test-str.c ../*.o ../../util/*.a -o test-str
|
||||
${CC} -g -I ../../include test-str.c ${LDFLAGS} -o test-str
|
||||
|
||||
clean:
|
||||
rm -f test test.o test-str test-str.o
|
||||
|
||||
|
@ -10,6 +10,7 @@ LIBAR=${LIB}.${EXT_AR}
|
||||
LIBSO=${LIB}.${EXT_SO}
|
||||
|
||||
# Rules
|
||||
ifeq ($(NAME),)
|
||||
all: ${BIN}
|
||||
@true
|
||||
|
||||
@ -20,3 +21,4 @@ clean:
|
||||
-rm -f ${OBJ} ${BIN}
|
||||
|
||||
.PHONY: all clean ${BIN}
|
||||
endif
|
||||
|
@ -10,4 +10,4 @@ rax2:
|
||||
${CC} -g -I ../../include rax2.c ../*.o -o rax2
|
||||
|
||||
clean:
|
||||
rm -f calc rax2 ralloc
|
||||
rm -f calc rax2 ralloc test
|
||||
|
@ -22,7 +22,7 @@ int fun(const char *str, int iters)
|
||||
int ret;
|
||||
char *ptr;
|
||||
if (iters == 0) return 0;
|
||||
ptr = r_alloca_str(str);
|
||||
ptr = (char *)r_alloca_str(str);
|
||||
ret = fun(str, iters-1);
|
||||
return r_alloca_ret_i( ret );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user