diff options
Diffstat (limited to 'schulung_tools/linking/hello/Makefile-lib')
| -rw-r--r-- | schulung_tools/linking/hello/Makefile-lib | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/schulung_tools/linking/hello/Makefile-lib b/schulung_tools/linking/hello/Makefile-lib new file mode 100644 index 0000000..f3ac0de --- /dev/null +++ b/schulung_tools/linking/hello/Makefile-lib @@ -0,0 +1,37 @@ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)gcc +AR = $(CROSS_COMPILE)ar +RANLIB = $(CROSS_COMPILE)ranlib + +REALNAME = libfunc.so.0.0.1 +SONAME = libfunc.so.0 +LINKERNAME = libfunc.so +STATICNAME = libfunc.a +OBJS = func1.o func2.o + +CFLAGS = -fPIC -g -Wall -Werror +LDFLAGS = -shared -Wl,-soname,$(SONAME) + +$(LINKERNAME): $(REALNAME) + ln -sf $< $@ + +$(REALNAME): $(OBJS) + $(CC) -o$@ $(LDFLAGS) $(OBJS) + +$(STATICNAME): $(OBJS) + $(AR) cr $@ $(OBJS) + $(RANLIB) $@ + +%.o: %.c + $(CC) -c -o$@ $(CFLAGS) $< + +install: $(REALNAME) + echo "/opt/acme/lib" > /etc/ld.so.conf.d/acme.conf + mkdir -p /opt/acme/lib + cp $< /opt/acme/lib/ + ldconfig + +clean: + rm -f $(OBJS) $(REALNAME) $(SONAME) $(LINKERNAME) $(STATICNAME) + +.PHONY: install clean |
