* Makefiles are now more silent (speed up)

- Test programs are compiled once now
  - Libraries are linked once
  - remove ${BIN} ${LIBSO} ${LIBAR} from .PHONY
* Add typedef for rBininfo
* Some useless and random work for rList
This commit is contained in:
pancake 2010-01-09 01:14:37 +01:00
parent b1b7a981c4
commit 1838890d0f
9 changed files with 78 additions and 42 deletions

27
INSTALL Normal file
View File

@ -0,0 +1,27 @@
INSTALL
=======
To build and install radare2 and libr:
$ ./configure --prefix=/usr
Then build:
$ make -s
And install
$ sup make install
If you regret about it, just 'make deinstall' :)
CONFIGURATION
=============
Plugins can be compiled as static or dynamic:
$ $EDITOR 'libr/config.{mk,h}'
--pancake

View File

@ -17,8 +17,8 @@ LIBLIST=util lib io meta lang flags bin bininfo macro hash line cons print confi
#LIBAR=libr.a
all:
echo PREFIX=${PREFIX}
for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} all ); done
@echo PREFIX=${PREFIX}
@for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} all ); done
@echo Build done for: ${LIBLIST}
pkgcfg:

View File

@ -10,7 +10,7 @@ all: pre ${ALL_TARGETS}
@true
pre:
cd dbg_libgdbwrap && ${MAKE}
@cd dbg_libgdbwrap && ${MAKE}
clean:
-rm -f *.so *.o ${STATIC_OBJ}

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2008 nibble<.ds@gmail.com> */
/* radare - LGPL - Copyright 2008-2010 nibble, pancake */
#ifndef _INCLUDE_R_BININFO_H_
#define _INCLUDE_R_BININFO_H_
@ -15,8 +15,9 @@
#define R_BININFO_SIZEOF_NAMES 256
// XXX: rename to rBinMeta...rBinDwarf..rBinFoo ??? rBininfo can be confusing with rBinInfo
/* types */
struct r_bininfo_t {
typedef struct r_bininfo_t {
const char *file;
int fd;
int rw;
@ -25,9 +26,9 @@ struct r_bininfo_t {
void *user;
struct r_bininfo_handle_t *cur;
struct list_head bins;
};
} rBininfo;
struct r_bininfo_handle_t {
typedef struct r_bininfo_handle_t {
char *name;
char *desc;
int (*init)(void *user);
@ -39,7 +40,7 @@ struct r_bininfo_handle_t {
int (*close)(struct r_bininfo_t *bin);
int (*check)(struct r_bininfo_t *bin);
struct list_head list;
};
} rBininfoHandle;
#ifdef R_API
/* bininfo.c */

View File

@ -100,7 +100,7 @@ clean: ${EXTRA_CLEAN}
@if [ -e p/Makefile ]; then (cd p && ${MAKE} clean) ; fi
@true
.PHONY: all install clean ${LIBSO} ${LIBAR}
.PHONY: all install pkgcfg clean deinstall uninstall
else
@ -122,7 +122,6 @@ CFLAGS+=-I../../include -DVERSION=\"${VERSION}\"
all: ${BIN}
${BIN}: ${OBJ}
@# XXX Shouldnt run always
${CC} ${LDFLAGS} ${LIBS} ${OBJ} -o ${BIN}
#Dummy myclean rule that can be overriden by the t/ Makefile
@ -131,7 +130,7 @@ myclean:
clean: myclean
-rm -f ${OBJ} ${BIN}
.PHONY: all clean myclean ${BIN}
.PHONY: all clean myclean
endif

View File

@ -4,12 +4,11 @@
namespace Radare {
[Compact]
[CCode (cname="struct r_bininfo_t", free_function="r_bininfo_free", cprefix="r_bininfo_")]
public class BinInfo {
public BinInfo();
public class rBininfo {
public rBininfo ();
// XXX bad signature?
public int get_line(uint64 addr, out string file, int len, int *line);
public bool set_source_path(string path);
public string get_source_path();
public int get_line (uint64 addr, out string file, int len, int *line);
public bool set_source_path (string path);
public string get_source_path ();
}
}

View File

@ -72,36 +72,27 @@ namespace Radare {
public delegate int rIterCallback (G foo);
*/
}
/* TODO: move this declaration inside rIter to have access to the Generic type */
public delegate int rIterCallback (void * foo);
/* TODO: Rename to r_list */
[Compact]
[CCode (cprefix="ralist_", cheader_filename="list.h", cname="struct list_head")]
public static class rList<G> {
[CCode (cprefix="ralist_", cheader_filename="r_types.h,list.h", cname="struct list_head")]
public class rList<G> {
public rList ();
[CCode (cname="ralist_next")]
public bool next();
[CCode (cname="ralist_append")]
public void append(owned G foo);
[CCode (cname="")]
public G @free(G arg);
[CCode (cname="ralist_get", generic_type_pos=2)]
public unowned G get(); //int type=0);
[CCode (cname="ralist_iterator")]
public rList<unowned G> iterator();
}
/*
[Compact]
[CCode (cprefix="rarray_", cheader_filename="r_types.h", cname="rarray_t")]
public static struct RarrayFoo<G> {
[CCode (cname="rarray_next", generic_type_pos=2)]
public bool next();
[CCode (cname="")]
public G @free(G arg);
[CCode (cname="rarray_get", generic_type_pos=2)]
public unowned G get();
[CCode (cname="rarray_iterator")] //, generic_type_pos=2)]
public RarrayFoo<G> iterator();
[CCode (cname="ralist_iterator")]
public rList<G> iterator();
}
*/
/* TODO: deprecated by r_iter ??? */
[Compact]
[CCode (cprefix="rarray_", cheader_filename="r_types.h", cname="void")]
public static class rArray<G> {

View File

@ -1,3 +1,5 @@
# list
all: core regs hash sc socket asm search iter bin db io array
@true
@ -13,6 +15,8 @@ lang:
# XXX
#list:
# valac -o list list_c.c list.vala --pkg r_util --vapidir=. --vapidir=${PWD}/.. -X -I. --pkg list
list:
valac -o list list.vala --pkg r_util --vapidir=..
genie:
valac --vapidir=.. --pkg r_asm --pkg libr asm.gs

View File

@ -1,14 +1,29 @@
/* radare - LGPL - Copyright 2009 pancake<@nopcode.org> */
/* radare - LGPL - Copyright 2010 pancake<@nopcode.org> */
using Radare;
[Import]
[CCode (cname="get_list")]
public static extern Radare.List<Foo> get_list();
public class IterableObject {
public string name { get; set; }
public IterableObject(string name) {
this.name = name;
}
}
rList<IterableObject> get_list () {
var list = new rList<IterableObject>();
list.append (new IterableObject ("patata"));
list.append (new IterableObject ("cacatua"));
list.append (new IterableObject ("tutu"));
list.append (new IterableObject ("baba"));
return list;
}
void main() {
Radare.List<Foo> head = get_list();
foreach (unowned Foo f in head) {
var head = get_list ();
foreach (var f in head) {
stdout.printf(" - %p %s\n", f, f.name);
}
}