libtest/Makefile
author Markus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:49:11 +0200
changeset 31 c95a6a7e305c
parent 7 a1aa30f0f904
child 66 2b4f786d9073
permissions -rw-r--r--
wiki synchronisation 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