more POSIX makefile #85
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the goal is to make this portable via POSIX compatibility, this makefile is more portable. I assume the goal is to make it POSIX based off of the source and docs, correct me if I'm wrong. Conditional assignment (VAR ?= VALUE) is not POSIX (see
make(1p), it's behaviour is unspecified. The.PHONYrule, while handy for recipes, is not POSIX. In this case, there will never be files that evaluate to the clean, debug, install, or uninstall target names, so it's unneeded anyways. Some choose to keep.PHONYin POSIX makefiles just for good practice even though it's not specified. The special .POSIX target ensures that CC is c99 (no need for -std=c99) and that the .c single suffix rules for source files evaluates to:$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<. I tried to make a clean-looking debug rule, but meh. Typically, debug is not a rule in makefiles. Users and packagers typically override variables with the make command; e.g.make PREFIX=/usr install, etc. Same with CC variable.makefileis matched beforeMakefile(seemake(1p)). I seperated the build and install rule. Typically, you don't want to build as root. The flow of the makefile build system is to build as a user, then install as root to properly set permissions. That is:Tested with GNU Make, CI check seems to be hardcoded to match for
Makefile.If 79 is merged (I highly recommend, with the overhead that pthread needs, threading actually slows down the program in this case.) just remove the
LDFLAGS = -lpthreadline.