Skip to content

Commit

Permalink
Fussion of sub-makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
fadado committed Aug 15, 2016
1 parent b89b693 commit 84d4f88
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 141 deletions.
77 changes: 71 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# jqt management
#

project=jqt

include make.d/config.make
include make.d/debug.make
project := jqt

########################################################################
# Parameters (redefine as you like)
Expand All @@ -14,12 +11,80 @@ prefix ?= /usr/local
bindir ?= $(prefix)/bin
datadir ?= $(prefix)/share

########################################################################
# Prerequisites
########################################################################

# We are using some of the newest GNU Make features... so require GNU
# Make version >= 3.82
version_test := $(filter 3.82,$(firstword $(sort $(MAKE_VERSION) 3.82)))
ifndef version_test
$(error GNU Make version $(MAKE_VERSION); version >= 3.82 is needed)
endif

# Paranoia
ifeq (0,$(shell id --user))
ifeq (,$(filter install uninstall,$(MAKECMDGOALS)))
$(error Root only can make "(un)install" targets)
endif
SUDO :=
else
SUDO := sudo
endif

########################################################################
# Configuration
########################################################################

# Disable builtins.
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables

# Warn when an undefined variable is referenced.
MAKEFLAGS += --warn-undefined-variables

# Make will not print the recipe used to remake files.
.SILENT:

# Eliminate use of the built-in implicit rules. Also clear out the
# default list of suffixes for suffix rules.
.SUFFIXES:

# Sets the default goal to be used if no targets were specified on the
# command line.
.DEFAULT_GOAL := all

# When it is time to consider phony targets, make will run its recipe
# unconditionally, regardless of whether a file with that name exists or
# what its last-modification time is.
.PHONY: all

# When a target is built all lines of the recipe will be given to a
# single invocation of the shell.
# !!!Does not work in make <= 3.82 event it is documented!!!
#.ONESHELL:

# Default shell: if we require GNU Make, why not require Bash?
SHELL := /bin/bash

# The argument(s) passed to the shell are taken from the variable
# .SHELLFLAGS.
.SHELLFLAGS := -o errexit -o pipefail -o nounset -c

# Make will delete the target of a rule if it has changed and its recipe
# exits with a nonzero exit status.
.DELETE_ON_ERROR:

########################################################################
# Rules
########################################################################

# Configure tools
include make.d/setup.make
# Warning: only `dnf`! Use this rule as template to your own script.
setup:
@rpm -q --quiet general-purpose-preprocessor || sudo dnf -y install general-purpose-preprocessor
@rpm -q --quiet jq || sudo dnf -y install jq
@rpm -q --quiet pandoc || sudo dnf -y install pandoc
@test -d /usr/share/doc/PyYAML || sudo dnf -y install PyYAML

# Default target
all: check
Expand Down
3 changes: 2 additions & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ TARGETS := $(foreach f,$(ASSETS) $(foreach p,index $(PAGES),$(p).html),$(DESTINA
# Main
all: $(TARGETS)
test -f /etc/xml/xhtml1-dtds.xml \
&& xmllint --noout --valid $(DESTINATION)/*.html
&& xmllint --noout --valid $(DESTINATION)/*.html \
&& echo 'XHTML valid!'

# Directories
$(CACHE) $(DESTINATION):
Expand Down
20 changes: 11 additions & 9 deletions docs/content/engine.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
<%include "site.yaml">
title: Operating the engine
updated: "2016-08-13T07:48:26Z"
updated: "2016-08-15T11:17:00Z"
---
<%include "macros.m">&
<%include "LINKS.md">&
Expand Down Expand Up @@ -168,7 +168,7 @@ on the modules `json` and `yaml`.
The project uses [GNU Make][MAKE] on several development activities, but `make`
is not necessary to run `jqt`.
All external shell commands called by `jqt` are:
The external shell commands called by `jqt` are:
* `cat`
* `gpp`
Expand All @@ -182,7 +182,7 @@ All external shell commands called by `jqt` are:
* `sleep`
* `tee`
Under a recent <%cite Fedora> <%cite Linux> distribution the following commands will install
Under a recent <%cite Fedora> <%cite Linux> distribution the following command will install
all the extra software _jqt_ needs:
```zsh
Expand All @@ -192,31 +192,33 @@ $ sudo dnf -y install make general-purpose-preprocessor jq pandoc PyYAML
## Installation
If you know how to use `make` please read the `Makefile` located in the _jqt_
top directory and run `make install` if you agree with the thinks that will
top directory and run `make install` if you agree with the things that will
happen. You can also change the installation directory:
```zsh
$ sudo make install prefix=/your/installation/path
```
You can also install _jqt_ by hand with few orders like:
But if you choose a directory diferent of `/usr/local/share` for the shared data
you must still edit the parameter `DATADIR` definition in the `bin/jqt` file.
You can also install _jqt_ by hand executing few orders from the _jqt_ top
directory:
```zsh
$ sudo mkdir -p /usr/local/bin /usr/local/share/jqt
$ sudo cp bin/jqt /usr/local/bin
$ sudo chmod +x /usr/local/bin/jqt
$ sudo cp bin/* /usr/local/bin
$ sudo cp share/* /usr/local/share/jqt
```
If you are using a recent <%cite Fedora> <%cite Linux> distribution or similar
`make` will also help you to install all the extra software _jqt_ needs:
`make` will also help you to install all the extra software _jqt_ needs (except
`make` itself):
```zsh
$ sudo make setup
```
<#
vim:ts=4:sw=4:ai:et:fileencoding=utf8:syntax=markdown
#>
7 changes: 4 additions & 3 deletions docs/content/home.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
<%include "site.yaml">
updated: "2016-08-13T07:48:26Z"
updated: "2016-08-15T08:56:24Z"
---
<%include "macros.m">&
<%include "LINKS.md">&
Expand Down Expand Up @@ -74,8 +74,9 @@ example looks like a template?
### Status
If you want to learn to use _jqt_, read the documentation at
[https://fadado.github.io/jqt/][JQT]. _jqt_ is developed under the _Fedora_ Linux
If you want to learn to use _jqt_, [read this documentation](#)
and [install _jqt_](./engine.html#installation) and associated utilities.
_jqt_ is developed under the _Fedora_ Linux
distribution, and a lot of portability issues are expected at this stage of
development. Please, use the project [GitHub repository][REPO] features if you
want to collaborate or send any kind of questions.
Expand Down
65 changes: 0 additions & 65 deletions make.d/config.make

This file was deleted.

30 changes: 0 additions & 30 deletions make.d/debug.make

This file was deleted.

16 changes: 0 additions & 16 deletions make.d/setup.make

This file was deleted.

17 changes: 6 additions & 11 deletions tests/expected/macros-00.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
frameborder="0"></iframe>

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-8673551-2"]);
_gaq.push(["_trackPageview"]);
(function() {
var ga = document.createElement("script");
ga.type = "text/javascript";
ga.async = true;
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(ga, s);
})();
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-8673551-2', 'auto');
ga('send', 'pageview');
</script>

0 comments on commit 84d4f88

Please sign in to comment.