From a748fe4da4459174a1623e6b4b15a3eba6a3b2a1 Mon Sep 17 00:00:00 2001 From: Gregory Date: Sat, 10 Aug 2019 15:56:14 +0300 Subject: [PATCH] add otool binary --- .gitignore | 1 + build.sh | 8 +++++--- meson.build | 21 +++++++++++++++------ src/otool/main.c | 7 +++++++ 4 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 src/otool/main.c diff --git a/.gitignore b/.gitignore index 72f8905..57c0e8e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /debug_bld /out /ft_nm +/ft_otool diff --git a/build.sh b/build.sh index 5433000..46408ea 100755 --- a/build.sh +++ b/build.sh @@ -5,13 +5,15 @@ OUT_DIR="$PWD/out" RELEASE_BLD_DIR="$PWD/bld" DEBUG_BLD_DIR="$PWD/debug_bld" -TARGET="ft_nm" +FT_NM="ft_nm" +FT_OTOOL="ft_otool" -meson $RELEASE_BLD_DIR --prefix=$OUT_DIR --libdir=$OUT_DIR --includedir=$OUT_DIR --buildtype=release +meson $RELEASE_BLD_DIR --prefix=$OUT_DIR --libdir=$OUT_DIR --includedir=$OUT_DIR --bindir=$OUT_DIR --buildtype=release meson $DEBUG_BLD_DIR --buildtype=debug ninja -C $DEBUG_BLD_DIR ninja -C $RELEASE_BLD_DIR ninja -C $RELEASE_BLD_DIR install -ln -sf "$OUT_DIR/bin/$TARGET" "$PWD/$TARGET" +ln -sf "$OUT_DIR//$FT_NM" "$PWD/$FT_NM" +ln -sf "$OUT_DIR/$FT_OTOOL" "$PWD/$FT_OTOOL" diff --git a/meson.build b/meson.build index bca68e8..e1336a2 100644 --- a/meson.build +++ b/meson.build @@ -25,9 +25,9 @@ add_global_arguments( inc = include_directories('inc') -install_headers('inc/ft_nm.h') +# install_headers('inc/ft_nm.h') -sources = [ +nm_sources = [ 'src/nm/main.c', 'src/nm/nm_file.c', 'src/nm/macho64.c', @@ -38,14 +38,23 @@ sources = [ 'src/nm/find_symbol_table_command.c', ] -libft = subproject('libft') - -libft_dep = libft.get_variable('libft_dep') +otool_sources = [ + 'src/otool/main.c' +] +libft_dep = subproject('libft').get_variable('libft_dep') ft_nm = executable( 'ft_nm', - sources, + nm_sources, + include_directories: inc, + dependencies: libft_dep, + install: true, +) + +ft_nm = executable( + 'ft_otool', + otool_sources, include_directories: inc, dependencies: libft_dep, install: true, diff --git a/src/otool/main.c b/src/otool/main.c new file mode 100644 index 0000000..c115fed --- /dev/null +++ b/src/otool/main.c @@ -0,0 +1,7 @@ +#include "libft.h" + +int main() +{ + ft_putstr("hello from otool!"); + return (0); +} \ No newline at end of file