diff options
| -rw-r--r-- | Makefile | 63 | ||||
| -rw-r--r-- | doc/man/librarian.1 | 16 | ||||
| -rw-r--r-- | src/librarian.c | 12 |
3 files changed, 47 insertions, 44 deletions
@@ -3,6 +3,9 @@ # notice and this notice are preserved. This file is offered as-is, # without any warranty. +.POSIX: + + PREFIX = /usr BIN = /bin DATA = /share @@ -14,6 +17,13 @@ MANDIR = $(DATADIR)/man MAN1DIR = $(MANDIR)/man1 LICENSEDIR = $(DATADIR)/licenses +CC = c99 + +CPPFLAGS = +CFLAGS = +LDFLAGS = + + PKGNAME = librarian COMMAND = librarian @@ -21,12 +31,6 @@ COMMAND = librarian LIBRARIAN_PATH = /usr/local/share/librarian:/usr/share/librarian -OPTIMISE = -O2 -WARN = -Wall -Wextra -pedantic -FLAGS = -std=c99 $(WARN) $(OPTIMISE) -D'DEFAULT_PATH="$(LIBRARIAN_PATH)"' - - - .PHONY: default default: base info shell @@ -41,11 +45,11 @@ cmd: bin/librarian bin/librarian: obj/librarian.o @mkdir -p bin - ${CC} ${FLAGS} -o $@ $^ ${LDFLAGS} + $(CC) -o $@ obj/librarian.o $(LDFLAGS) obj/%.o: src/%.c src/*.h mkdir -p obj - ${CC} ${FLAGS} -c -o $@ ${CPPFLAGS} ${CFLAGS} $< + $(CC) -D'DEFAULT_PATH="$(LIBRARIAN_PATH)"' -c -o $@ $< $(CPPFLAGS) $(CFLAGS) .PHONY: doc doc: info pdf dvi ps @@ -115,62 +119,62 @@ install-base: install-cmd install-copyright .PHONY: install-cmd install-cmd: bin/librarian - install -dm755 -- "$(DESTDIR)$(BINDIR)" - install -m755 $< -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" + mkdir -p -- "$(DESTDIR)$(BINDIR)" + cp -- bin/librarian "$(DESTDIR)$(BINDIR)/$(COMMAND)" .PHONY: install-copyright install-copyright: install-license .PHONY: install-license install-license: - install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - install -m644 LICENSE -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" + cp -- LICENSE "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" .PHONY: install-doc install-doc: install-info install-pdf install-dvi install-ps install-man .PHONY: install-info install-info: bin/librarian.info - install -dm755 -- "$(DESTDIR)$(INFODIR)" - install -m644 $< -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info" + mkdir -p -- "$(DESTDIR)$(INFODIR)" + cp -- bin/librarian.info "$(DESTDIR)$(INFODIR)/$(PKGNAME).info" .PHONY: install-pdf install-pdf: bin/librarian.pdf - install -dm755 -- "$(DESTDIR)$(DOCDIR)" - install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf" + mkdir -p -- "$(DESTDIR)$(DOCDIR)" + cp -- bin/librarian.pdf "$(DESTDIR)$(DOCDIR)/$(PKGNAME).pdf" .PHONY: install-dvi install-dvi: bin/librarian.dvi - install -dm755 -- "$(DESTDIR)$(DOCDIR)" - install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi" + mkdir -p -- "$(DESTDIR)$(DOCDIR)" + cp -- bin/librarian.dvi "$(DESTDIR)$(DOCDIR)/$(PKGNAME).dvi" .PHONY: install-ps install-ps: bin/librarian.ps - install -dm755 -- "$(DESTDIR)$(DOCDIR)" - install -m644 $< -- "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps" + mkdir -p -- "$(DESTDIR)$(DOCDIR)" + cp -- bin/librarian.ps "$(DESTDIR)$(DOCDIR)/$(PKGNAME).ps" .PHONY: install-man install-man: doc/man/librarian.1 - install -dm755 -- "$(DESTDIR)$(MAN1DIR)" - install -m644 $< -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" + mkdir -p -- "$(DESTDIR)$(MAN1DIR)" + cp -- doc/man/librarian.1 "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" .PHONY: install-shell install-shell: install-bash install-fish install-zsh .PHONY: install-bash install-bash: bin/librarian.bash-completion - install -dm755 -- "$(DESTDIR)$(DATADIR)/bash-completion/completions" - install -m644 $< -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)" + mkdir -p -- "$(DESTDIR)$(DATADIR)/bash-completion/completions" + cp -- bin/librarian.bash-completion "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)" .PHONY: install-fish install-fish: bin/librarian.fish-completion - install -dm755 -- "$(DESTDIR)$(DATADIR)/fish/completions" - install -m644 $< -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish" + mkdir -p -- "$(DESTDIR)$(DATADIR)/fish/completions" + cp -- bin/librarian.fish-completion "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish" .PHONY: install-zsh install-zsh: bin/librarian.zsh-completion - install -dm755 -- "$(DESTDIR)$(DATADIR)/zsh/site-functions" - install -m644 $< -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)" + mkdir -p -- "$(DESTDIR)$(DATADIR)/zsh/site-functions" + cp -- bin/librarian.zsh-completion "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)" @@ -192,5 +196,4 @@ uninstall: .PHONY: clean clean: - -rm -r bin obj - + -rm -rf -- bin obj diff --git a/doc/man/librarian.1 b/doc/man/librarian.1 index 85a5d5f..f4d0d2c 100644 --- a/doc/man/librarian.1 +++ b/doc/man/librarian.1 @@ -8,7 +8,7 @@ librarian \- Return flags for compiling against libraries .SH DESCRIPTION .B librarian is used to print flags required when compiling or linking, -and want to use library that requires non-trival flags. +and want to use a library that requires non-trivial flags. .PP .B librarian shall output the flags, required by the selected libraries, @@ -89,7 +89,7 @@ Combines and .IR NAME \fB<\fP MAX . .PP -The are not predefined values for +There are no predefined values for .IR VARIABLE , but the standardised ones are: .TP @@ -125,7 +125,7 @@ appear in the other variables unless the library requires them directly. .PP All variables should be in upper case unless they are -reserved. In the latter case, the are lower cased. +reserved. In the latter case, they are lower case. .PP If .I VARIABLE @@ -148,7 +148,7 @@ by an .PP Empty lines and lines starting with a .B # -(she) in a +(hash) in a .B librarian files are ignored. Other lines should begin with a variable name and be followed by the required flags relevant to that @@ -170,7 +170,7 @@ Print the location of the files specified by .IR LIBRARY . .TP .B \-o -Prefer-older libraries, when multiple versions are available. +Prefer older libraries, when multiple versions are available. .SH ENVIRONMENT .B LIBRARIAN_PATH Colon separated list of directories to search for librarian files. @@ -194,11 +194,11 @@ sucks. Will be implemented if needed in the real world: .TP * -When is used +When .BR \-d , .B librarian -will try all versions of the libraries until it founds -a combination all selected libraries and their dependencies +will try all versions of the libraries until it finds +a combination where all selected libraries and their dependencies are compatible with, rather than simply failing. .TP * diff --git a/src/librarian.c b/src/librarian.c index 7c1bd8f..d4265a4 100644 --- a/src/librarian.c +++ b/src/librarian.c @@ -71,7 +71,7 @@ struct library { /** * Is the version stored in - * `ypper` acceptable. + * `upper` acceptable. */ int upper_closed; }; @@ -155,7 +155,7 @@ static int found_file_name_cmp(const void *a, const void *b) * name of a non-reserved variable. * * @param s The string. - * @return 1: The string is a varible name. + * @return 1: The string is a variable name. * 0: The string is a library. */ static int is_variable(const char *s) @@ -239,7 +239,7 @@ static int version_subcmp(char *a, char *b) while (*a || *b) { /* Compare digit part. */ - /* (We must support arbitrary lenght.) */ + /* (We must support arbitrary length.) */ ap = a + strspn(a, "0123456789"); bp = b + strspn(b, "0123456789"); while (*a == '0') a++; @@ -332,7 +332,7 @@ static int test_library_version(char *version, struct library *required) * * @param lib Library specification. * @param path The pathname of the directory. - * @param oldest Are older versions prefered? + * @param oldest Are older versions preferred? * @return The pathname of the library's librarian file. * `NULL` on error or if not found, if not found, * `errno` is set to 0. @@ -398,7 +398,7 @@ fail: * * @param lib Library specification. * @param path LIBRARIAN_PATH. - * @param oldest Are older versions prefered? + * @param oldest Are older versions preferred? * @return The pathname of the library's librarian file. * `NULL` on error or if not found, if not found, * `errno` is set to 0. @@ -455,7 +455,7 @@ fail: * @param libraries The sought libraries. * @param n The number of elements in `libraries`. * @param path LIBRARIAN_PATH. - * @param oldest Are older versions prefered? + * @param oldest Are older versions preferred? * @return 0: Successful and found all files. * -1 and !errno: Did not find all files, but otherwise successful. * -1 and errno: An error occurred |
