aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-23 17:59:34 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-23 17:59:34 +0200
commit8781ea55a0aecc715e3955028457eedeaae79eeb (patch)
treec45ef0657b1e3ee653770d4e30ad530eee403be6
parentprint to stderr rather than stdout (diff)
downloadlibpassphrase-8781ea55a0aecc715e3955028457eedeaae79eeb.tar.gz
libpassphrase-8781ea55a0aecc715e3955028457eedeaae79eeb.tar.bz2
libpassphrase-8781ea55a0aecc715e3955028457eedeaae79eeb.tar.xz
improve makefile
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--Makefile19
1 files changed, 10 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index c9afc10..f854536 100644
--- a/Makefile
+++ b/Makefile
@@ -57,11 +57,9 @@ STD = gnu99
# C preprocessor flags
CPPFLAGS_ = $(foreach D, $(OPTIONS), -D'$(D)=1') $(CPPFLAGS)
# C compiling flags
-_fPIC = -fPIC
-CFLAGS_ = -std=$(STD) $(WARN) $(_fPIC) $(CFLAGS)
+CFLAGS_ = -std=$(STD) $(WARN) $(CFLAGS)
# Linking flags
-_shared = -shared
-LDFLAGS_ = $(_shared) $(LDFLAGS)
+LDFLAGS_ = $(LDFLAGS)
# Flags to use when compiling and assembling
CC_FLAGS = $(CPPFLAGS_) $(CFLAGS_) $(OPTIMISE)
@@ -87,13 +85,16 @@ test: bin/test
bin/libpassphrase.so: obj/passphrase.o
@mkdir -p bin
- $(CC) $(LD_FLAGS) -o "$@" $^
+ $(CC) $(LD_FLAGS) -shared -o "$@" $^
-bin/test: obj/passphrase.o obj/test.o
- @mkdir -p bin
- $(CC) $(LD_FLAGS) -o "$@" $^
+bin/test: bin/libpassphrase.so obj/test.o
+ $(CC) $(LD_FLAGS) -L bin -lpassphrase -o "$@" obj/test.o
+
+obj/passphrase.o: src/passphrase.c src/passphrase.h
+ @mkdir -p "$(shell dirname "$@")"
+ $(CC) $(CC_FLAGS) -fPIC -o "$@" -c "$<"
-obj/%.o: src/%.c src/%.h
+obj/test.o: src/test.c src/test.h
@mkdir -p "$(shell dirname "$@")"
$(CC) $(CC_FLAGS) -o "$@" -c "$<"