improve makefiles

shared makefile now uses libtool
update gitignore according
remove 'timing' target in shared makefile
add dependency of HEADERS to OBJECTS for both makefiles
This commit is contained in:
Steffen Jaeckel 2014-10-13 16:44:58 +02:00
parent 08484a1020
commit 4673d82793
3 changed files with 14 additions and 8 deletions

2
.gitignore vendored
View File

@ -8,6 +8,8 @@
*.log
*.toc
*.out
*.l[ao]
/.libs
test
test.exe

View File

@ -89,6 +89,8 @@ endif
default: $(LIBNAME)
$(OBJECTS): $(HEADERS)
$(LIBNAME): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@

View File

@ -3,7 +3,8 @@
#
VERSION=0:12
CC=libtool --mode=compile --tag=CC gcc
LT ?= libtool
LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
CFLAGS += -Wall -W -Wshadow -Isrc/headers
@ -80,7 +81,10 @@ endif
default: $(LIBNAME)
objs: $(OBJECTS)
$(OBJECTS): $(HEADERS)
.c.o:
$(LTCOMPILE) $(CFLAGS) $(LDFLAGS) -o $@ -c $<
$(LIBNAME): $(OBJECTS)
libtool --silent --mode=link gcc $(CFLAGS) `find . -type f | grep "[.]lo" | xargs` -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
@ -94,14 +98,12 @@ install: $(LIBNAME)
mtest/mtest: mtest/mtest.c
cd mtest ; make mtest
test: $(LIBNAME) demo/test.o mtest/mtest
$(CC) $(CFLAGS) demo/test.o $(LIBNAME_S) $(PROF) -o test
timing: $(LIBNAME) demo/test.o
$(CC) $(CFLAGS) demo/test.o $(LIBNAME_S) $(PROF) -o test
.PHONY: test
test: $(LIBNAME) demo/test.o
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o test demo/test.o $(LIBNAME)
stest: $(LIBNAME) demo/stest.o
$(CC) $(CFLAGS) demo/stest.o $(LIBNAME_S) -o stest
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o stest demo/stest.o $(LIBNAME)
# $Source$
# $Revision$