Simplify the build system

doc.sw has been moved to radare2-extras
This commit is contained in:
pancake 2012-10-03 14:31:35 +02:00
parent 0aa55a4e01
commit 69a12884ed
76 changed files with 385 additions and 1742 deletions

View File

@ -1,6 +1,10 @@
-include config-user.mk
include global.mk
DLIBDIR=$(DESTDIR)/$(LIBDIR)
R2BINS=$(shell cd binr ; echo r*2)
DATADIRS=libr/asm/d libr/syscall/d libr/magic/d
#binr/ragg2/d
STRIP?=strip
ifneq ($(shell bsdtar -h 2>/dev/null|grep bsdtar),)
TAR=bsdtar czvf
@ -8,7 +12,6 @@ else
TAR=tar -czvf
endif
PWD=$(shell pwd)
REMOTE=radare.org:/srv/http/radareorg/get/beta
all: plugins.cfg
${MAKE} libr
@ -19,20 +22,14 @@ plugins.cfg:
echo " Please, run ./configure first" ; echo ; exit 1 ; fi
./configure-plugins
farm:
./sys/farm/run.sh
libr:
cd libr && ${MAKE} all
binr:
cd binr && ${MAKE} all
binr libr:
cd $@ && ${MAKE} all
w32:
make clean
${MAKE} clean
# TODO: add support for debian
./configure --without-ssl --without-gmp --with-compiler=i486-mingw32-gcc --with-ostype=windows --host=i486-unknown-windows
make
${MAKE}
.PHONY: depgraph.png
depgraph.png:
@ -63,11 +60,6 @@ w32dist:
rm -f radare2-w32-${VERSION}.zip
zip -r radare2-w32-${VERSION}.zip radare2-w32-${VERSION}
w32beta: w32dist
scp radare2-w32-${VERSION}.zip ${REMOTE}
cd r2-bindings ; $(MAKE) w32dist
scp radare2-bindings-w32-${VERSION}.zip ${REMOTE}
clean:
for a in libr binr shlr ; do (cd $$a ; ${MAKE} clean) ; done
@ -98,8 +90,6 @@ install-doc-symlink:
${INSTALL_DIR} ${PFX}/share/doc/radare2
cd doc ; for a in * ; do ln -fs ${PWD}/doc/$$a ${PFX}/share/doc/radare2 ; done
DATADIRS=libr/asm/d libr/syscall/d libr/magic/d
#binr/ragg2/d
install: install-doc install-man install-www
cd libr && ${MAKE} install PARENT=1 PREFIX=${PREFIX} DESTDIR=${DESTDIR}
cd binr && ${MAKE} install PREFIX=${PREFIX} DESTDIR=${DESTDIR}
@ -120,7 +110,6 @@ symstall-www:
cd ${DESTDIR}/${WWWROOT} ; for a in ${PWD}/shlr/www/* ; do \
ln -fs $$a ${DLIBDIR}/radare2/${VERSION}/www ; done
DLIBDIR=$(DESTDIR)/$(LIBDIR)
install-pkgconfig-symlink:
@${INSTALL_DIR} ${DLIBDIR}/pkgconfig
@ -150,7 +139,6 @@ purge-doc:
cd man ; for a in *.1 ; do rm -f ${MDR}/man1/$$a ; done
rm -f ${MDR}/man1/r2.1
R2BINS=$(shell cd binr ; echo r*2)
purge-dev:
rm -rf ${DESTDIR}/${LIBDIR}/libr_*.a
rm -rf ${DESTDIR}/${LIBDIR}/pkgconfig/r_*.pc
@ -167,16 +155,6 @@ purge: purge-doc purge-dev
rm -rf ${DESTDIR}/${LIBDIR}/radare2
rm -rf ${DESTDIR}/${INCLUDEDIR}/libr
beta: dist r2-bindings-dist
scp ../radare2-${VERSION}.tar.gz ${REMOTE}
scp r2-bindings-${VERSION}.tar.gz ${REMOTE}
version:
@echo ${VERSION}
r2-bindings-dist:
cd r2-bindings && ${MAKE} dist
dist:
git log $$(git show-ref `git tag |tail -n1`)..HEAD > ChangeLog
DIR=`basename $$PWD` ; \
@ -195,7 +173,7 @@ shot:
tests:
@if [ -d r2-regressions ]; then \
cd r2-regressions ; git pull ; \
cd r2-regressions ; git clean -xdf ; git pull ; \
else \
git clone git://github.com/vext01/r2-regressions.git ; \
fi
@ -204,4 +182,4 @@ tests:
include ${MKPLUGINS}
.PHONY: all clean mrproper install symstall uninstall deinstall dist shot pkgcfg
.PHONY: r2-bindings r2-bindings-dist libr binr install-man version w32dist tests
.PHONY: r2-bindings r2-bindings-dist libr binr install-man w32dist tests

View File

@ -1,5 +1,5 @@
include ../config-user.mk
PWD=$(shell pwd)
include ../global.mk
BTOP=$(shell pwd)
.PHONY: all clean install install-symlink deinstall uninstall mrproper
@ -30,17 +30,16 @@ install-rsc2:
symstall-rsc2:
mkdir -p ${LFX}/radare2/bin
chmod +x rsc2/scripts/*
cd rsc2/scripts ; for a in * ; do ln -fs ${PWD}/rsc2/scripts/$$a ${LFX}/radare2/bin/$$a ; done
cd rsc2/scripts ; for a in * ; do ln -fs ${BTOP}/rsc2/scripts/$$a ${LFX}/radare2/bin/$$a ; done
symstall install-symlink:
mkdir -p ${BFX}
for a in ${BINS} ; do ln -fs ${PWD}/$$a/$$a ${BFX}/$$a ; done
ln -fs ${PWD}/ragg2/ragg2-cc ${BFX}/ragg2-cc
for a in ${BINS} ; do ln -fs ${BTOP}/$$a/$$a ${BFX}/$$a ; done
ln -fs ${BTOP}/ragg2/ragg2-cc ${BFX}/ragg2-cc
-ln -fs ${PFX}/bin/radare2 ${BFX}/r2
deinstall uninstall:
for a in ${BINS} ; do rm -f ${BFX}/$$a ; done
#rm -f ${BFX}/rarc2-tool
-rm -f ${BFX}/r2
clean:

View File

@ -1,22 +0,0 @@
BINR_PROGRAM=1
include ../../libr/config.mk
#.PHONY: all clean
CFLAGS+=-DLIBDIR=\"${LIBDIR}\"
OBJ+=${BIN}.o
BEXE=${BIN}${EXT_EXE}
#all: ${BEXE}
#${BEXE}: ${OBJ}
# ${CC} -o ${BEXE} ${OBJ} ${LIBS} ${LDFLAGS}
include ../../libr/rules.mk
ifeq ($(WITHNONPIC),1)
LDFLAGS+=../../libr/db/sdb/src/libsdb.a
LDFLAGS+=../../libr/fs/p/grub/libgrubfs.a
LDFLAGS+=-lm
endif

View File

@ -4,7 +4,7 @@ BINDEPS+=r_config r_line r_io r_cmd r_print r_flags r_asm
BINDEPS+=r_debug r_hash r_lang r_anal r_parse r_bp r_reg
BINDEPS+=r_search r_syscall r_sign r_diff r_socket r_fs r_magic r_util
include ../binr.mk
include ../rules.mk
ifeq ($(OSTYPE),qnx)
LDFLAGS+=-lsocket

View File

@ -6,7 +6,7 @@ BINDEPS+=r_magic r_socket r_flags r_util r_th r_egg
CFLAGS+=-DR2_BIRTH=\"`date +%Y-%m-%d`\" -DR2_GITTIP=\"$(GIT_TIP)\"
include ../binr.mk
include ../rules.mk
sign:
ldid -Sradare2.xml radare2

View File

@ -4,7 +4,7 @@ BINDEPS+=r_bin r_debug r_io r_print r_asm r_hash r_fs
BINDEPS+=r_socket r_flags r_lang r_reg r_bp r_cmd r_sign r_parse
BINDEPS+=r_line r_syscall r_db r_magic r_util r_parse r_egg
include ../binr.mk
include ../rules.mk
ifeq ($(OSTYPE),android)
LDFLAGS+=${DL_LIBS} -lm

View File

@ -2,7 +2,7 @@ BIN=rafind2
BINDEPS=r_search r_io r_print r_lib r_asm r_anal r_reg r_cons r_util r_syscall r_diff
BINDEPS+=r_socket r_db r_parse
include ../binr.mk
include ../rules.mk
ifeq ($(OSTYPE),qnx)
LDFLAGS+=-lsocket

View File

@ -1,9 +1,4 @@
BIN=ragg2
BINDEPS=r_egg r_bin r_syscall r_asm r_db r_util r_parse
include ../binr.mk
t test:
cd t ; ${MAKE}
.PHONY: t
include ../rules.mk

View File

@ -1,7 +1,7 @@
BIN=rahash2
BINDEPS=r_io r_hash r_util r_print r_socket r_asm r_cons r_anal r_lib r_syscall r_reg r_diff r_db r_parse
include ../binr.mk
include ../rules.mk
ifeq ($(OSTYPE),android)
LDFLAGS+=-lm

View File

@ -1,4 +1,4 @@
BIN=rarun2
BINDEPS=r_util r_socket
include ../binr.mk
include ../rules.mk

View File

@ -1,4 +1,4 @@
BIN=rasm2
BINDEPS=r_asm r_db r_util r_lib r_parse
include ../binr.mk
include ../rules.mk

View File

@ -1,4 +1,4 @@
BIN=rax2
BINDEPS=r_util
include ../binr.mk
include ../rules.mk

51
binr/rules.mk Normal file
View File

@ -0,0 +1,51 @@
BINR_PROGRAM=1
include ../../libr/config.mk
#.PHONY: all clean
CFLAGS+=-DLIBDIR=\"${LIBDIR}\" -I$(LTOP)/include
OBJ+=${BIN}.o
BEXE=${BIN}${EXT_EXE}
ifeq ($(WITHNONPIC),1)
LDFLAGS+=../../libr/db/sdb/src/libsdb.a
LDFLAGS+=../../libr/fs/p/grub/libgrubfs.a
LDFLAGS+=-lm
endif
#--------------------#
# Rules for programs #
#--------------------#
ifneq ($(BIN)$(BINS),)
all: ${BEXE} ${BINS}
${BINS}: ${OBJS}
ifneq ($(SILENT),)
@echo CC $@
endif
${CC} ${CFLAGS} $@.c ${OBJS} ${LDFLAGS} -o $@
${BEXE}: ${OBJ} ${SHARED_OBJ}
ifneq ($(SILENT),)
@echo LD $@
endif
${CC} $+ -L.. -o $@ ${LDFLAGS}
endif
# Dummy myclean rule that can be overriden by the t/ Makefile
# TODO: move to config.mk ? it must be a precondition
myclean:
clean:: myclean
-rm -f ${OBJS} ${OBJ} ${BIN}
mrproper: clean
-rm -f *.d
install:
cd ../.. && ${MAKE} install
.PHONY: all clean myclean mrproper install

View File

@ -1,12 +0,0 @@
# http://nibble.develsec.org/sw.cgi/projects/sw.md
all:
PATH=$$PWD/sw:$${PATH} sw.gen site
md5sum site.static/*/*
for a in `find site.static/ -type d` ; do cp style.css $$a ; done
sync:
rsync -avz site.static/* radare.org:/srv/http/radareorg/doc/sw/
clean:
rm -rf site.static

View File

@ -1,2 +0,0 @@
Analysis
========

View File

@ -1,2 +0,0 @@
Commands
========

View File

@ -1,2 +0,0 @@
Debugging
=========

View File

@ -1,4 +0,0 @@
Disassembler
============
Use 'pd' command to disassemble...

View File

@ -1,2 +0,0 @@
Edition
=======

View File

@ -1,71 +0,0 @@
Flags
=====
Flags are used to specify bookmarks inside radare, they are store the following data:
* name
* offset
* size
* flagspace
The command 'f' is responsible to manage the flag list.
> fs imports # select flagspace 'imports'
> f # list flags
> f * # list all flags in radare commands
> fs * # select no flagspace
> f target @ 10 # create/set flag 'target' at offset 10
> f-target # remove flag named 'target'
Sorting flags
-------------
r2 have a new command named 'fS' which is used to sort flags by name (fSn) or offset (fSo).
In 'Vt' you can sort the flags using 'o' and 'n' keys.
> f alice @ 0x20
> f bob @ 0x10
> fSn
> f
0x00000020 0 alice
0x00000010 0 bob
> fSo
> f
0x00000010 0 bob
0x00000020 0 alice
Visual mode
-----------
Vt command from shell will emulate typing 't' in 'V'isual mode, so you get the same menu which allows you list, add and remove flags and flagspaces.
Press '?' to get help of keybindings.
> Vt
Flag spaces:
00 sections
01 * symbols
> 02 imports
03 functions
04 *
<enter>
Flags in flagspace 'imports'. Press '?' for help.
> 000 0x080496f4 0 imp.malloc
001 0x080494b4 0 imp.free
002 0x08049884 0 imp.cap_get_file
003 0x08049874 0 imp.exit
...
Selected: imp.malloc
|||| 0x080496f4 *[ fcn.imp.malloc] jmp dword near [0x805e82c]
|||| 0x080496fa 6828020000 push dword 0x228
|||`=< 0x080496ff e990fbffff jmp section..plt

View File

@ -1,10 +0,0 @@
Introduction
============
radare is a multiplatform *nix-like reverse engineering framework.
It is composed by a set of libraries, programs and scripts.
[Analysis](analysis/index.html)
--pancake

View File

@ -1,18 +0,0 @@
Compilation instructions
========================
To get python bindings for radare2 you need to install the following dependencies:
* swig
* svn co https://swig.svn.sourceforge.net/svnroot/swig/trunk
* valaswig
* hg clone http://hg.youterm.com/valaswig
* radare2
* hg clone http://radare.org/hg/radare2
Then, you have to compile r2-swig:
$ cd radare2/swig
$ ./configure --prefix=/usr
$ make
$ sudo make install

View File

@ -1,33 +0,0 @@
r2 Hello World in python
========================
This snippet will open /bin/ls and disassemble 10 instructions at entrypoint:
$ cat test.py
from r2.libr import RCore
c=RCore()
c.file_open("/bin/ls", False)
c.cmd0(".!rabin2 -re /bin/ls")
print "Entrypoint: %s"%c.cmd_str("? entry0").split(" ")[1]
print c.cmd_str("pd 10 @ entry0")
To run it:
$ python test.py
Entrypoint: 0x18a0
| 0x000018a0 *[ entry0] xor ebp, ebp
| 0x000018a2 5e pop esi
| 0x000018a3 89e1 mov ecx, esp
| 0x000018a5 83e4f0 and esp, 0xf0
| 0x000018a8 50 push eax
| 0x000018a9 54 push esp
| 0x000018aa 52 push edx
| 0x000018ab 68a0940508 push dword 0x80594a0
| 0x000018b0 68b0940508 push dword 0x80594b0
| 0x000018b5 51 push ecx
| 0x000018b6 56 push esi
| 0x000018b7 6840f80408 push dword 0x804f840
`=< 0x000018bc e843fbffff call 0x1404

View File

@ -1,4 +0,0 @@
Python
======
r2-swig provides automatic swig bindings for many scripting languages, one of them is python.

View File

@ -1,26 +0,0 @@
R2w
===
The experimental web interface of r2 is named r2w. Check it out here:
hg clone http://radare.org/hg/r2w
The only dependency to run is r2-swig.
To start the web server type 'make':
$ make
python main.py
Process with PID 5756 started...
eip = 0x40000810
oeax = 0x0000000b
eax = 0x00000000
ebx = 0x00000000
ecx = 0x00000000
edx = 0x00000000
esp = 0xbfcc6830
ebp = 0x00000000
esi = 0x00000000
edi = 0x00000000
eflags = 0x00200212
http://127.0.0.1:8080/ : Serving directory 'www'

View File

@ -1,26 +0,0 @@
Using signatures in radare
==========================
All the actions related to signatures in radare2 are collected
in the 'z' command.
Here is the command help:
[0x000018a0]> z?
Usage: z[abcp/*-] [arg]
z show status of zignatures
z* display all zignatures
zp display current prefix
zp prefix define prefix for following zignatures
zp- unset prefix
z-prefix unload zignatures prefixed as
z-* unload all zignatures
za ... define new zignature for analysis
zb name bytes define new zignature for bytes
zf name bytes define new function prelude zignature
zg pfx [file] generate siganture for current file
.zc @ fcn.foo flag signature if matching (.zc@@fcn)
z/ [ini] [end] search zignatures between these regions
NOTE: bytes can contain '.' (dots) to specify a binary mask

View File

@ -1,73 +0,0 @@
Signatures
==========
Signatures are byte streams used to identify functions, strings
or watermarks inside binaries.
They are mostly helpful when working with static binaries and
it is used to identify which functions from which libraries
has been compiled into the static bin.
But there are other reasons to use them, like finding unreachable
code, get name of unknown functions, etc..
Byte-based signatures
---------------------
Those byte streams are used in the most basic signature checking
algorithm. They have:
* byte array
* binary mask
* size of blob
The binary mask is required to ignore all those variable bits used
to point data by the target code. The code analysis module can do
this job for you.
Example code:
_foo: ; dummy label
mov eax, 33 ; reg, const
push ebx ; reg
push [0x8049400] ; absolute address (ignored by signature)
call 0x80434830 ; absolute address call (ignored by sign)
cmp eax, 0 ; reg, const
jz _foo ; relative address (used by the signature)
Other kind of signatures
------------------------
There are other types of ways to identify functions inside a binary,
here's a small list of them:
* function preludes
By understanding that most of the functions will be
prefixed with some standard bytes to construct the
stack frame and store return address on stack (depending
on compiler and architecture)
* code analysis
Code analysis can be used to determine other characteristics of a
function like number of basic blocks, code and data references, etc..
* callgraph
The name of the function can be determined by identifying
the functions called from the target one.
This metric can be used to generate an automated function
name if unknown or use it as a signature to collect this
name from the loaded signature database.
Inline functions
----------------
The compilers usually inline some small functions inside other
functions. The size restriction is because the CPU cache that
can make the program run slower than using a 'call'.
As they are small and they can va
Those kind of functions are not going to be covered by this
method because of the complexity and the small signature they

View File

@ -1,234 +0,0 @@
/* Based on werc stylesheet (werc.cat-v.org) */
/* Header */
.header {
color: rgb(39,78,144);
background-color: rgb(140,170,230);
background-color: #ff6d06;
border: solid 0 black;
border-width: 2px 0;
}
.headerTitle {
color: black;
font-size: 233%;
font-weight: normal;
margin: 0 0 0 4mm;
padding: 0.25ex 0;
}
.headerSubTitle {
font-size: 50%;
font-style: italic;
margin-left: 1em;
}
.headerTitle a { color: black; }
.headerTitle a:hover { text-decoration: none; }
/* Side */
#side-bar {
width: 12em;
float: left;
clear: left;
border-right: 1px solid #ddd;
}
#side-bar ul {
list-style-type: none;
list-style-position: outside;
margin: 0;
padding: 0 0 0.3em 0;
}
#side-bar li {
margin: 0;
padding: 0.1ex 0; /* Circumvents a rendering bug (?) in MSIE 6.0 XXX should move to iehacks.css, this causes an ugly gap */
}
#side-bar a {
color: rgb(0,102,204);
background-color: transparent;
margin: 0;
padding: 0.25em 1ex 0.25em 2mm;
display: block;
text-transform: capitalize;
font-weight: bold!important;
font-size: 102%;
border-left: white solid 0.2em;
}
#side-bar a:hover {
color: white;
background-color: rgb(100,135,220);
border-left: black solid 0.2em;
text-decoration: none;
}
/* Main Copy */
#main {
max-width: 50em;
color: black;
background-color: transparent;
text-align: justify;
line-height: 1.5em;
margin: 0em 0 0 12em;
padding: 0.5mm 5mm 5mm 5mm;
border-left: 1px solid #ddd;
}
#bodyText {
margin: 0 0 0 10.5em;
padding: 2mm 5mm 2mm 5mm;
}
#main p {
margin: 1em 1ex 1em 1ex !important; /* Need !important so troff-generated pages don't look totally squezed */
padding: 0;
}
#main a {
color: rgb(0,102,204);
background-color: transparent;
}
#main a:hover {
color: rgb(100,135,220);
}
#main h1, #main h2 {
color: rgb(0,102,204);
background-color: transparent;
font-size: 145.5%;
font-weight: bold;
margin: 2em 0 0 0;
padding: 0.5ex 0 0.5ex 0.6ex;
border-bottom: 2px solid rgb(0,102,204);
}
#main h2 {
font-size: 115.5%;
border-bottom: 1px solid rgb(0,102,204);
}
#main .topOfPage {
color: rgb(0,102,204);
background-color: transparent;
font-size: 91%;
font-weight: bold;
text-decoration: none;
margin: 3ex 1ex 0 0;
padding: 0;
float: right;
}
dl {
margin: 1em 1ex 2em 1ex;
padding: 0;
}
dt {
font-weight: bold;
margin: 0 0 0 0;
padding: 0;
}
dd {
margin: 0 0 2em 2em;
padding: 0;
}
/* Footer */
#footer {
color: white;
background-color: rgb(100,135,220);
padding: 0.4em;
clear: both;
}
#footer .right {
text-align: right;
line-height: 1.45em;
}
#footer a {
color: white;
background-color: transparent;
}
/* General */
body {
color: black;
background-color: white;
font-family: Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif;
font-size: 84%; /* Enables font size scaling in MSIE */
margin: 0;
padding: 0;
}
a { text-decoration: none; }
a:hover { text-decoration: underline; }
li ul {
padding-left: 0.6em !important;
}
table {
border: solid 1px black;
}
th {
background-color: #abc;
border: solid 1px black;
text-align: center;
}
td {
background-color: #def;
border: solid 1px black;
}
hr {
border-width: 0px 0px 0.1em 0px;
border-color: black;
}
acronym, .titleTip {
border-bottom: 1px solid #ddd;
cursor: help;
margin: 0;
padding: 0 0 0.4px 0;
}
pre {
margin-left: 2em;
font-size: 1.2em;
}
blockquote {
border-left: 1px solid blue;
font-style: italic;
}
/* pancake css */
textarea,body,input,td,tr,p,select,option,font {
background-color: black !important;
color: #e0e0e0 !important;
}
div,span,pre {
background-color: black !important;
color: #e0e0e0 !important;
}
h1,h2,h3,h4 {
background-color: black !important;
color: #e02020 !important;
}
a {
color: #8080ff !important;
/* color: #b0b0b0 !important; */
}
:hover {
color: #f0f0f0 !important;
}

