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:
parent
08484a1020
commit
4673d82793
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,6 +8,8 @@
|
|||||||
*.log
|
*.log
|
||||||
*.toc
|
*.toc
|
||||||
*.out
|
*.out
|
||||||
|
*.l[ao]
|
||||||
|
/.libs
|
||||||
|
|
||||||
test
|
test
|
||||||
test.exe
|
test.exe
|
||||||
|
2
makefile
2
makefile
@ -89,6 +89,8 @@ endif
|
|||||||
|
|
||||||
default: $(LIBNAME)
|
default: $(LIBNAME)
|
||||||
|
|
||||||
|
$(OBJECTS): $(HEADERS)
|
||||||
|
|
||||||
$(LIBNAME): $(OBJECTS)
|
$(LIBNAME): $(OBJECTS)
|
||||||
$(AR) $(ARFLAGS) $@ $(OBJECTS)
|
$(AR) $(ARFLAGS) $@ $(OBJECTS)
|
||||||
$(RANLIB) $@
|
$(RANLIB) $@
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#
|
#
|
||||||
VERSION=0:12
|
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
|
CFLAGS += -Wall -W -Wshadow -Isrc/headers
|
||||||
|
|
||||||
@ -80,7 +81,10 @@ endif
|
|||||||
|
|
||||||
default: $(LIBNAME)
|
default: $(LIBNAME)
|
||||||
|
|
||||||
objs: $(OBJECTS)
|
$(OBJECTS): $(HEADERS)
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(LTCOMPILE) $(CFLAGS) $(LDFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
$(LIBNAME): $(OBJECTS)
|
$(LIBNAME): $(OBJECTS)
|
||||||
libtool --silent --mode=link gcc $(CFLAGS) `find . -type f | grep "[.]lo" | xargs` -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
|
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
|
mtest/mtest: mtest/mtest.c
|
||||||
cd mtest ; make mtest
|
cd mtest ; make mtest
|
||||||
|
|
||||||
test: $(LIBNAME) demo/test.o mtest/mtest
|
.PHONY: test
|
||||||
$(CC) $(CFLAGS) demo/test.o $(LIBNAME_S) $(PROF) -o test
|
test: $(LIBNAME) demo/test.o
|
||||||
|
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o test demo/test.o $(LIBNAME)
|
||||||
timing: $(LIBNAME) demo/test.o
|
|
||||||
$(CC) $(CFLAGS) demo/test.o $(LIBNAME_S) $(PROF) -o test
|
|
||||||
|
|
||||||
stest: $(LIBNAME) demo/stest.o
|
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$
|
# $Source$
|
||||||
# $Revision$
|
# $Revision$
|
||||||
|
Loading…
Reference in New Issue
Block a user