I managed to compile my libraries and executable but I'm having issues getting them to link when I try to run the executable, I can see them all in the same folder, I set rapth to '.' on all of them, any ideas why I still get this message despite the makefile below?
Code:
../parser.out: error while loading shared libraries: libparse.so: cannot open shared object file: No such file or directory
Code:
DBG:=$(if $(filter 1 true TRUE True,$(DEBUG)),DEBUG=1,)
name_pfx:=$(if $(DBG),d-)
name_sfx:=$(if $(DBG),.d)
obj_sfx:=$(name_sfx).o
defines:=$(DBG:%=-D %)
ifeq "$(PWD)" ""
PATH:=..;$(PATH)
exe_sfx:=.exe
dll_pfx:=
dll_sfx:=32.dll
else
PATH:=..:$(PATH)
exe_sfx:=.out
dll_pfx:=lib
dll_sfx:=.so
endif
LIB_PATHS:=..
LIBRARY_PATH:=$(LIB_PATHS:%=%:)$(LIBRARY_PATH)
$(info *.c=$(wildcard *.c))
src_files:=$(filter-out main.c,$(wildcard *.c))
obj_files:=$(src_files:%=%$(obj_sfx))
main_o:=main$(name_sfx)$(obj_sfx)
inc_files:=$(wildcard *.h)
DFLAGS:=$(if $(DEBUG),-ggdb,)
LFLAGS:=-Wl,-rpath,.
SFLAGS:=-shared -fPIC
BFLAGS:=$(DFLAGS)
CFLAGS:=$(DFLAGS) $(defines)
exe:=../$(name_pfx)parse$(exe_sfx)
dll:=../$(dll_pfx)parser$(name_sfx)$(dll_sfx)
common:=$(dll_pfx)common$(name_sfx)$(dll_sfx)
MAKECMDGOALS?=info
export PATH
export LIBRARY_PATH
gede: build
gede --args
rebuild: clean build
clean:
rm -f *.o
rm -f $(dll)
cd ../common/ && $(MAKE) $(DBG) clean
build: $(exe)
$(exe): $(dll) $(main_o)
$(CC) $(BFLAGS) -o $@ $(main_o) $(LFLAGS) -lparse -lcommon
$(dll): $(obj_files)
cd ../common/ && $(MAKE) $(DBG) build
$(CC) $(SFLAGS) $(BFLAGS) -o $@ $(obj_files) $(LFLAGS) -lcommon
%.c$(obj_sfx): %.c
$(CC) $(SFLAGS) $(CFLAGS) -o $@ -c $<
$(main_o): main.c
$(CC) $(CFLAGS) -o $@ -c $<
%.c: $(inc_files)