Removed need of LD_LIBRARY_PATH
This commit is contained in:
parent
12f03e20c4
commit
9c181c1e3e
16
Makefile
16
Makefile
@ -4,17 +4,15 @@ PREFIX := .
|
|||||||
|
|
||||||
CP := cp -f
|
CP := cp -f
|
||||||
|
|
||||||
export CFLAGS := -std=c89 -Wall -Wextra -Wpedantic -Wshadow -Wundef
|
export CFLAGS := -std=c89 -Werror -Wall -Wextra -Wpedantic -Wshadow -Wundef
|
||||||
export CPPFLAGS := -D_FORTIFY_SOURCE=2
|
export CPPFLAGS := -D_FORTIFY_SOURCE=2
|
||||||
|
|
||||||
all: plug/libplug.so src/plugin
|
all: plug src
|
||||||
|
|
||||||
plug/libplug.so:
|
plug:
|
||||||
make -C plug
|
make -C $@
|
||||||
$(CP) $@ $(PREFIX)
|
|
||||||
|
|
||||||
src/plugin:
|
src:
|
||||||
make -C src
|
make -C $@
|
||||||
$(CP) $@ $(PREFIX)
|
|
||||||
|
|
||||||
.PHONY: all plug/libplug.so src/plugin
|
.PHONY: all plug src
|
||||||
|
6
README
6
README
@ -1,8 +1,4 @@
|
|||||||
Run make and LD_LIBRARY_PATH='.' ./plugin for the example.
|
Run make and ./plugin for the example.
|
||||||
|
|
||||||
the LD_LIBRARY_PATH part could be removed by either adding
|
|
||||||
something into your .bashrc. With some internal messing with
|
|
||||||
get/setenv it's probably possible.
|
|
||||||
|
|
||||||
There's a good reason for the fragmentation and recursion of the
|
There's a good reason for the fragmentation and recursion of the
|
||||||
Makefiles, as how the files are compiled vary at compile-time
|
Makefiles, as how the files are compiled vary at compile-time
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
CFLAGS += -shared -fPIC
|
CFLAGS += -shared -fPIC
|
||||||
|
|
||||||
libplug.so: plug.o
|
../libplug.so: plug.o
|
||||||
${LINK.c} $+ -o $@
|
${LINK.c} $+ -o $@
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CPPFLAGS += -I../plug -L../plug
|
CPPFLAGS += -I../plug -L../plug
|
||||||
LDLIBS += -ldl
|
LDLIBS += -ldl
|
||||||
|
|
||||||
plugin: main.o
|
../plugin: main.o
|
||||||
${LINK.c} $+ -o $@ ${LDLIBS}
|
${LINK.c} $+ -o $@ ${LDLIBS}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
@ -8,7 +10,7 @@ int
|
|||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
char * libplug_fn = "libplug.so";
|
char * libplug_fn = "./libplug.so";
|
||||||
void * libplug = NULL;
|
void * libplug = NULL;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user