radare2/shlr/gdb/Makefile

84 lines
1.8 KiB
Makefile
Raw Normal View History

2014-03-03 17:28:08 +00:00
include ../../libr/config.mk
2015-10-09 19:24:15 +00:00
include ../../mk/platform.mk
include ../../shlr/zip/deps.mk
2014-03-03 17:28:08 +00:00
EDITOR?=vim
CC?=gcc
AR?=ar
2014-03-03 17:57:21 +00:00
RANLIB?=ranlib
2014-03-03 17:28:08 +00:00
LIBNAME=libgdbr
LIBFILE=$(LIBNAME).$(EXT_SO)
2015-10-09 19:24:15 +00:00
CFLAGS+=-I$(LIBR)/include $(PIC_CFLAGS)
CFLAGS+=-Iinclude -I${LIBR}/include
2014-03-03 17:28:08 +00:00
MAJOR=0
MINOR=1
#CFLAGS=-Wall -g -O0 -ggdb # -std=gnu11
LD=$(CC)
LDFLAGS+=-L${LIBR}/socket -lr_socket
LDFLAGS+=-L${LIBR}/util -lr_util
2014-03-03 17:57:21 +00:00
#OSTYPE=windows
include ../../libr/socket/deps.mk
# Test variables
2014-03-03 17:28:08 +00:00
TEST_D= $(PWD)/test
BIN=$(PWD)/bin
UNIT_TEST=$(TEST_D)/unit.c
CLIENT=$(TEST_D)/client.c
2014-03-03 17:28:08 +00:00
PWD=$(shell pwd)
2014-03-03 17:57:21 +00:00
TEST=test
LIB=lib
TEST_INCLUDES += $(INCLUDES) -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
SRC_D=src
2014-03-03 17:28:08 +00:00
SRC_C=$(wildcard $(SRC_D)/*.c)
SRC_O=$(SRC_C:.c=.o)
2014-03-03 17:28:08 +00:00
TEST_C=$(wildcard $(TEST_D)/*.c)
TEST_O=$(TEST_C:.c=.o)
all: $(LIB)/$(LIBNAME).a
# make
default: make
prepare:
mkdir -p $(LIB)
#$(LD) -shared -Wl,-soname,$(LIBNAME).so -o $(LIB)/$(LIBNAME).so $(SRC_O)
$(LIB):
mkdir -p $(LIB)
$(LIB)/$(LIBNAME).a: $(LIB) $(SRC_O)
2015-10-09 19:24:15 +00:00
$(LD) $(PIC_CFLAGS) -shared -o $(LIB)/$(LIBFILE) $(CFLAGS) $(SRC_O) $(LDFLAGS) $(LINK)
2014-03-03 17:28:08 +00:00
$(AR) rvs $(LIB)/$(LIBNAME).a $(SRC_O)
2014-03-03 17:57:21 +00:00
# required for solaris and w32
$(RANLIB) $(LIB)/$(LIBNAME).a
clean:
2014-03-03 17:57:21 +00:00
-rm -f $(SRC_O)
-rm -rf lib
unit: lib
$(CC) $(CFLAGS) $(TEST_INCLUDES) -c $(UNIT_TEST) -o $(TEST_D)/unit.o
$(LD) $(TEST_D)/unit.o -o $(TEST_D)/unit -L$(LIB) -lgdbr -lglib-2.0
run_unit: unit
LD_LIBRARY_PATH=./lib ./test/unit
client: lib
$(CC) $(CFLAGS) $(INCLUDES) -c $(CLIENT) -o $(TEST_D)/client.o
$(LD) $(TEST_D)/client.o -o $(TEST_D)/client -L$(LIB) -lgdbr
run_test: client
2014-03-03 17:28:08 +00:00
rarun2 libpath=./lib program=./test/client
gdb_test: client
2014-03-03 17:28:08 +00:00
rarun2 libpath=./lib system="gdb ./test/client"
valgrind_test: client
2014-03-03 17:28:08 +00:00
rarun2 libpath=./lib system="valgrind --track-origins=yes -v --leak-check=full ./test/client"
edit:
2014-03-03 17:28:08 +00:00
$(EDITOR) -c "args **/*.h **/*.c"