Skip to content

Commit

Permalink
Ensures make dep always builds dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
netj committed Jan 23, 2017
1 parent d134118 commit e13671f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ before_install:
install:
- export CXX="g++-4.8" CC="gcc-4.8"
# skip preparing dependencies if they're cached
- test -e lib/gtest/libgtest.a -a -e lib/gtest-1.7.0/include/gtest/gtest.h -a -d lib/tclap/include/tclap -a -d lib/numactl/include || make dep
- \[[ -e lib/gtest/libgtest.a && \
-e lib/gtest-1.7.0/include/gtest/gtest.h && \
-d lib/tclap/include/tclap && \
-d lib/numactl/include && \
true ]] || make dep
- make
script: LD_LIBRARY_PATH=`pwd`/lib/numactl/lib make test
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,39 +104,39 @@ $(OBJECTS): CXXFLAGS += -I./lib/gtest-1.7.0/include/
$(TEST_OBJECTS): CXXFLAGS += -I./lib/gtest-1.7.0/include/
$(TEST_PROGRAM): LDFLAGS += -L./lib/gtest/
$(TEST_PROGRAM): LDLIBS += -lgtest
dep: lib/gtest
lib/gtest: lib/gtest-1.7.0.zip
dep: dep-gtest
dep-gtest: lib/gtest-1.7.0.zip
# gtest for tests
set -eu;\
cd $(@D);\
cd lib;\
unzip -o $(<F);\
mkdir -p $(@F);\
cd $(@F);\
mkdir -p $(@:dep-%=%);\
cd $(@:dep-%=%);\
cmake ../$(<F:%.zip=%);\
make -j;\
#
clean-dep: clean-dep-gtest
clean-dep-gtest:
rm -rf lib/gtest
.PHONY: clean-dep-gtest
.PHONY: dep-gtest clean-dep-gtest

### TCLAP for command-line args parsing
# http://tclap.sourceforge.net
CXXFLAGS += -I./lib/tclap/include/
dep: lib/tclap
lib/tclap: lib/tclap-1.2.1.tar.gz
dep: dep-tclap
dep-tclap: lib/tclap-1.2.1.tar.gz
set -eu;\
cd $(@D);\
cd lib;\
tar xf $(<F);\
cd $(<F:%.tar.gz=%);\
./configure --prefix=$(abspath $@);\
./configure --prefix=$(abspath $(<D)/$(@:dep-%=%));\
make -j;\
make install;\
#
clean-dep: clean-dep-tclap
clean-dep-tclap:
rm -rf lib/tclap
.PHONY: clean-dep-tclap
.PHONY: dep-tclap clean-dep-tclap

### NUMA for Linux
# http://oss.sgi.com/projects/libnuma/
Expand All @@ -145,22 +145,22 @@ CXXFLAGS += -I./lib/numactl/include
LDFLAGS += -L./lib/numactl/lib
LDFLAGS += -Wl,-Bstatic -Wl,-Bdynamic
LDLIBS += -lnuma -lrt -lpthread
dep: lib/numactl # only for Linux
dep: dep-numactl # only for Linux
endif
lib/numactl: lib/numactl-2.0.11.tar.gz
dep-numactl: lib/numactl-2.0.11.tar.gz
# libnuma
echo "installing libnuma";\
cd lib;\
tar xf $(<F);\
cd $(<F:%.tar.gz=%);\
./configure --prefix=$(abspath $@);\
./configure --prefix=$(abspath lib/$(@:dep-%=%));\
make;\
make install;\
#
clean-dep: clean-dep-numactl
clean-dep-numactl:
rm -rf lib/numactl
.PHONY: clean-dep-numactl
.PHONY: dep-numactl clean-dep-numactl

################################################################################
# how to clean
Expand Down

0 comments on commit e13671f

Please sign in to comment.