Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from zlandau/build_improvements
Browse files Browse the repository at this point in the history
Build improvements
  • Loading branch information
LegNeato committed Nov 22, 2013
2 parents 822896b + a5b8d1f commit d78184a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
language: c
compiler:
- clang
- gcc
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq binutils-dev libdwarf-dev
script: make
script:
- make
- ./atosl --version
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ DEPS := ${SRCS:.c=.dep}
DIST := ${TARGET}-${VERSION}

.PHONY: all clean distclean dist install uninstall
all:: ${TARGET}

all:: ${TARGET}

${TARGET}: ${OBJS}
${CC} -o $@ $^ ${LDFLAGS}
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
__atosl__ is a partial replacement for Apple's atos tool for converting
addresses within a binary file to symbols.

[![Build Status](https://travis-ci.org/facebook/atosl.png?branch=master)](https://travis-ci.org/facebook/atos)

## Why

The primary benefit of atosl is its ability to run on other platforms.
Expand All @@ -27,13 +29,13 @@ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

```sh
brew install binutils
brew install https://gist.github.com/zlandau/7550479/raw/b084adb5506b186b520783bd69f92996cf2dada8/libdwarf.rb
brew install https://gist.github.com/zlandau/7550479/raw/f72753f6a59f6a3fadf9a2e2952a9f6846c15a8d/libdwarf.rb
```

#### Update config.mk.local

```sh
echo "DWARFLDFLAGS += -L$(dirname $(brew list binutils| grep libiberty.a))" >> config.mk.local
echo "LDFLAGS += -L$(dirname $(brew list binutils| grep libiberty.a))" >> config.mk.local
```

## Usage
Expand Down
15 changes: 12 additions & 3 deletions atosl.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ _dwarf_decode_u_leb128(Dwarf_Small * leb128,

static int debug = 0;

static const char *shortopts = "vl:o:A:gh";
static const char *shortopts = "vl:o:A:gVh";
static struct option longopts[] = {
{"verbose", no_argument, &debug, 1},
{"verbose", no_argument, NULL, 'v'},
{"load-address", required_argument, NULL, 'l'},
{"dsym", required_argument, NULL, 'o'},
{"arch", optional_argument, NULL, 'A'},
{"globals", no_argument, NULL, 'g'},
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
};

static struct {
Expand Down Expand Up @@ -151,6 +153,8 @@ void print_help(void)
" -A, --arch=ARCH\t\tspecify architecture\n");
fprintf(stderr,
" -g, --globals\t\t\tlookup symbols using global section\n");
fprintf(stderr,
" -V, --version\t\t\tget current version\n");
fprintf(stderr,
" -h, --help\t\t\tthis help\n");
fprintf(stderr, "\n");
Expand Down Expand Up @@ -1196,10 +1200,15 @@ int main(int argc, char *argv[]) {
case 'g':
options.use_globals = 1;
break;
case 'V':
fprintf(stderr, "atosl %s\n", VERSION);
exit(EXIT_SUCCESS);
case '?':
case 'h':
print_help();
exit(EXIT_FAILURE);
case 'h':
print_help();
exit(EXIT_SUCCESS);
default:
fatal("unhandled option");
}
Expand Down
9 changes: 3 additions & 6 deletions config.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
VERSION = 1.0
VERSION = 1.1

PREFIX = /usr/local

DWARFCFLAGS =
DWARFLDFLAGS =

CFLAGS = -Wall -Werror -O2 ${DWARFCFLAGS} -DATOSL_VERSION=\"${VERSION}\"
LDFLAGS = ${DWARFLDFLAGS} -ldwarf -liberty
CFLAGS = -Wall -Werror -O2 -DATOSL_VERSION=\"${VERSION}\"
LDFLAGS = -ldwarf -liberty

CC = cc

Expand Down

0 comments on commit d78184a

Please sign in to comment.