summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMateusz Zalega <mateusz@appliedsourcery.com>2015-10-22 23:07:23 +0200
committerMateusz Zalega <mateusz@appliedsourcery.com>2015-10-26 20:49:55 +0100
commit9b8ebc6ed1a1fdc15c404774bf102c883a34d990 (patch)
treefce9205359704dcce84a1f770878901fbc9c2b3e /Makefile
parentc4aec144256e3f27fedd8f8de03e10cc08eecab8 (diff)
downloadlibnitrokey-9b8ebc6ed1a1fdc15c404774bf102c883a34d990.tar.gz
libnitrokey-9b8ebc6ed1a1fdc15c404774bf102c883a34d990.tar.bz2
Minor fixes, working version
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 22 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index e98e631..c5a4435 100644
--- a/Makefile
+++ b/Makefile
@@ -6,26 +6,37 @@ INCLUDE = -Iinclude/
LIB = -lhidapi-libusb
BUILD = build
-CXXFLAGS = -std=c++14
+CXXFLAGS = -std=c++14 -fPIC
+SOFLAGS = -shared
CXXSOURCES = $(wildcard *.cc)
-OBJ = $(CXXSOURCES:%.cc:$(BUILD)/%.o)
+OBJ = $(CXXSOURCES:%.cc=$(BUILD)/%.o)
+DEPENDS = $(CXXSOURCES:%.cc=$(BUILD)/%.d)
-$(BUILD)/libnitrokey.so: $(OBJ)
- $(CXX) -shared $(OBJ) -o $@
+all: $(OBJ) $(BUILD)/libnitrokey.so unittest
-$(BUILD)/%.o: %.cc
- $(CXX) -c $< -o $@ $(INCLUDE) $(CXXFLAGS)
+$(BUILD)/libnitrokey.so: $(OBJ) $(DEPENDS)
+ $(CXX) $(SOFLAGS) $(OBJ) -o $@
+
+$(BUILD)/%.d: %.cc
+ $(CXX) -M $< -o $@ $(INCLUDE) $(CXXFLAGS)
-all: $(OBJ) $(BUILD)/libnitrokey.so
+$(BUILD)/%.o: %.cc $(DEPENDS)
+ $(CXX) -c $< -o $@ $(INCLUDE) $(CXXFLAGS)
clean:
- rm $(OBJ)
- rm $(BUILD)/libnitrokey.so
+ rm -f $(OBJ)
+ rm -f $(BUILD)/libnitrokey.so
+ make -C unittest clean
mrproper: clean
- rm $(BUILD)/*.d
+ rm -f $(BUILD)/*.d
+ make -C unittest mrproper
+
+unittest: $(BUILD)/libnitrokey.so
+ make -C unittest
+ cd unittest/build && ln -fs ../../build/libnitrokey.so .
-.PHONY: all clean mrproper
+.PHONY: all clean mrproper unittest
include $(wildcard build/*.d)