Skip to content
Snippets Groups Projects
Commit 84c19503 authored by Assaf Gordon's avatar Assaf Gordon
Browse files

Makefile: extract BamTools' API creating to a separate target.

Ensures the BamTools' API files are created first (before any compilation occurs).
This allows parallel builds with "make -j 4".
parent 915746cb
No related branches found
No related tags found
No related merge requests found
......@@ -101,6 +101,14 @@ print_banner:
$(OBJ_DIR) $(BIN_DIR):
@mkdir -p $@
# One special case: All (or almost all) programs requires the BamTools API files to be created first.
.PHONY: bamtools_api
bamtools_api:
@$(MAKE) --no-print-directory --directory=$(BT_ROOT) api
$(UTIL_SUBDIRS) $(SUBDIRS): bamtools_api
# even though these are real directories, treat them as phony targets, forcing to always go in them are re-make.
# a future improvement would be the check for the compiled object, and rebuild only if the source code is newer.
.PHONY: $(UTIL_SUBDIRS) $(SUBDIRS)
......@@ -109,13 +117,9 @@ $(UTIL_SUBDIRS) $(SUBDIRS): $(OBJ_DIR) $(BIN_DIR)
@$(MAKE) --no-print-directory --directory=$@
clean:
@echo "Cleaning up."
@$(MAKE) --no-print-directory --directory=$(BT_ROOT) clean_api
@echo " * Cleaning up."
@rm -f $(OBJ_DIR)/* $(BIN_DIR)/*
@rm -Rf $(BT_ROOT)/lib
@rm -f $(BT_ROOT)/src/api/*.o
@rm -f $(BT_ROOT)/src/api/internal/*/*.o
@rm -Rf $(BT_ROOT)/include
.PHONY: clean
test: all
......
......@@ -55,15 +55,6 @@ all: $(LIBRARY)
.PHONY: all
$(LIBRARY): $(OBJECTS)
[ -d lib ] || mkdir -p lib
[ -d include ] || mkdir -p include
[ -d include/api ] || mkdir -p include/api
[ -d include/shared ] || mkdir -p include/shared
@cp src/api/*.h include/api
@cp src/shared/*.h include/shared
@echo " * linking $(LIBRARY)"
ar cr $@ $^
-ranlib $@
......@@ -71,3 +62,18 @@ $(LIBRARY): $(OBJECTS)
$(OBJECTS): $(SOURCES)
@echo " * compiling" $(*F).cpp
@$(CXX) -c $(*D)/$(*F).cpp $(LDFLAGS) $(CXXFLAGS) $(INCLUDES) -o $(*D)/$(*F).o
.PHONY: api
api:
@echo " * Creating BamTools API"
@mkdir -p lib
@mkdir -p include
@mkdir -p include/api
@mkdir -p include/shared
@cp src/api/*.h include/api
@cp src/shared/*.h include/shared
.PHONY: clean_api
clean_api:
@echo " * Cleaning-up BamTools API"
@rm -rf ./lib ./src/api/*.o ./src/api/internal/*/*.o ./include
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment