-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple scheme for installation targets
- each directory has now INSTALL_BIN/LIB/DOC variables where you can specify which targets from this directory should be marked for installation - there is now an option to add at the top level file 'final.mk' which will be included after all rules are read and processed - you can use there all variables which are defined in the project (examples show how this file can be used for specifying installation targets).
- Loading branch information
1 parent
8d24b0c
commit 6a1ae99
Showing
9 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
TARGETS := dir1_lib.a | ||
SUBDIRS := Dir_1a Dir_1b | ||
|
||
INSTALL_LIB := $(TARGETS) | ||
|
||
dir1_lib.a_DEPS = dir_1_file1.o dir_1_file2.o dir_1_file3.o $(SUBDIRS_TGTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
TARGETS := dir2_lib.a | ||
SUBDIRS := Dir_2a Dir_2b Dir_ex | ||
|
||
INSTALL_LIB := $(TARGETS) | ||
|
||
dir2_lib.a_DEPS = dir_2_file1.o dir_2_file2.o \ | ||
$(TARGETS_$(d)/Dir_2a) $(TARGETS_$(d)/Dir_2b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Some documentation that needs to be installed for ex1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Just a simple example how final.mk can be used for 'install' targets | ||
# You can refer here to any variable defined in the project tree since | ||
# it is included after all rules has been read and processed. | ||
# | ||
# Variables of particular interest: | ||
# INSTALL_BIN_$(dir) - binaries to be installed from directory 'dir' | ||
# INSTALL_LIB_$(dir) - same for libraries | ||
# INSTALL_DOC_$(dir) - and for documentation | ||
|
||
BIN_DIR := /tmp/test-ex1/bin | ||
LIB_DIR := /tmp/test-ex1/lib | ||
DOC_DIR := /tmp/test-ex1/share/doc/ex1 | ||
|
||
INSTALL := install | ||
INSTALL_DATA := install -m 644 | ||
|
||
install: install-bin install-lib install-doc | ||
|
||
install-bin : $(call get_subtree,INSTALL_BIN,$(TOP)) | ||
$(INSTALL) -d $(BIN_DIR) | ||
$(INSTALL) -t $(BIN_DIR) $^ | ||
|
||
install-lib : $(call get_subtree,INSTALL_LIB,$(TOP)) | ||
$(INSTALL) -d $(LIB_DIR) | ||
$(INSTALL) -t $(LIB_DIR) $(filter-out %.a,$^) | ||
$(INSTALL) -t $(LIB_DIR) -m 644 $(filter %.a,$^) | ||
|
||
install-doc: $(call get_subtree,INSTALL_DOC,$(TOP)) | ||
$(INSTALL) -d $(DOC_DIR) | ||
$(INSTALL_DATA) -t $(DOC_DIR) $^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,7 @@ OBJS := | |
CLEAN := | ||
TARGETS := | ||
SUBDIRS := | ||
|
||
INSTALL_BIN := | ||
INSTALL_LIB := | ||
INSTALL_DOC := |