Compare commits
10 commits
1755c69296
...
cbcffb4717
Author | SHA1 | Date | |
---|---|---|---|
snow flurry | cbcffb4717 | ||
snow flurry | b4596781ea | ||
6312f8bfdb | |||
a9b6d5c596 | |||
134796a9e5 | |||
ee5bee4f2e | |||
808565e725 | |||
e52b61f121 | |||
77f083298a | |||
d7687df5f0 |
|
@ -1,6 +1,6 @@
|
|||
# 2016, Georg Sauthoff <mail@georg.so>
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
project(somake C CXX)
|
||||
|
||||
include(CheckFunctionExists)
|
||||
|
@ -56,6 +56,7 @@ set_property(TARGET ${PROJECT_NAME} mksh vroot PROPERTY INCLUDE_DIRECTORIES
|
|||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${BSD_INCLUDE_DIRS}
|
||||
)
|
||||
set_property(TARGET ${PROJECT_NAME} mksh vroot PROPERTY CXX_STANDARD 98)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
mksh vroot pthread ${BSD_LIBRARIES} ${NSL_LIB} ${INTL_LIB}
|
||||
|
@ -64,7 +65,8 @@ target_link_libraries(${PROJECT_NAME}
|
|||
# default install prefix is /usr/local
|
||||
# change it with e.g. -DCMAKE_INSTALL_PREFIX=/usr
|
||||
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
|
||||
install(FILES man/man1/make.1 DESTINATION share/man/man1)
|
||||
install(FILES man/man1/make.1 DESTINATION share/man/man1
|
||||
RENAME ${PROJECT_NAME}.1)
|
||||
install(FILES bin/make.rules.file DESTINATION share/${PROJECT_NAME}
|
||||
RENAME make.rules)
|
||||
install(FILES bin/svr4.make.rules.file DESTINATION share/${PROJECT_NAME}
|
||||
|
@ -92,6 +94,8 @@ set(CPACK_PACKAGE_VERSION_MINOR "6")
|
|||
set(CPACK_PACKAGE_VERSION_PATCH "0")
|
||||
set(CPACK_RPM_PACKAGE_GROUP "Development/Tools")
|
||||
set(CPACK_RPM_PACKAGE_URL "https://github.com/gsauthof/somake")
|
||||
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
|
||||
"/usr/share/man" "/usr/share/man/man1")
|
||||
# CPackDeb default to CPACK_PACKAGE_DESCRIPTION_SUMMARY, although
|
||||
# the long description makes more sense ...
|
||||
file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_DEBIAN_PACKAGE_DESCRIPTION)
|
||||
|
|
10
README.md
10
README.md
|
@ -1,3 +1,5 @@
|
|||
[![Open Build Service](https://img.shields.io/badge/OBS-.deb%20.rpm-green.svg)][obs]
|
||||
|
||||
This repository contains the [Illumos][illumos] make source code (in branch
|
||||
`illumos`) and based on that a port to Linux (branch `master`).
|
||||
|
||||
|
@ -249,7 +251,8 @@ generation in GNU make prints misleading messages (cf. e.g. bug
|
|||
102). Sun make's `.make.state` file (that is used for hidden
|
||||
dependency and command dependency tracking) sometimes causes more
|
||||
harm than good - e.g. when outdated dependencies aren't removed
|
||||
(e.g. when one converts a target group into a target list).
|
||||
(e.g. when one converts a target group into a target list). Or when
|
||||
include files are regenerated unconditionally (cf. `test/empty_cmd.mf`).
|
||||
|
||||
The distributed make that comes with OpenOffice is [also named
|
||||
DMake][oodmake]. It seems that it was independently developed of Sun's
|
||||
|
@ -368,6 +371,10 @@ Or:
|
|||
$ rpm2cpio somake-0.6.0-Linux.rpm | cpio --list -v
|
||||
$ rpm -qip somake-0.6.0-Linux.rpm
|
||||
|
||||
### Open Build Service
|
||||
|
||||
There is also an [Open Build Service Repository][obs] that provides
|
||||
somake binary packages for several distributions.
|
||||
|
||||
## License
|
||||
|
||||
|
@ -388,4 +395,5 @@ also under the [CDDL][cddl].
|
|||
[smake]: https://sourceforge.net/projects/s-make/
|
||||
[imake]: https://en.wikipedia.org/wiki/Imake
|
||||
[dmake]: https://docs.oracle.com/cd/E24457_01/html/E25220/index.html
|
||||
[obs]: https://build.opensuse.org/package/show/home:gsauthof/somake
|
||||
|
||||
|
|
|
@ -353,16 +353,6 @@ extern void gather_recursive_deps(void);
|
|||
extern char *get_current_path(void);
|
||||
extern int get_job_msg_id(void);
|
||||
extern wchar_t *getmem_wc(register int size);
|
||||
/* On linux getwd(char *) is defined in 'unistd.h' */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __sun
|
||||
extern char *getwd(char *);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
extern void handle_interrupt(int);
|
||||
extern Boolean is_running(Name target);
|
||||
extern void load_cached_names(void);
|
||||
|
|
|
@ -51,5 +51,6 @@ extern void warning_mksh(char * message, ...);
|
|||
extern void append_string(register char *from, register String to, register int length);
|
||||
extern wchar_t *get_wstring(char * from);
|
||||
|
||||
#define bsd_signal(x, y) signal(x, y)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -51,15 +51,16 @@
|
|||
#include <sys/wait.h> /* wait() */
|
||||
#include <ulimit.h> /* ulimit() */
|
||||
#include <unistd.h> /* close(), dup2() */
|
||||
// closefrom only available on Solaris/BSD
|
||||
// closefrom only available on Solaris/BSD via system header
|
||||
#include <stdlib.h> /* closefrom() */
|
||||
#ifdef __linux
|
||||
#include <bsd/unistd.h>
|
||||
#endif
|
||||
#include <libintl.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined(__linux) && defined(HAVE_CLOSEFROM)
|
||||
#include <bsd/unistd.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* typedefs & structs
|
||||
*/
|
||||
|
|
114
test/empty_cmd.mf
Normal file
114
test/empty_cmd.mf
Normal file
|
@ -0,0 +1,114 @@
|
|||
# (A)
|
||||
.KEEP_STATE:
|
||||
|
||||
all: hello
|
||||
|
||||
clean:
|
||||
rm foo.x foo.y
|
||||
|
||||
foo.x:
|
||||
touch foo.x
|
||||
|
||||
# <- workaround: disable command dependencies
|
||||
# ?touch foo.x
|
||||
|
||||
foo.y: foo.x
|
||||
cat foo.x foo.x > foo.y
|
||||
|
||||
# <- workaround: disable command dependencies
|
||||
# ?cat foo.x foo.x > foo.y
|
||||
|
||||
# (B)
|
||||
include foo.y
|
||||
|
||||
|
||||
hello:
|
||||
echo hello
|
||||
|
||||
# The perhaps unintuitive effect of `.KEEP_STATE`
|
||||
# on the generation of include files.
|
||||
#
|
||||
# Effects:
|
||||
#
|
||||
# 1) comment out the line after (A)
|
||||
#
|
||||
# $ somake -f empty_cmd.mf clean
|
||||
# rm foo.x foo.y
|
||||
# $ rm .make.state
|
||||
# $ somake -f empty_cmd.mf
|
||||
# touch foo.x
|
||||
# cat foo.x foo.x > foo.y
|
||||
# echo hello
|
||||
# hello
|
||||
# $ somake -f empty_cmd.mf
|
||||
# echo hello
|
||||
# hello
|
||||
#
|
||||
# -> meaning that the include file foo.y is only updated
|
||||
# if it doesn't exist or foo.x is newer. This is
|
||||
# the expected behavior.
|
||||
#
|
||||
# 2) comment in (A) and comment out (B)
|
||||
#
|
||||
# $ somake -f empty_cmd.mf clean
|
||||
# rm foo.x foo.y
|
||||
# $ rm .make.state
|
||||
# $ somake -f empty_cmd.mf foo.y
|
||||
# touch foo.x
|
||||
# cat foo.x foo.x > foo.y
|
||||
# $ somake -f empty_cmd.mf foo.y
|
||||
# `foo.y' is up to date.
|
||||
#
|
||||
# -> again, as expected the foo.y action is only executed once.
|
||||
#
|
||||
# 3) comment in (A) and (B)
|
||||
#
|
||||
# $ somake -f empty_cmd.mf clean
|
||||
# touch foo.x
|
||||
# cat foo.x foo.x > foo.y
|
||||
# rm foo.x foo.y
|
||||
# $ rm .make.state
|
||||
# $ somake -f empty_cmd.mf
|
||||
# touch foo.x
|
||||
# cat foo.x foo.x > foo.y
|
||||
# echo hello
|
||||
# hello
|
||||
# $ somake -f empty_cmd.mf
|
||||
# touch foo.x
|
||||
# cat foo.x foo.x > foo.y
|
||||
# echo hello
|
||||
# hello
|
||||
#
|
||||
# -> this is unexpected because foo.y is generated each time.
|
||||
# This is caused by an interaction between KEEP_STATE and
|
||||
# include. Make reads in the `.make.state` file after
|
||||
# include directives are being processed. But, as part of the
|
||||
# dependency checking of the include files the usual KEEP_STATE
|
||||
# logic is applied such that make assumes that the foo.y action
|
||||
# command changed from '' (empty) to 'cat foo.x foo.x > foo.y'.
|
||||
#
|
||||
# (make basically looks up the 'old' command in an empty database)
|
||||
#
|
||||
# When calling make with `-d` the log contains messages like:
|
||||
#
|
||||
# different from empty old command
|
||||
# Building foo.x because new command longer than old
|
||||
# Building foo.y because new command longer than old
|
||||
#
|
||||
# A workaround is to disable command dependencies for the involved
|
||||
# actions, i.e. `?touch foo` and `?cat foo.x foo.x > foo.y`
|
||||
#
|
||||
# This is a bug.
|
||||
#
|
||||
# Possible fix:
|
||||
# i) Just don't use the make.state database before it is loaded.
|
||||
# This effectively would disable command dependencies for
|
||||
# generated include files. Similar effect as the described
|
||||
# workaround.
|
||||
# ii) or, preferably, load the make.state file before any
|
||||
# processing of include directives. This would have
|
||||
# the advantage that an include file is regenerated if a
|
||||
# variable that is used in the generate action has
|
||||
# changed (think: `generate.sh $(CC) $(LD) > tool_dependent.mf`
|
||||
|
||||
|
Loading…
Reference in a new issue