View File

@ -1,13 +0,0 @@
# Configuration
TITLE="radare.org" # Site title
SUBTITLE="documentation" # Site subtitle
SITE="site" # Site folder
#BL="^index.md$ ^images$" # Black list
BL="^images$" # Black list
PREFIX="" # sw location ("/" is wwwroot)
#PREFIX="./" # sw location ("/" is wwwroot)
BIN="sw.cgi" # CGI name
STYLE="style.css" # Stylesheet name
# External apps
MDHANDLER="md2html.awk" # md handler

View File

@ -1,428 +0,0 @@
#!/bin/awk -f
#!/usr/bin/awk -f
#
# by: Jesus Galan (yiyus) 2009
#
# Usage: md2html.awk file.md > file.html
# See: http://4l77.com/src/md2html.awk
function eschtml(t) {
gsub("&", "\\&amp;", t);
gsub("<", "\\&lt;", t);
return t;
}
function oprint(t){
if(nr == 0)
print t;
else
otext = otext "\n" t;
}
function subref(id){
for(; nr > 0 && sub("<<" id, ref[id], otext); nr--);
if(nr == 0 && otext) {
print otext;
otext = "";
}
}
function nextil(t) {
if(!match(t, /[`<&\[*_\\-]|(\!\[)/))
return t;
t1 = substr(t, 1, RSTART - 1);
tag = substr(t, RSTART, RLENGTH);
t2 = substr(t, RSTART + RLENGTH);
if(ilcode && tag != "`")
return eschtml(t1 tag) nextil(t2);
# Backslash escaping
if(tag == "\\"){
if(match(t2, /^[\\`*_{}\[\]()#+\-\.!]/)){
tag = substr(t2, 1, 1);
t2 = substr(t2, 2);
}
return t1 tag nextil(t2);
}
# Dashes
if(tag == "-"){
if(sub(/^-/, "", t2))
tag = "&#8212;";
return t1 tag nextil(t2);
}
# Inline Code
if(tag == "`"){
if(sub(/^`/, "", t2)){
if(!match(t2, /``/))
return t1 "&#8221;" nextil(t2);
ilcode2 = !ilcode2;
}
else if(ilcode2)
return t1 tag nextil(t2);
tag = "<code>";
if(ilcode){
t1 = eschtml(t1);
tag = "</code>";
}
ilcode = !ilcode;
return t1 tag nextil(t2);
}
if(tag == "<"){
# Autolinks
if(match(t2, /^[^ ]+[\.@][^ ]+>/)){
url = eschtml(substr(t2, 1, RLENGTH - 1));
t2 = substr(t2, RLENGTH + 1);
linktext = url;
if(match(url, /@/) && !match(url, /^mailto:/))
url = "mailto:" url;
return t1 "<a href=\"" url "\">" linktext "</a>" nextil(t2);
}
# Html tags
if(match(t2, /^[A-Za-z\/!][^>]*>/)){
tag = tag substr(t2, RSTART, RLENGTH);
t2 = substr(t2, RLENGTH + 1);
return t1 tag nextil(t2);
}
return t1 "&lt;" nextil(t2);
}
# Html special entities
if(tag == "&"){
if(match(t2, /^#?[A-Za-z0-9]+;/)){
tag = tag substr(t2, RSTART, RLENGTH);
t2 = substr(t2, RLENGTH + 1);
return t1 tag nextil(t2);
}
return t1 "&amp;" nextil(t2);
}
# Images
if(tag == "!["){
if(!match(t2, /(\[.*\])|(\(.*\))/))
return t1 tag nextil(t2);
match(t2, /^[^\]]*/);
alt = substr(t2, 1, RLENGTH);
t2 = substr(t2, RLENGTH + 2);
if(match(t2, /^\(/)){
# Inline
sub(/^\(/, "", t2);
match(t2, /^[^\)]+/);
url = eschtml(substr(t2, 1, RLENGTH));
t2 = substr(t2, RLENGTH + 2);
title = "";
if(match(url, /[ ]+\".*\"[ ]*$/)) {
title = substr(url, RSTART, RLENGTH);
url = substr(url, 1, RSTART - 1);
match(title, /\".*\"/);
title = " title=\"" substr(title, RSTART + 1, RLENGTH - 2) "\"";
}
if(match(url, /^<.*>$/))
url = substr(url, 2, RLENGTH - 2);
return t1 "<img src=\"" url "\" alt=\"" alt "\"" title " />" nextil(t2);
}
else{
# Referenced
sub(/^ ?\[/, "", t2);
id = alt;
if(match(t2, /^[^\]]+/))
id = substr(t2, 1, RLENGTH);
t2 = substr(t2, RLENGTH + 2);
if(ref[id])
r = ref[id];
else{
r = "<<" id;
nr++;
}
return t1 "<img src=\"" r "\" alt=\"" alt "\" />" nextil(t2);
}
}
# Links
if(tag == "["){
if(!match(t2, /(\[.*\])|(\(.*\))/))
return t1 tag nextil(t2);
match(t2, /^[^\]]*(\[[^\]]*\][^\]]*)*/);
linktext = substr(t2, 1, RLENGTH);
t2 = substr(t2, RLENGTH + 2);
if(match(t2, /^\(/)){
# Inline
match(t2, /^[^\)]+(\([^\)]+\)[^\)]*)*/);
url = substr(t2, 2, RLENGTH - 1);
pt2 = substr(t2, RLENGTH + 2);
title = "";
if(match(url, /[ ]+\".*\"[ ]*$/)) {
title = substr(url, RSTART, RLENGTH);
url = substr(url, 1, RSTART - 1);
match(title, /\".*\"/);
title = " title=\"" substr(title, RSTART + 1, RLENGTH - 2) "\"";
}
if(match(url, /^<.*>$/))
url = substr(url, 2, RLENGTH - 2);
url = eschtml(url);
return t1 "<a href=\"" url "\"" title ">" nextil(linktext) "</a>" nextil(pt2);
}
else{
# Referenced
sub(/^ ?\[/, "", t2);
id = linktext;
if(match(t2, /^[^\]]+/))
id = substr(t2, 1, RLENGTH);
t2 = substr(t2, RLENGTH + 2);
if(ref[id])
r = ref[id];
else{
r = "<<" id;
nr++;
}
pt2 = t2;
return t1 "<a href=\"" r "\" />" nextil(linktext) "</a>" nextil(pt2);
}
}
# Emphasis
if(match(tag, /[*_]/)){
ntag = tag;
if(sub("^" tag, "", t2)){
if(stag[ns] == tag && match(t2, "^" tag))
t2 = tag t2;
else
ntag = tag tag
}
n = length(ntag);
tag = (n == 2) ? "strong" : "em";
if(match(t1, / $/) && match(t2, /^ /))
return t1 tag nextil(t2);
if(stag[ns] == ntag){
tag = "/" tag;
ns--;
}
else
stag[++ns] = ntag;
tag = "<" tag ">";
return t1 tag nextil(t2);
}
}
function inline(t) {
ilcode = 0;
ilcode2 = 0;
ns = 0;
return nextil(t);
}
function printp(tag) {
if(!match(text, /^[ ]*$/)){
text = inline(text);
if(tag != "")
oprint("<" tag ">" text "</" tag ">");
else
oprint(text);
}
text = "";
}
BEGIN {
blank = 0;
code = 0;
hr = 0;
html = 0;
nl = 0;
nr = 0;
otext = "";
text = "";
par = "p";
}
# References
!code && /^ *\[[^\]]*\]:[ ]+/ {
sub(/^ *\[/, "");
match($0, /\]/);
id = substr($0, 1, RSTART - 1);
sub(id "\\]:[ ]+", "");
title = "";
if(match($0, /\".*\"$/))
title = "\" title=\"" substr($0, RSTART + 1, RLENGTH - 2);
sub(/[ ]+\".*\"$/, "");
url = eschtml($0);
ref[id] = url title;
subref(id);
next;
}
# html
!html && /^<(address|blockquote|center|dir|div|dl|fieldset|form|h[1-6r]|\
isindex|menu|noframes|noscript|ol|p|pre|table|ul|!--)/ {
if(code)
oprint("</pre></code>");
for(; !text && block[nl] == "blockquote"; nl--)
oprint("</blockquote>");
match($0, /^<(address|blockquote|center|dir|div|dl|fieldset|form|h[1-6r]|\
isindex|menu|noframes|noscript|ol|p|pre|table|ul|!--)/);
htag = substr($0, 2, RLENGTH - 1);
if(!match($0, "(<\\/" htag ">)|((^<hr ?\\/?)|(--)>$)"))
html = 1;
if(html && match($0, /^<hr/))
hr = 1;
oprint($0);
next;
}
html && (/(^<\/(address|blockquote|center|dir|div|dl|fieldset|form|h[1-6r]|\
isindex|menu|noframes|noscript|ol|p|pre|table|ul).*)|(--)>$/ ||
(hr && />$/)) {
html = 0;
hr = 0;
oprint($0);
next;
}
html {
oprint($0);
next;
}
# List and quote blocks
# Remove indentation
{
for(nnl = 0; nnl < nl; nnl++)
if((match(block[nnl + 1], /[ou]l/) && !sub(/^( | )/, "")) || \
(block[nnl + 1] == "blockquote" && !sub(/^> ?/, "")))
break;
}
nnl < nl && !blank && text && ! /^ ? ? ?([*+-]|([0-9]+\.)+)( +| )/ { nnl = nl; }
# Quote blocks
{
while(sub(/^> /, ""))
nblock[++nnl] = "blockquote";
}
# Horizontal rules
{ hr = 0; }
(blank || (!text && !code)) && /^ ? ? ?([-*_][ ]*)([-*_][ ]*)([-*_][ ]*)+$/ {
if(code){
oprint("</pre></code>");
code = 0;
}
blank = 0;
nnl = 0;
hr = 1;
}
# List items
block[nl] ~ /[ou]l/ && /^$/ {
blank = 1;
next;
}
{ newli = 0; }
!hr && (nnl != nl || !text || block[nl] ~ /[ou]l/) && /^ ? ? ?[*+-]( +| )/ {
sub(/^ ? ? ?[*+-]( +| )/, "");
nnl++;
nblock[nnl] = "ul";
newli = 1;
}
(nnl != nl || !text || block[nl] ~ /[ou]l/) && /^ ? ? ?([0-9]+\.)+( +| )/ {
sub(/^ ? ? ?([0-9]+\.)+( +| )/, "");
nnl++;
nblock[nnl] = "ol";
newli = 1;
}
newli {
if(blank && nnl == nl && !par)
par = "p";
blank = 0;
printp(par);
if(nnl == nl && block[nl] == nblock[nl])
oprint("</li><li>");
}
blank && ! /^$/ {
if(match(block[nnl], /[ou]l/) && !par)
par = "p";
printp(par);
par = "p";
blank = 0;
}
# Close old blocks and open new ones
nnl != nl || nblock[nl] != block[nl] {
if(code){
oprint("</pre></code>");
code = 0;
}
printp(par);
b = (nnl > nl) ? nblock[nnl] : block[nnl];
par = (match(b, /[ou]l/)) ? "" : "p";
}
nnl < nl || (nnl == nl && nblock[nl] != block[nl]) {
for(; nl > nnl || (nnl == nl && pblock[nl] != block[nl]); nl--){
if(match(block[nl], /[ou]l/))
oprint("</li>");
oprint("</" block[nl] ">");
}
}
nnl > nl {
for(; nl < nnl; nl++){
block[nl + 1] = nblock[nl + 1];
oprint("<" block[nl + 1] ">");
if(match(block[nl + 1], /[ou]l/))
oprint("<li>");
}
}
hr {
oprint("<hr>");
next;
}
# Code blocks
code && /^$/ {
if(blanK)
oprint("");
blank = 1;
next;
}
!text && sub(/^( | )/, "") {
if(blanK)
oprint("");
blank = 0;
if(!code)
oprint("<code><pre>");
code = 1;
$0 = eschtml($0);
oprint($0);
next;
}
code {
oprint("</pre></code>");
code = 0;
}
# Setex-style Headers
text && /^=+$/ {printp("h1"); next;}
text && /^-+$/ {printp("h2"); next;}
# Atx-Style headers
/^#+/ && (!newli || par=="p" || /^##/) {
for(n = 0; n < 6 && sub(/^# */, ""); n++)
sub(/#$/, "");
par = "h" n;
}
# Paragraph
/^$/ {
printp(par);
par = "p";
next;
}
# Add text
{ text = (text ? text " " : "") $0; }
END {
if(code){
oprint("</pre></code>");
code = 0;
}
printp(par);
for(; nl > 0; nl--){
if(match(block[nl], /[ou]l/))
oprint("</li>");
oprint("</" block[nl] ">");
}
gsub(/<<[^\"]*/, "", otext);
print(otext);
}

View File

@ -1,91 +0,0 @@
#!/bin/sh
# sw - suckless webframework - 2010 - nibble <develsec.org>
# Configuration
[ -n "${SWCONF}" ] && . ${SWCONF} || . sw.conf
echo "Content-type: text/html"
echo
echo "<!doctype html>"
if [ -z "`echo "${REQUEST_URI}" | grep -F "${BIN}"`" ] || \
[ -n "`echo "${REQUEST_URI}" | grep -e "[^a-zA-Z0-9_\./ -]\+"`" ]; then
echo "<html><head><meta http-equiv=\"Refresh\" content=\"0; url=${PREFIX}${BIN}\"></head></html>"
echo "Invalid configuration ${REQUEST_URI} .. ${BIN}" > /dev/stderr
exit 1
fi
QUERY=`echo "${REQUEST_URI}" | sed -e "s,.*${BIN}/*\(.*\),\1,"`
DIR=""
FILE="index.md"
if [ -n "${QUERY}" ]; then
if [ -f "${SITE}/${QUERY}" ]; then
DIR=`dirname ${QUERY} | sed -e "s,[/\.]*$,,"`
FILE=${QUERY}
elif [ -d "${SITE}/${QUERY}" ]; then
DIR=`echo "${QUERY}" | sed -e "s,/*$,,"`
FILE="$DIR/index.md"
fi
fi
sw_menu() {
BL=`echo "${BL}" | sed -e "s/ \+\|^/ -e /g"`
echo "<ul>"
# absolute paz
#[ -n "${DIR}" ] && echo "<li><a href=\"`dirname ${PREFIX}${BIN}/${DIR}`\">..</a></li>"
# relative fun
[ -z "`echo $FILE|grep index.md`" ] && echo "<li><a href=\"index.html\">.</a></li>"
[ -n "${DIR}" ] && echo "<li><a href=\"../index.html\">..</a></li>"
for i in `ls ${SITE}/${DIR} | grep -v ${BL} | grep -v index` ; do
NAME=`echo "${i}" | sed -e "s/\..*$//" -e "s/_/ /g"`
# THIS IS RELATIVE STATIC FUN
[ -z "`echo $i | grep md$`" ] && i="$i/index.md"
echo "<li><a href=\"${PREFIX}${BIN}${i}\">${NAME}</a></li>"
# THIS IS FOR WEB
#echo "<li><a href=\"${PREFIX}${BIN}/${DIR}/${i}\">${NAME}</a></li>"
done
echo "</ul>"
}
sw_main() {
if [ -n "`echo "${FILE}" | grep -e "^.*\.md$"`" ]; then
[ -f "${SITE}/${FILE}" ] && ${MDHANDLER} "${SITE}/${FILE}"
else
echo "Download <a href=\"${PREFIX}${SITE}/${FILE}\">${FILE}</a>"
fi
}
# Header
cat << _header_
<html>
<head>
<title>${TITLE}</title>
<link rel="stylesheet" href="${PREFIX}${STYLE}" type="text/css">
<link rel="icon" href="/favicon.png" type="image/png">
<meta charset="UTF-8">
</head>
<body>
<div class="header">
<h1 class="headerTitle">
<a href="${PREFIX}${BIN}">${TITLE}</a> <span class="headerSubtitle">${SUBTITLE}</span>
</h1>
</div>
_header_
# Menu
echo "<div id=\"side-bar\">"
sw_menu
echo "</div>"
# Body
echo "<div id=\"main\">"
sw_main
echo "</div>"
# Footer
cat << _footer_
<div id="footer">
<div class="right"><a href="http://nibble.develsec.org/sw.cgi/projects/sw.md">Powered by sw</a></div>
</div>
</body>
</html>
_footer_
exit 0

View File

@ -1,38 +0,0 @@
#!/bin/sh
# sw.gen - suckless webframework static generator - 2010 - pancake
IDIR="`echo $1 | sed -e 's,/*$,,'`"
if [ -z "${IDIR}" ]; then
echo "Usage: sw.gen [dir]"
exit 1
fi
ODIR="`basename ${IDIR}`.static"
CDIR=$PWD
rm -rf ${ODIR}
mkdir -p ${ODIR}
cp -rf ${IDIR}/* ${ODIR}
rm -f `find ${ODIR} -type f -iname "*.md"`
if [ ! -f sw.conf ]; then
echo "Cannot find sw.conf in current directory"
exit 1
fi
cd `dirname ${IDIR}`
FILES=`find ${IDIR} -iname "*.md"`
for a in $FILES ; do
echo "* $a"
REQUEST_URI=$(echo /sw.cgi/$a|sed "s,${IDIR},,") SWCONF="./sw.conf" sw.cgi > xxx
[ $? = 1 ] && exit 1 # this hack is to detect exit 1 of sw.cgi... kinda ugly :)
b="$CDIR/`echo "$a"|sed -e 's,.md$,.html,g'|sed -e "s,${IDIR},${ODIR},g"`"
cat xxx | sed -e "s,sw.cgi,./,g" -e 's,\.md",.html",g' | \
grep -v "^Content-type: text/html" > $b
if [ -z "$(cat $b)" ]; then
echo EMPTY
rm -f xxx
exit 1
fi
done
rm -f xxx
exit 0

View File

@ -1,9 +0,0 @@
#!/bin/sh
[ -z "$1" ] && exit 1
IFS=:
for a in $PATH ; do
if [ -e "$a/$1" ]; then
echo "$a/$1"
break
fi
done

View File

@ -2,9 +2,11 @@ ifeq ($(_INCLUDE_GLOBAL_MK_),)
_INCLUDE_GLOBAL_MK_=1
RELEASE=1
DESTDIR=
COMPILER?=gcc
TOP:=$(dir $(lastword $(MAKEFILE_LIST)))
LTOP:=$(TOP)/libr
BTOP:=$(TOP)/binr
ifeq ($(MAKEFLAGS),s)
SILENT=1
@ -12,27 +14,8 @@ else
SILENT=
endif
.c:
ifneq ($(SILENT),)
@echo LD $<
endif
$(CC) $(LDFLAGS) -c $(CFLAGS) -o $@ $<
.c.o:
ifneq ($(SILENT),)
@echo CC $<
endif
$(CC) -c $(CFLAGS) -o $@ $<
COMPILER?=gcc
#COMPILER=maemo
#COMPILER=mingw32-gcc
#tcc
# verbose error messages everywhere
STATIC_DEBUG=0
# getenv("LIBR_RTDEBUG");
RUNTIME_DEBUG?=1
ifeq (${RELEASE},1)
PREFIX=/usr/local
@ -47,6 +30,18 @@ MDR=${DESTDIR}${MANDIR}
LIBDIR=${PREFIX}/lib
WWWROOT=${LIBDIR}/radare2/${VERSION}/www
.c:
ifneq ($(SILENT),)
@echo LD $<
endif
$(CC) $(LDFLAGS) -c $(CFLAGS) -o $@ $<
.c.o:
ifneq ($(SILENT),)
@echo CC $<
endif
$(CC) -c $(CFLAGS) -o $@ $<
-include $(TOP)/config-user.mk
-include $(TOP)/mk/${COMPILER}.mk
endif

View File

@ -5,24 +5,21 @@ PREFIX?=${PWD}/../prefix
PFX=${DESTDIR}/${PREFIX}
LFX=${DESTDIR}/${LIBDIR}
IFX=${DESTDIR}/${INCLUDEDIR}
PWD=`pwd`
PWD=$(shell pwd)
# Libraries
LIBLIST=util magic socket db cons line lib io lang flags bin hash config syscall
LIBLIST+=cmd reg diff anal parse asm print search egg bp sign debug fs core th
#DEPRECATED APIS : LIBLIST+=th crypto
LIBS=util magic socket db cons line lib io lang flags bin hash config syscall
LIBS+=cmd reg diff anal parse asm print search egg bp sign debug fs th core
#DEPRECATED APIS : LIBS+=th crypto
all: libs
libs:
@for lib in ${LIBLIST}; do \
all:
@for lib in ${LIBS}; do \
cd $${lib} && ${MAKE} || exit 1 ; cd .. ; done
@echo Build done for: ${LIBLIST}
@echo Build done for: ${LIBS}
pkgcfg:
@for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} pkgcfg ); done
cd asm && ${MAKE} pkgcfg NAME=libr DEPS="r_`echo ${LIBLIST}|sed -e 's, , r_,g'`"
# TODO: Magically generate libr.pc.acr here using LIBLIST and so :)
@for lib in ${LIBS}; do ( cd $${lib} && ${MAKE} pkgcfg ); done
cd asm && ${MAKE} pkgcfg NAME=libr DEPS="r_`echo ${LIBS}|sed -e 's, , r_,g'`"
# TODO: Magically generate libr.pc.acr here using LIBS and so :)
install-pkgconfig:
${INSTALL_DIR} ${LFX}/pkgconfig
@ -39,18 +36,15 @@ install-includes:
done ; \
done)
install-symlink:
mkdir -p ${PFX}/bin
mkdir -p ${IFX}
mkdir -p ${LFX}/pkgconfig
mkdir -p ${LFX}/radare2/${VERSION}
symstall install-symlink:
mkdir -p ${PFX}/bin ${IFX} ${LFX}/pkgconfig ${LFX}/radare2/${VERSION}
rm -rf ${IFX}/libr && ln -fs ${PWD}/include ${IFX}/libr
cd ../pkgcfg && for a in *.pc ; do \
if [ -e ${PWD}/../pkgcfg/$${a} ] ; then \
ln -fs ${PWD}/../pkgcfg/$${a} ${LFX}/pkgconfig/$${a} ; \
fi ; \
done
for a in ${LIBLIST} ; do \
for a in ${LIBS} ; do \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${LFX}/libr_$${a}.${EXT_SO} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${LFX}/libr_$${a}.${EXT_SO}.${LIBVERSION} ; \
ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_AR} ${LFX}/libr_$${a}.${EXT_AR} ; \
@ -71,7 +65,6 @@ install: install-includes install-pkgconfig
${INSTALL_LIB} $$a ${LFX}/$$b.${LIBVERSION} ; \
( cd ${LFX} ; ln -fs $$b.${LIBVERSION} $$b ) ; \
done
#Linux only? ( cd ${LFX} ; ln -fs $$b.${LIBVERSION} $$b.0 ; ln -fs $$b.0 $$b )
# object archives
@for a in `find * -type f | grep -e '\.a$$' | grep -v fs/p` ; do \
echo " ${LFX}/$$a"; ${INSTALL_DATA} $$a ${LFX} ; done
@ -111,7 +104,7 @@ deinstall uninstall:
rm -f ${LFX}/pkgconfig/r_*.pc
# test programs
rm -rf ${PFX}/bin/libr-test
# TODO: use for a in LIBLIST (like in binr/Makefile)
# TODO: use for a in LIBS (like in binr/Makefile)
rm -rf ${IFX}/libr
rm -rf ${LFX}/libr_*.so.${LIBVERSION}
rm -rf ${LFX}/libr_*.so.0
@ -125,12 +118,10 @@ deinstall uninstall:
@echo libr aka radare2 has been uninstalled from PREFIX=${PFX}
clean:
for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} clean ); done
for lib in ${LIBS}; do ( cd $${lib} && ${MAKE} clean ); done
mrproper:
for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} mrproper ); done
for lib in ${LIBS}; do ( cd $${lib} && ${MAKE} mrproper ); done
sloc:
${MAKE} -C .. sloc SLOCDIR=libr
.PHONY: sloc mrproper clean all pkgcfg install deinstall uninstall libr install-symlink
.PHONY: sloc mrproper clean pkgcfg install deinstall uninstall libr
.PHONY: install-includes install-pkgconfig install-symlink all

View File

@ -22,7 +22,7 @@ ifeq ($(HAVE_CPARSE),1)
CPARSE_OBJS=cparse/cparse.o cparse/lex.yy.o cparse/tree.o cparse/gen.o cparse/error.o cparse/symset.o cparse/pplex.o cparse/exptree.o cparse/pp.o
endif
OBJ=${STATIC_OBJS} ${OBJLIBS} ${CPARSE_OBJS}
OBJS=${STATIC_OBJS} ${OBJLIBS} ${CPARSE_OBJS}
pre:
@cd cparse && ${MAKE} all

View File

@ -11,7 +11,7 @@ foo:
include ${STATIC_ASM_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst asm_,p/asm_,$(STATIC_OBJ)))
OBJ=${STATIC_OBJS} asm.o code.o
OBJS=${STATIC_OBJS} asm.o code.o
pre:
@if [ ! -e libr_asm.${EXT_SO} ]; then if [ ! -e libr_asm.${EXT_AR} ]; then rm -f ${STATIC_OBJS} ; fi ; fi

View File

@ -18,9 +18,6 @@ include $(ARCHS)
all: ${ALL_TARGETS}
a:
${CC} -DTEST asm_x86_nasm.c `pkg-config --libs --cflags r_asm` -o a${EXT_EXE}
clean:
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}

View File

@ -13,8 +13,8 @@ include ${STATIC_BIN_PLUGINS}
include ${STATIC_BIN_XTR_PLUGINS}
STATIC_OBJS=$(addprefix $(LTOP)/bin/p/, $(STATIC_OBJ))
OBJ=bin.o bin_meta.o bin_write.o demangle.o dwarf.o ${STATIC_OBJS}
OBJ+=mangling/cxx/cp-demangle.o
OBJS=bin.o bin_meta.o bin_write.o demangle.o dwarf.o
OBJS+=mangling/cxx/cp-demangle.o ${STATIC_OBJS}
plugins:
cd p && ${MAKE} all

View File

@ -9,7 +9,7 @@ foo:
include ${STATIC_BP_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst bp_,p/bp_,$(STATIC_OBJ)))
OBJ=bp.o watch.o io.o plugin.o traptrace.o ${STATIC_OBJS}
OBJS=bp.o watch.o io.o plugin.o traptrace.o ${STATIC_OBJS}
#pre:
# if [ ! -e libr_bp.so ]; then rm -f ${STATIC_OBJS} ; fi

View File

@ -1,5 +1,5 @@
NAME=r_cmd
OBJ=cmd.o plugin.o macro.o
OBJS=cmd.o plugin.o macro.o
DEPS=r_util r_lib r_cons
include ../config.mk
@ -11,7 +11,7 @@ foo:
include ${STATIC_CMD_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst cmd_,p/cmd_,$(STATIC_OBJ)))
OBJ+=${STATIC_OBJS}
OBJS+=${STATIC_OBJS}
plugins:
cd p && ${MAKE} all

View File

@ -7,8 +7,3 @@ BSD=0
SOLARIS=0
WINDOWS=0
OSX=0
# static plugins
STATIC_DEBUG=0
RUNTIME_DEBUG=1

View File

@ -1,6 +1,7 @@
include ../config.mk
NAME=r_config
DEPS=r_util
OBJ=config.o callback.o
OBJS=config.o callback.o
include ../rules.mk

View File

@ -1,8 +1,7 @@
include ../config.mk
NAME=r_cons
OBJ=cons.o pipe.o output.o grep.o input.o hud.o
#color.o
OBJS=cons.o pipe.o output.o grep.o input.o hud.o
DEPS=r_util
#r_line ??
#LINK=../line/*.o ../util/*.a
include ../rules.mk

View File

@ -1,8 +0,0 @@
OBJ=hello.o
BINDEPS=r_cons r_util
BIN=hello
include ../../rules.mk
ti:
${CC} -o ti ti.c -lcurses

View File

@ -1,32 +0,0 @@
#include <stdio.h>
#include "r_cons.h"
int main() {
char buf[1024];
r_cons_new ();
r_cons_strcat ("Hello World\n");
r_cons_strcat_justify (
"this is pure\n"
"fun and nasty bubble\n"
"so i can enjoy tha time\n"
"dudu du dudu dah\n"
, 10, 0);
r_cons_flush();
while (!r_cons_eof()) {
r_cons_fgets (buf, sizeof (buf), 0, NULL);
r_cons_printf ("%s\n", buf);
r_cons_flush ();
if (strstr (buf, "exit"))
break;
}
r_cons_strcat ("Eof!\n");
r_cons_flush ();
return 0;
}

View File

@ -1,44 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <curses.h>
static char buf[1024];
static void strcatch (char *b, char c) {
char *e = b + strlen (b);
*e++ = c;
*e = 0;
}
static const char *str (char* p) {
buf[0] = 0;
if (p) {
while (*p) {
char c = *p++;
switch (c) {
case 0x1b:
strcat (buf, "\\e");
break;
case '\t':
strcat (buf, "\\t");
break;
case '\n':
strcat (buf, "\\n");
break;
default:
strcatch (buf, c);
}
}
}
return buf;
}
int main() {
system ("echo \"TERM = $TERM\"");
setupterm (NULL, 1, NULL);
printf ("cup = %s\n", str (tigetstr ("cup")));
printf ("smcup = %s\n", str (tigetstr ("smcup")));
printf ("rmcup = %s\n", str (tigetstr ("rmcup")));
return 0;
}

View File

@ -1,4 +1,4 @@
include ../../global.mk
include ../config.mk
NAME=r_core
@ -6,8 +6,8 @@ DEPS=r_config r_cons r_line r_io r_cmd r_util r_print r_flags r_asm r_lib
DEPS+=r_debug r_hash r_bin r_lang r_io r_anal r_parse r_print r_bp r_egg
DEPS+=r_reg r_search r_syscall r_sign r_diff r_socket r_fs r_magic r_db
OBJ=core.o cmd.o file.o config.o visual.o io.o yank.o libs.o hack.o
OBJ+=anal.o project.o gdiff.o asm.o rtr.o vmenus.o disasm.o patch.o bin.o
OBJS=core.o cmd.o file.o config.o visual.o io.o yank.o libs.o hack.o
OBJS+=anal.o project.o gdiff.o asm.o rtr.o vmenus.o disasm.o patch.o bin.o
CFLAGS+=-DLIBDIR=\"${LIBDIR}\"
CFLAGS+=-DPREFIX=\"${PREFIX}\"

View File

@ -9,7 +9,7 @@ foo:
include ${STATIC_CRYPTO_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst crypto_,p/crypto_,$(STATIC_OBJ)))
OBJ=${STATIC_OBJS} crypto.o
OBJS=${STATIC_OBJS} crypto.o
pre:
@if [ ! -e libr_crypto.${EXT_SO} ]; then rm -f ${STATIC_OBJS} ; fi

View File

@ -1,7 +1,9 @@
include ../config.mk
NAME=r_db
DEPS=r_util
OBJ=db.o table.o pair.o
OBJS=db.o table.o pair.o
PRE=sdb/src/libsdb.a
EXTRA_CLEAN=sdbclean
@ -9,6 +11,12 @@ EXTRA_TARGETS+=${PRE}
CFLAGS+=-Isdb/src
VC=git
URL=git://github.com/radare/sdb
F=README.md config.mk src Makefile
SYNCFILES=$(addprefix sdb.${VC}/,${F})
include ../rules.mk
# link against sdb
@ -24,12 +32,6 @@ sdb/src/libsdb.a:
RANLIB="${RANLIB}" \
CC="${CC}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" libsdb.a
VC=git
URL=git://github.com/radare/sdb
F=README.md config.mk src Makefile
SYNCFILES=$(addprefix sdb.${VC}/,${F})
.PHONY: sdb-sync sync-sdb
sdb-sync sync-sdb:
rm -rf sdb sdb.${VC}

View File

@ -1,10 +1,11 @@
include ../config.mk
NAME=r_debug
DEPS=r_reg r_anal r_bp r_util r_io r_parse r_cons
CFLAGS+=-DCORELIB
foo:
@${MAKE} libs
@${MAKE} tests
@${MAKE} plugins
include ../config.mk
@ -12,10 +13,7 @@ include ${STATIC_DEBUG_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst debug_,p/debug_,$(STATIC_OBJ)))
OBJ=map.o trace.o arg.o debug.o plugin.o pid.o reg.o desc.o ${STATIC_OBJS}
tests:
cd t && ${MAKE} all
OBJS=map.o trace.o arg.o debug.o plugin.o pid.o reg.o desc.o ${STATIC_OBJS}
plugins:
cd p && ${MAKE} all

View File

@ -1,8 +1,7 @@
NAME=r_diff
OBJ=diff.o bdiff.o
DEPS=r_util
include ../config.mk
#EXTRA_TARGETS=linediff
#EXTRA_CLEAN=clean_me
NAME=r_diff
DEPS=r_util
OBJS=diff.o bdiff.o
include ../rules.mk

View File

@ -3,19 +3,19 @@ DEPS=r_util r_asm r_syscall r_db
include ../config.mk
#OBJ+=p/x86_osx_binsh.o
OBJ=egg.o lang.o
OBJ+=emit_x86.o
OBJ+=emit_arm.o
OBJ+=emit_x64.o
OBJ+=emit_trace.o
#OBJS+=p/x86_osx_binsh.o
OBJS=egg.o lang.o
OBJS+=emit_x86.o
OBJS+=emit_arm.o
OBJS+=emit_x64.o
OBJS+=emit_trace.o
foo:
for a in ${LIBSO} ${LIBAR} all ; do ${MAKE} $$a ; done
P=p/
include ${STATIC_EGG_PLUGINS}
OBJ+=$(subst ..,p/..,$(subst egg_,p/egg_,$(STATIC_OBJ)))
OBJS+=$(subst ..,p/..,$(subst egg_,p/egg_,$(STATIC_OBJ)))
#plugins plugins:
# Do not build plugins. all are static @cd p && ${MAKE} all

View File

@ -1,7 +1,7 @@
include ../config.mk
NAME=r_flags
DEPS=r_util r_cons
#OBJ=flags.o name.o spaces.o
OBJ=htflags.o sort.o spaces.o
OBJS=htflags.o sort.o spaces.o
include ../rules.mk

View File

@ -13,7 +13,7 @@ foo:
include ${STATIC_FS_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst fs_,p/fs_,$(STATIC_OBJ)))
OBJ=${STATIC_OBJS} fs.o file.o
OBJS=${STATIC_OBJS} fs.o file.o
#p/grub/main.o
p/grub/libgrubfs.a:

View File

@ -1,3 +1,5 @@
include ../config.mk
NAME=r_hash
# HACK
ifneq ($(OSTYPE),darwin)
@ -5,6 +7,6 @@ LDFLAGS+=-lm
LINK=-lm
endif
OBJ=state.o md5c.o crc16.o crc32.o sha1.o hash.o hamdist.o entropy.o sha2.o calc.o
OBJS=state.o md5c.o crc16.o crc32.o sha1.o hash.o hamdist.o entropy.o sha2.o calc.o
include ../rules.mk

View File

@ -26,8 +26,7 @@ documentation and/or software.
#include "r_hash.h"
#include "md5.h"
/* Constants for MD5Transform routine.
*/
/* Constants for MD5Transform routine */
#define S11 7
#define S12 12
@ -55,9 +54,9 @@ static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/* F, G, H and I are basic MD5 functions.
@ -95,241 +94,195 @@ Rotation is separate from addition to prevent recomputation.
(a) += (b); \
}
/* MD5 initialization. Begins an MD5 operation, writing a new context.
*/
void MD5Init (context)
R_MD5_CTX *context; /* context */
{
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants.
*/
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
/* MD5 initialization. Begins an MD5 operation, writing a new context */
void MD5Init (R_MD5_CTX *context) {
context->count[0] = context->count[1] = 0;
/* Load magic initialization constants */
context->state[0] = 0x67452301;
context->state[1] = 0xefcdab89;
context->state[2] = 0x98badcfe;
context->state[3] = 0x10325476;
}
/* MD5 block update operation. Continues an MD5 message-digest
operation, processing another message block, and updating the
context.
*/
void MD5Update (context, input, inputLen)
R_MD5_CTX *context; /* context */
unsigned char *input; /* input block */
unsigned int inputLen; /* length of input block */
{
unsigned int i, index, partLen;
void MD5Update (R_MD5_CTX *context, ut8 *input, unsigned int inputLen) {
unsigned int i, index, partLen;
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Compute number of bytes mod 64 */
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - index;
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD5Transform (context->state, context->buffer);
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD5Transform (context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform (context->state, &input[i]);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform (context->state, &input[i]);
index = 0;
}
else
i = 0;
index = 0;
} else i = 0;
/* Buffer remaining input */
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen-i);
/* Buffer remaining input */
MD5_memcpy
((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen-i);
}
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
the message digest and zeroizing the context.
*/
void MD5Final (digest, context)
unsigned char digest[16]; /* message digest */
R_MD5_CTX *context; /* context */
{
unsigned char bits[8];
unsigned int index, padLen;
the message digest and zeroizing the context */
void MD5Final (ut8 digest[16], R_MD5_CTX *context) {
unsigned char bits[8];
unsigned int index, padLen;
/* Save number of bits */
Encode (bits, context->count, 8);
/* Save number of bits */
Encode (bits, context->count, 8);
/* Pad out to 56 mod 64.
*/
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
MD5Update (context, PADDING, padLen);
/* Pad out to 56 mod 64. */
index = (unsigned int)((context->count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
MD5Update (context, PADDING, padLen);
/* Append length (before padding) */
MD5Update (context, bits, 8);
/* Append length (before padding) */
MD5Update (context, bits, 8);
/* Store state in digest */
Encode (digest, context->state, 16);
/* Store state in digest */
Encode (digest, context->state, 16);
/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)context, 0, sizeof (*context));
/* Zeroize sensitive information. */
MD5_memset ((POINTER)context, 0, sizeof (*context));
}
/* MD5 basic transformation. Transforms state based on block.
*/
static void MD5Transform (state, block)
UINT4 state[4];
unsigned char block[64];
{
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
/* MD5 basic transformation. Transforms state based on block */
static void MD5Transform (ut32 state[4], ut8 block[64]) {
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode (x, block, 64);
Decode (x, block, 64);
/* Round 1 */
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
/* Round 1 */
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
/* Round 2 */
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
/* Round 2 */
GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */
GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
/* Round 3 */
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
/* Round 3 */
HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
/* Round 4 */
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
/* Round 4 */
II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)x, 0, sizeof (x));
/* Zeroize sensitive information.
*/
MD5_memset ((POINTER)x, 0, sizeof (x));
}
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void Encode (output, input, len)
unsigned char *output;
UINT4 *input;
unsigned int len;
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
/* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */
static void Encode (ut8 *output, ut32 *input, unsigned int len) {
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
output[j] = (unsigned char)(input[i] & 0xff);
output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
}
}
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
a multiple of 4.
*/
static void Decode (output, input, len)
UINT4 *output;
unsigned char *input;
unsigned int len;
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
/* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4 */
static void Decode (ut32 *output, ut8 *input, unsigned int len) {
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
/* Note: Replace "for loop" with standard memcpy if possible.
*/
static void MD5_memcpy (output, input, len)
POINTER output;
POINTER input;
unsigned int len;
{
unsigned int i;
for (i = 0; i < len; i++)
output[i] = input[i];
/* Note: Replace "for loop" with standard memcpy if possible. */
static void MD5_memcpy (ut8 *output, ut8 *input, unsigned int len) {
// TODO: use memmove here
unsigned int i;
for (i = 0; i < len; i++)
output[i] = input[i];
}
/* Note: Replace "for loop" with standard memset if possible.
*/
static void MD5_memset (output, value, len)
POINTER output;
int value;
unsigned int len;
{
unsigned int i;
for (i = 0; i < len; i++)
((char *)output)[i] = (char)value;
/* Note: Replace "for loop" with standard memset if possible. */
static void MD5_memset (ut8 *output, int value, unsigned int len) {
unsigned int i;
for (i = 0; i < len; i++)
output[i] = (char)value;
}

View File

@ -31,7 +31,7 @@ foo:
include ${STATIC_IO_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst io_,p/io_,$(STATIC_OBJ)))
OBJ=${STATIC_OBJS} io.o plugin.o map.o section.o desc.o cache.o undo.o
OBJS=${STATIC_OBJS} io.o plugin.o map.o section.o desc.o cache.o undo.o
pre:
${MAKE} libr_io.${EXT_SO}

View File

@ -1,5 +1,7 @@
include ../config.mk
NAME=r_lang
OBJ=lang.o
OBJS=lang.o
DEPS=r_util r_lib r_line
include ../rules.mk

View File

@ -1,6 +1,6 @@
NAME=r_lib
DEPS=r_util
OBJ=lib.o
OBJS=lib.o
include ../config.mk

View File

@ -1,6 +1,8 @@
include ../config.mk
NAME=r_line
DEPS=r_util r_cons
OBJ=line.o
OBJS=line.o
#LINK=-L../cons -lr_cons -Wl,-R../cons ../util/*.a
include ../rules.mk

View File

@ -8,7 +8,7 @@ CFLAGS+=-DHAVE_CONFIG_H
ifeq (${USE_LIB_MAGIC},1)
LDFLAGS+=-lmagic
endif
OBJ=apprentice.o ascmagic.o compress.o fsmagic.o funcs.o is_tar.o magic.o print.o softmagic.o
OBJS=apprentice.o ascmagic.o compress.o fsmagic.o funcs.o is_tar.o magic.o print.o softmagic.o
include $(LTOP)/rules.mk

View File

@ -1,7 +1,7 @@
NAME=r_parse
DEPS=r_lib r_flags r_util r_anal
-include ../config.mk
include ../config.mk
foo:
for a in pre libr_parse.${EXT_SO} libr_parse.${EXT_AR} plugins bins ; do ${MAKE} $$a ; done
@ -9,7 +9,7 @@ foo:
CFLAGS+=-DCORELIB
-include ${STATIC_PARSE_PLUGINS}
STATIC_OBJS=$(subst ..,p/..,$(subst parse_,p/parse_,$(STATIC_OBJ)))
OBJ=parse.o ${STATIC_OBJS}
OBJS=parse.o ${STATIC_OBJS}
bins:
@cd t && ${MAKE} all

View File

@ -1,3 +1,5 @@
include ../../config.mk
OBJ=parse.o
BIN=parse
BINDEPS=r_lib r_parse r_util r_flags r_cons r_anal r_reg r_syscall r_diff r_db

View File

@ -1,5 +1,7 @@
include ../config.mk
NAME=r_print
DEPS=r_cons r_util r_asm r_anal
OBJ=print.o format.o date.o disasm.o seven.o
OBJS=print.o format.o date.o disasm.o seven.o
include ../rules.mk

View File

@ -1,5 +1,7 @@
include ../config.mk
NAME=r_reg
DEPS=r_util
OBJ=reg.o arena.o value.o
OBJS=reg.o arena.o value.o
include ../rules.mk

View File

@ -1,39 +1,25 @@
ifeq ($(_INCLUDE_RULES_MK_),)
_INCLUDE_RULES_MK_=
include $(LTOP)/config.mk
ALL?=
CFLAGS+=-I$(LIBR)/include
LDFLAGS+=$(addprefix -L$(LTOP)/,$(subst r_,,$(BINDEPS)))
LDFLAGS+=$(addprefix -l,$(BINDEPS))
SRC=$(subst .o,.c,$(OBJ))
MAGICSED=| sed -e 's,-lr_magic,@LIBMAGIC@,g'
LIBR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(LIBR)/config.mk
BEXE=$(BIN)$(EXT_EXE)
ifeq ($(USE_RPATH),1)
LDFLAGS+=-Wl,-R${PREFIX}/lib
endif
#-------------------------------------#
# Rules for libraries
ifneq ($(NAME),)
ALL?=
CFLAGS+=-I$(LIBR)/include
ifeq (${OSTYPE},windows)
IQ=-
else
IQ=
endif
all:
@echo "DIR ${NAME}"
${MAKE} ${EXTRA_TARGETS} ${LIBSO} ${LIBAR}
ifeq ($(SILENT),)
@-if [ -e p/Makefile ]; then (cd p && ${MAKE} all) ; fi
else
@-if [ -e p/Makefile ] ; then (echo "DIR ${NAME}/p"; cd p && ${MAKE} all) ; fi
endif
# @${IQ}if [ -e t/Makefile ] ; then (echo "DIR ${NAME}/t"; cd t && ${MAKE} all) ; fi
# @${IQ}if [ -e t/Makefile ]; then (cd t && ${MAKE} all) ; fi
SRC=$(subst .o,.c,$(OBJ))
#---------------------#
# Rules for libraries #
#---------------------#
ifeq (${OSTYPE},gnulinux)
LIBNAME=${LDFLAGS_SONAME}${LIBSO}.${LIBVERSION}
@ -41,23 +27,25 @@ else
LIBNAME=${LDFLAGS_SONAME}${LIBSO}
endif
# -j trick
waitfordeps:
@sh $(LIBR)/waitfordeps.sh ${DEPS}
all:
@echo "DIR ${NAME}"
${MAKE} ${EXTRA_TARGETS} ${LIBSO} ${LIBAR}
ifneq ($(SILENT),)
@-if [ -e p/Makefile ]; then (cd p && ${MAKE} all) ; fi
else
@-if [ -e p/Makefile ] ; then (echo "DIR ${NAME}/p"; cd p && ${MAKE} all) ; fi
endif
X=$(subst r_,,$(DEPS))
LDFLAGS+=$(addprefix -L$(TOP)/libr/,$(X))
LDFLAGS+=$(addprefix -l,$(DEPS))
ifeq ($(WITHPIC),1)
${LIBSO}: $(EXTRA_TARGETS) waitfordeps ${OBJ} ${SHARED_OBJ}
@for a in ${OBJ} ${SHARED_OBJ} ${SRC}; do \
${LIBSO}: $(EXTRA_TARGETS) ${WFD} ${OBJS} ${SHARED_OBJ}
@for a in ${OBJS} ${SHARED_OBJ} ${SRC}; do \
do=0 ; [ ! -e ${LIBSO} ] && do=1 ; \
test $$a -nt ${LIBSO} && do=1 ; \
if [ $$do = 1 ]; then \
[ -n "${SILENT}" ] && \
echo "LD $(LIBSO)" || \
echo "${CC_LIB} ${LIBNAME} ${OBJ} ${SHARED_OBJ} ${LDFLAGS} ${LINK}" ; \
${CC_LIB} ${LIBNAME} ${OBJ} ${SHARED_OBJ} ${LDFLAGS} ${LINK} || exit 1; \
echo "${CC_LIB} ${LIBNAME} ${OBJS} ${SHARED_OBJ} ${LDFLAGS} ${LINK}" ; \
${CC_LIB} ${LIBNAME} ${OBJS} ${SHARED_OBJ} ${LDFLAGS} ${LINK} || exit 1; \
[ -f "$(LIBR)/stripsyms.sh" ] && sh $(LIBR)/stripsyms.sh ${LIBSO} ${NAME} ; \
break ; \
fi ; done
@ -67,18 +55,16 @@ ${LIBSO}:
endif
ifeq ($(WITHNONPIC),1)
$(LIBAR): ${OBJ}
$(LIBAR): ${OBJS}
ifneq ($(SILENT),)
echo "CC_AR $(LIBAR)"
endif
${CC_AR} ${OBJ} ${SHARED_OBJ}
${CC_AR} ${OBJS} ${SHARED_OBJ}
else
$(LIBAR):
@:
endif
MAGICSED=| sed -e 's,-lr_magic,@LIBMAGIC@,g'
pkgcfg:
@echo Generating pkgconfig stub for ${NAME}
@echo 'prefix=@PREFIX@' > ../../pkgcfg/${NAME}.pc.acr
@ -94,78 +80,17 @@ pkgcfg:
echo 'Libs: -L$${libdir} '`echo $${NAME} ${DEPS}|sed -e s,r_,-lr_,g` ${MAGICSED} >> ../../pkgcfg/${NAME}.pc.acr
@echo 'Cflags: -I$${includedir}/libr' >> ../../pkgcfg/${NAME}.pc.acr
install:
cd .. && ${MAKE} install
deinstall uninstall:
cd .. && ${MAKE} uninstall
clean:: ${EXTRA_CLEAN}
-rm -f *.${EXT_EXE} *.${EXT_SO} *.${EXT_AR} *.d
-rm -f ${LIBSO} ${LIBAR} ${OBJ} ${BIN} *.exe a.out
-@if [ -e t/Makefile ]; then (cd t && ${MAKE} clean) ; fi
-rm -f ${LIBSO} ${LIBAR} ${OBJS} ${BIN} *.exe a.out
-@if [ -e p/Makefile ]; then (cd p && ${MAKE} clean) ; fi
@true
mrproper: clean
-@if [ -e t/Makefile ]; then (cd t && ${MAKE} mrproper) ; fi
-@if [ -e p/Makefile ]; then (cd p && ${MAKE} mrproper) ; fi
-rm -f *.d
@true
sloc:
${MAKE} -C ../.. sloc SLOCDIR=libr/$$(echo ${NAME} | sed -e s,r_,,)
.PHONY: all sloc install pkgcfg clean deinstall uninstall
else
#--------------------#
# Rules for programs #
#--------------------#
CFLAGS+=-I$(LIBR)/include -DVERSION=\"${VERSION}\"
ifneq ($(BINS),)
endif
ifneq ($(BIN)$(BINS),)
BEXE=$(BIN)$(EXT_EXE)
# XXX: this is dupped somewhere
X=$(subst r_,,$(BINDEPS))
LDFLAGS+=$(addprefix -L$(TOP)/libr/,$(X))
LDFLAGS+=$(addprefix -l,$(BINDEPS))
all: ${BEXE} ${BINS}
${BINS}: ${OBJS}
ifneq ($(SILENT),)
@echo CC $@
endif
${CC} ${CFLAGS} $@.c ${OBJS} ${LDFLAGS} -o $@
${BEXE}: ${OBJ} ${SHARED_OBJ}
ifneq ($(SILENT),)
@echo LD $@
endif
${CC} $+ -L.. -o $@ ${LDFLAGS}
endif
# Dummy myclean rule that can be overriden by the t/ Makefile
# TODO: move to config.mk ? it must be a precondition
myclean:
clean:: myclean
-rm -f ${OBJS} ${OBJ} ${BIN}
mrproper: clean
-rm -f *.d
install:
cd ../.. && ${MAKE} install
.PHONY: all clean myclean
endif
.PHONY: all install pkgcfg clean deinstall uninstall
endif

View File

@ -1,12 +1,10 @@
include ../config.mk
NAME=r_search
OBJ=search.o bytepat.o strings.o aes-find.o
OBJ+=regexp.o xrefs.o keyword.o
OBJS=search.o bytepat.o strings.o aes-find.o
OBJS+=regexp.o xrefs.o keyword.o
# OBJ+=rsakey.o
DEPS=r_util
CFLAGS+=-g
#OBJ+=binparse.o
# on solaris only
#LINK=-lsocket
#LINK=-L../cons -lr_cons -Wl,-R../cons
include ../rules.mk

View File

@ -1,5 +1,7 @@
include ../config.mk
NAME=r_sign
DEPS=r_util r_anal
OBJ=sign.o
OBJS=sign.o
include ../rules.mk

View File

@ -2,7 +2,7 @@ include ../config.mk
NAME=r_socket
#DEPS=r_util
OBJ=socket.o proc.o http.o http_server.o
OBJS=socket.o proc.o http.o http_server.o
ifeq (${HAVE_LIB_SSL},1)
CFLAGS+=${SSL_CFLAGS}
LDFLAGS+=${SSL_LDFLAGS}

View File

@ -64,6 +64,7 @@ R_API void r_socket_http_response (RSocketHTTPRequest *rs, int code, const char
code==404?"NOT FOUND":
"UNKNOWN";
if (len<1) len = strlen (out);
if (!headers) headers = "";
r_socket_printf (rs->s, "HTTP/1.0 %d %s\n%s"
"Content-Length: %d\n\n", code, strcode, headers, len);
r_socket_write (rs->s, (void*)out, len);

View File

@ -1,8 +1,9 @@
include ../config.mk
NAME=r_syscall
DEPS=r_util r_db
#OBJ=syscall.o freebsd.o netbsd.o linux.o darwin.o win7.o ioports.o openbsd.o
OBJ=syscall.o ioports.o
OBJS=syscall.o ioports.o
CFLAGS+=-DLIL_ENDIAN=1 -D__UNIX__ -Wall -g
EXTRA_CLEAN=doclean

View File

@ -1,8 +1,10 @@
include ../config.mk
NAME=r_th
DEPS=
LDFLAGS=${TH_LIBS}
OBJ=th.o lock.o
OBJS=th.o lock.o
include ../rules.mk

View File

@ -1,22 +1,22 @@
include ../config.mk
NAME=r_util
OBJ=mem.o pool.o num.o str.o hex.o file.o alloca.o range.o log.o
OBJ+=prof.o cache.o sys.o buf.o w32-sys.o base64.o name.o calc.o
OBJ+=list.o flist.o ht.o ht64.o mixed.o btree.o chmod.o graph.o
OBJ+=uleb128.o
DEPS=
OBJ+=regex/regcomp.o regex/regerror.o regex/regexec.o
OBJS=mem.o pool.o num.o str.o hex.o file.o alloca.o range.o log.o
OBJS+=prof.o cache.o sys.o buf.o w32-sys.o base64.o name.o calc.o
OBJS+=list.o flist.o ht.o ht64.o mixed.o btree.o chmod.o graph.o
OBJS+=regex/regcomp.o regex/regerror.o regex/regexec.o uleb128.o
# DO NOT BUILD r_big api (not yet used and its buggy)
ifeq (1,0)
ifeq (${HAVE_LIB_GMP},1)
OBJ+=big-gmp.o
OBJS+=big-gmp.o
else
ifeq (${HAVE_LIB_SSL},1)
OBJ+=big-ssl.o
OBJS+=big-ssl.o
else
OBJ+=big.o
OBJS+=big.o
endif
endif
endif
@ -29,9 +29,7 @@ ht64:
cat ht.c | sed -e s,hashtable,hashtable64,g -e s,HashTable,HashTable64,g -e s,ut32,ut64,g > ht64.c
#cat ht.c ht64.c | sed -e 's,) {,);,'
m:
gcc mixed.c -I ../include/ -DTEST=1 -lr_util -g
#valgrind ./a.out
${CC} mixed.c -I ../include/ -DTEST=1 -lr_util -g
h:
gcc ht.c -I ../include/ -DTEST=1 -lr_util -g
#valgrind ./a.out
${CC} ht.c -I ../include/ -DTEST=1 -lr_util -g

View File

@ -2,7 +2,7 @@ NAME=r_vm
DEPS=r_util
ALL=p/plugins.h
OBJ=vm.o mmu.o reg.o extra.o setup.o stack.o op.o
OBJS=vm.o mmu.o reg.o extra.o setup.o stack.o op.o
include ../rules.mk

View File

@ -1,45 +0,0 @@
#!/bin/sh
# dependency checker -- pancake
deps="$@"
[ -z "$deps" ] && exit 0
getext() {
u=$(grep OSTYPE ../../config-user.mk| head -n 1 | cut -d = -f 2)
case $u in
windows)
echo dll
;;
darwin)
echo dylib
;;
#@*linux*)
*)
echo so
;;
esac
}; ext=$(getext)
a=0
count=3
cur=$(basename `pwd`)
while [ $a = 0 ] ; do
a=1
libs="$(echo $deps | sed -e s,r_,,g)"
for l in $libs ; do
if [ ! -f "../$l/libr_$l.$ext" ]; then
echo "NOT FOUND r_$l"
a=0
fi
done
if [ $a = 0 ]; then
echo "[$cur] waiting for $libs ($ext)"
count=$(($count-1))
if [ $count = 0 ]; then
echo "[$cur] Compilation failed"
#exit 1
fi
sleep 1
fi
done
exit 0