Skip to content

Commit

Permalink
Changes to some Makefiles so that the code can be built from the root…
Browse files Browse the repository at this point in the history
… of the dir tree
  • Loading branch information
andrewdavidsmith committed Dec 5, 2014
1 parent d745a34 commit 0e43c6a
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 1 deletion.
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file is part of the methpipe system
#
# Copyright (C) 2014 University of Southern California,
# Andrew D. Smith
#
# Authors: Andrew D. Smith
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

AMORDAD_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

all:
@make -C src AMORDAD_ROOT=$(AMORDAD_ROOT) OPT=1

install:
@make -C src AMORDAD_ROOT=$(AMORDAD_ROOT) OPT=1 install

clean:
@make -C src AMORDAD_ROOT=$(AMORDAD_ROOT) clean
.PHONY: clean

distclean: clean
@rm -rf $(AMORDAD_ROOT)/bin
.PHONY: distclean
50 changes: 50 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This file is part of the methpipe system
#
# Copyright (C) 2014 University of Southern California,
# Andrew D. Smith
#
# Authors: Andrew D. Smith
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

all_subdirs=common progs
lib_subdirs=common
app_subdirs=progs

# check if a global copy of smithlab_cpp cannot be found and try to
# use a copy that is in the current directory
ifndef SMITHLAB_CPP
SMITHLAB_CPP=$(abspath $(dir $(MAKEFILE_LIST)))/smithlab_cpp
ifeq ("$(wildcard $(SMITHLAB_CPP))","")
$(error SMITHLAB_CPP not set and smithlab_cpp not found)
endif
all_subdirs += $(SMITHLAB_CPP)
lib_subdirs += $(SMITHLAB_CPP)
endif

all:
@for i in $(app_subdirs); do \
make -C $${i} SMITHLAB_CPP=$(SMITHLAB_CPP) OPT=1; \
done;

install:
@for i in $(app_subdirs); do \
make -C $${i} SMITHLAB_CPP=$(SMITHLAB_CPP) OPT=1 install; \
done;

clean:
@for i in $(all_subdirs); do \
make -C $${i} SMITHLAB_CPP=$(SMITHLAB_CPP) clean; \
done;
5 changes: 4 additions & 1 deletion src/progs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ PROGS = build_graph_naively naive_batch_query \
amordad_batch_query \
simulate_feature_vector

SMITHLAB_CPP = ../smithlab_cpp
ifndef SMITHLAB_CPP
SMITHLAB_CPP = ../smithlab_cpp
endif

COMMON = ../common

INCLUDEDIRS = $(SMITHLAB_CPP) $(COMMON)
Expand Down

0 comments on commit 0e43c6a

Please sign in to comment.