libtest/Makefile
author Markus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:49:13 +0200
changeset 59 a7ba10b68915
parent 7 a1aa30f0f904
child 66 2b4f786d9073
permissions -rw-r--r--
getpwnam_error.c: * The memory hole can be fixed with two different approaches 1) Change /etc/nsswitch.conf: passwd: compat to passwd: files 2) LD_PRELOAD=/lib/libnss_compat.so.2 valgrind ./getpwnam_error GLIBC loads libnss_compat on the fly and unloads it. Thanks to telexicon for reporting this... committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     1
     CC = gcc
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     2
 CFLAGS =-Wall -O2 -fPIC
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     3
LDFLAGS = -Llib -ltest
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
OBJECTS = func1.o func2.o
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     5
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
.c.o:
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
	$(CC) -c $(CFLAGS) -shared $<
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     8
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
all: lib/libtest.so.1.0.1 prog
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
prog: main.c
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
lib/libtest.so.1.0.1: $(OBJECTS)
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
	$(CC) -shared -Wl,-soname,lib/libtest.so.1 $(OBJECTS) -o $@
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
	@echo "Look carefully at this :)"
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
	ln -s libtest.so.1.0.1 lib/libtest.so.1
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    18
	ln -s libtest.so.1.0.1 lib/libtest.so
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    19
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
.PHONY: clean
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    21
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    22
clean:
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    23
	rm -f lib/libtest.*
a1aa30f0f904 libtest demonstrates how to use shared libraries
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    24
	rm -f *.o prog