add install target

This commit is contained in:
Georg Sauthoff 2016-08-22 20:55:39 +02:00
parent b421774ba2
commit 4ed41c209c
3 changed files with 55 additions and 9 deletions

View file

@ -19,7 +19,7 @@ add_library(vroot STATIC
lib/vroot/unlink.cc
)
add_executable(somake
add_executable(${PROJECT_NAME}
bin/ar.cc bin/depvar.cc bin/doname.cc bin/dosys.cc
bin/files.cc bin/globals.cc bin/implicit.cc bin/macro.cc
bin/main.cc bin/misc.cc bin/nse_printdep.cc bin/parallel.cc
@ -28,12 +28,22 @@ add_executable(somake
comp/progname.c
)
set_property(TARGET somake mksh vroot PROPERTY INCLUDE_DIRECTORIES
set_property(TARGET ${PROJECT_NAME} mksh vroot PROPERTY INCLUDE_DIRECTORIES
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(somake
target_link_libraries(${PROJECT_NAME}
mksh vroot pthread
)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
install(FILES man/man1/make.1 DESTINATION share/man/man1)
install(FILES bin/make.rules.file DESTINATION share/${PROJECT_NAME}
RENAME make.rules)
install(FILES bin/svr4.make.rules.file DESTINATION share/${PROJECT_NAME}
RENAME svr4.make.rules)
install(FILES README.md DESTINATION share/doc/${PROJECT_NAME}
)
install(DIRECTORY example DESTINATION share/doc/${PROJECT_NAME}
)

View file

@ -282,7 +282,34 @@ Thus, to not add to the confusion I chose `somake`.
## Installation
Basically it is just:
The build file also contains an install target, e.g.:
$ DESTDIR=dest ninja-build install
[1/1] Install the project...
-- Install configuration: "Release"
-- Installing: dest/usr/local/bin/somake
[..]
If you use the standard makefile generator with cmake, just
replace `ninja-build` with `make`. Also, omitting the `DESTDIR`
installs everything for real. The destdir mechanism is useful for
preparing a binary package and just to have a preview.
To change the default install prefix, you have to call `cmake`
differently, e.g.:
$ cmake ../somake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release -G Ninja
$ DESTDIR=dest ninja-build install
[..]
-- Install configuration: "Release"
-- Installing: dest/usr/bin/somake
[..]
### Manual Installation
In case you prefer a manual installation, basically it is just:
- copy the created `somake` binary to a `bin/` directory under some prefix
- copy the man page into the related manpath
@ -290,13 +317,17 @@ Basically it is just:
in the `bin/` subdirectory of this repository to one of the directories
searched by `somake` (and also remove the `.file` suffix)
The `somake` search path is (when `make.rules` is used):
### Rule Search Path
Using `make.rules` as an example, `somake` tries to open it in
the following order:
1. `make.rules`
2. `$ORIGIN/../share/lib/make/make.rules`
3. `$ORIGIN/../../share/make.rules`
4. `/usr/share/lib/make/make.rules`
5. `/etc/default/make.rules`
2. `$ORIGIN/../share/somake/make.rules` # added by this port
3. `$ORIGIN/../share/lib/make/make.rules`
4. `$ORIGIN/../../share/make.rules`
5. `/usr/share/lib/make/make.rules`
6. `/etc/default/make.rules`
## License

View file

@ -142,6 +142,11 @@ read_simple_file(register Name makefile_name, register Boolean chase_path, regis
&makefile_path,
-1);
// As regularly installed
asprintf(&path, "%s/../share/somake", pfx);
add_dir_to_path(path, &makefile_path, -1);
free(path);
// As regularly installed
asprintf(&path, "%s/../share/lib/make", pfx);
add_dir_to_path(path, &makefile_path, -1);