소스 검색

Removed need of LD_LIBRARY_PATH

master
Emil 7 달 전
부모
커밋
9c181c1e3e
No known key found for this signature in database GPG 키 ID: 5432DB986FDBCF8A
5개의 변경된 파일13개의 추가작업 그리고 17개의 파일을 삭제
  1. +7
    -9
      Makefile
  2. +1
    -5
      README
  3. +1
    -1
      plug/Makefile
  4. +1
    -1
      src/Makefile
  5. +3
    -1
      src/main.c

+ 7
- 9
Makefile 파일 보기

@@ -4,17 +4,15 @@ PREFIX := .

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

all: plug/libplug.so src/plugin
all: plug src

plug/libplug.so:
make -C plug
$(CP) $@ $(PREFIX)
plug:
make -C $@

src/plugin:
make -C src
$(CP) $@ $(PREFIX)
src:
make -C $@

.PHONY: all plug/libplug.so src/plugin
.PHONY: all plug src

+ 1
- 5
README 파일 보기

@@ -1,8 +1,4 @@
Run make and LD_LIBRARY_PATH='.' ./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.
Run make and ./plugin for the example.

There's a good reason for the fragmentation and recursion of the
Makefiles, as how the files are compiled vary at compile-time


+ 1
- 1
plug/Makefile 파일 보기

@@ -1,4 +1,4 @@
CFLAGS += -shared -fPIC

libplug.so: plug.o
../libplug.so: plug.o
${LINK.c} $+ -o $@

+ 1
- 1
src/Makefile 파일 보기

@@ -1,5 +1,5 @@
CPPFLAGS += -I../plug -L../plug
LDLIBS += -ldl

plugin: main.o
../plugin: main.o
${LINK.c} $+ -o $@ ${LDLIBS}

+ 3
- 1
src/main.c 파일 보기

@@ -1,4 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dlfcn.h>

@@ -8,7 +10,7 @@ int
main (void)
{
int x = 0;
char * libplug_fn = "libplug.so";
char * libplug_fn = "./libplug.so";
void * libplug = NULL;
while (1)
{