public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
* [olang/patches/.build.yml] build success
  2024-09-17 12:46 ` [PATCH olang v1 4/4] docs: info: add instructions to install/uninstall olang Johnny Richard
@ 2024-09-17 10:48   ` builds.sr.ht
  0 siblings, 0 replies; 7+ messages in thread
From: builds.sr.ht @ 2024-09-17 10:48 UTC (permalink / raw)
  To: Johnny Richard; +Cc: ~johnnyrichard/olang-devel

olang/patches/.build.yml: SUCCESS in 20s

[build: add install and uninstall targets][0] from [Johnny Richard][1]

[0]: https://lists.sr.ht/~johnnyrichard/olang-devel/patches/55076
[1]: mailto:johnny@johnnyrichard.com

✓ #1329923 SUCCESS olang/patches/.build.yml https://builds.sr.ht/~johnnyrichard/job/1329923

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH olang v1 0/4] build: add install and uninstall targets
@ 2024-09-17 12:46 Johnny Richard
  2024-09-17 12:46 ` [PATCH olang v1 1/4] build: add install/uninstall targets for info docs Johnny Richard
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Johnny Richard @ 2024-09-17 12:46 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Johnny Richard

Johnny Richard (4):
  build: add install/uninstall targets for info docs
  build: add install/uninstall targets for man pages
  build: add install/uninstall targets for olang bin
  docs: info: add instructions to install/uninstall olang

 .gitignore                                    |  1 +
 Makefile                                      | 84 ++++++++++++++++---
 docs/.gitignore                               |  1 +
 docs/Makefile                                 | 19 ++---
 docs/{manual => info}/.gitignore              |  0
 docs/{manual => info}/Makefile                |  0
 docs/{manual => info}/_header.html            |  0
 docs/{manual => info}/contribution-guide.texi |  0
 docs/{manual => info}/getting-started.texi    |  0
 docs/info/installation.texi                   | 80 ++++++++++++++++++
 docs/{manual => info}/introduction.texi       |  0
 docs/{manual => info}/olang.texi              |  0
 docs/{manual => info}/specification.texi      |  2 +-
 docs/{manpages => man/man1}/olang.1           |  2 -
 docs/manual/installation.texi                 |  2 -
 15 files changed, 162 insertions(+), 29 deletions(-)
 create mode 100644 docs/.gitignore
 rename docs/{manual => info}/.gitignore (100%)
 rename docs/{manual => info}/Makefile (100%)
 rename docs/{manual => info}/_header.html (100%)
 rename docs/{manual => info}/contribution-guide.texi (100%)
 rename docs/{manual => info}/getting-started.texi (100%)
 create mode 100644 docs/info/installation.texi
 rename docs/{manual => info}/introduction.texi (100%)
 rename docs/{manual => info}/olang.texi (100%)
 rename docs/{manual => info}/specification.texi (99%)
 rename docs/{manpages => man/man1}/olang.1 (99%)
 delete mode 100644 docs/manual/installation.texi


base-commit: 5a9ba5e6b37739787f631d9775c187405a69b084
-- 
2.46.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH olang v1 1/4] build: add install/uninstall targets for info docs
  2024-09-17 12:46 [PATCH olang v1 0/4] build: add install and uninstall targets Johnny Richard
@ 2024-09-17 12:46 ` Johnny Richard
  2024-09-17 12:46 ` [PATCH olang v1 2/4] build: add install/uninstall targets for man pages Johnny Richard
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Johnny Richard @ 2024-09-17 12:46 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Johnny Richard

Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
---
 .gitignore                                    |  1 +
 Makefile                                      | 60 +++++++++++++++----
 docs/.gitignore                               |  1 +
 docs/Makefile                                 |  8 +--
 docs/{manual => info}/.gitignore              |  0
 docs/{manual => info}/Makefile                |  0
 docs/{manual => info}/_header.html            |  0
 docs/{manual => info}/contribution-guide.texi |  0
 docs/{manual => info}/getting-started.texi    |  0
 docs/{manual => info}/installation.texi       |  0
 docs/{manual => info}/introduction.texi       |  0
 docs/{manual => info}/olang.texi              |  0
 docs/{manual => info}/specification.texi      |  2 +-
 13 files changed, 57 insertions(+), 15 deletions(-)
 create mode 100644 docs/.gitignore
 rename docs/{manual => info}/.gitignore (100%)
 rename docs/{manual => info}/Makefile (100%)
 rename docs/{manual => info}/_header.html (100%)
 rename docs/{manual => info}/contribution-guide.texi (100%)
 rename docs/{manual => info}/getting-started.texi (100%)
 rename docs/{manual => info}/installation.texi (100%)
 rename docs/{manual => info}/introduction.texi (100%)
 rename docs/{manual => info}/olang.texi (100%)
 rename docs/{manual => info}/specification.texi (99%)

diff --git a/.gitignore b/.gitignore
index a565aae..0fe0790 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 olang
 build
 *.o
+*.info
 docs/site.tar.gz
 tests/*/*_test
diff --git a/Makefile b/Makefile
index 2f5273b..120cb7f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,58 @@
-TARGET    := olang
-SRC_DIR   := src
-BUILD_DIR := build
-CFLAGS    := -Werror -Wall -Wextra -Wmissing-declarations -pedantic -std=c11 -ggdb
+.POSIX:
 
-SRCS      := $(wildcard $(SRC_DIR)/*.c)
-HEADERS   := $(wildcard $(SRC_DIR)/*.h)
-OBJS      := $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRCS))
+CC := gcc
+
+CFLAGS := ${CFLAGS}
+CFLAGS += -Werror -Wall -Wextra -Wmissing-declarations
+CFLAGS += -pedantic -std=c11 -ggdb
+
+TARGET := olang
+
+PREFIX ?= /usr/local
+
+BINDIR ?= ${PREFIX}/bin
+DATADIR ?= ${PREFIX}/share
+INFODIR ?= ${DATADIR}/info
+MANDIR ?= ${DATADIR}/man
+SRCDIR := src
+BUILDDIR := build
+
+SRCS := $(wildcard $(SRCDIR)/*.c)
+HEADERS := $(wildcard $(SRCDIR)/*.h)
+OBJS := $(patsubst $(SRCDIR)/%.c, $(BUILDDIR)/%.o, $(SRCS))
 
 .PHONY: all
 all: $(TARGET)
 
-$(TARGET): $(BUILD_DIR) $(OBJS)
+.PHONY: info
+info: olang.info
+
+# install target
+
+.PHONY: install
+install: install-info
+
+.PHONY: install-info
+install-info: olang.info
+	install -Dm 644 olang.info ${DESTDIR}${INFODIR}/olang.info
+	gzip -f ${DESTDIR}${INFODIR}/olang.info
+
+# uninstall target
+
+.PHONY: uninstall
+uninstall: uninstall-info
+
+.PHONY: uninstall-info
+uninstall-info:
+	@rm -f ${DESTDIR}${INFODIR}/olang.info.gz
+
+olang.info: docs/info/*.texi
+	$(MAKEINFO) docs/info/olang.texi
+
+$(TARGET): $(BUILDDIR) $(OBJS)
 	$(CC) $(CFLAGS) $(OBJS) -o $(TARGET)
 
-$(BUILD_DIR):
+$(BUILDDIR):
 	@mkdir -p $@
 
 .PHONY: format
@@ -38,6 +77,7 @@ unit-test:
 
 .PHONY: clean
 clean:
+	@rm -f olang.info
 	$(MAKE) -C tests/unit/ clean
 	@rm -rf build/ $(TARGET)
 
@@ -55,5 +95,5 @@ docs:
 docs-dist:
 	$(MAKE) -C docs dist
 
-$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
+$(BUILDDIR)/%.o: $(SRCDIR)/%.c
 	$(CC) $(CFLAGS) -c $< -o $@
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 0000000..567609b
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1 @@
+build/
diff --git a/docs/Makefile b/docs/Makefile
index a38c091..f069ff1 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -14,7 +14,7 @@ all:  $(BUILD_DIR) $(STYLE) $(TARGET) manpages manual
 clean:
 	rm -rf $(BUILD_DIR)
 	rm -f $(DIST_FILE)
-	make -C manual clean
+	make -C info clean
 
 .PHONY: dist
 dist: $(DIST_FILE)
@@ -43,7 +43,7 @@ $(BUILD_DIR):
 $(STYLE): $(BUILD_DIR)
 	cp style.css $(SITE_DIR)
 
-$(SITE_DIR)/manual/index.html: manual/*.texi
-	make -C manual
+$(SITE_DIR)/manual/index.html: info/*.texi
+	make -C info
 	rm -rf $(SITE_DIR)/manual
-	mv manual/html $(SITE_DIR)/manual
+	mv info/html $(SITE_DIR)/manual
diff --git a/docs/manual/.gitignore b/docs/info/.gitignore
similarity index 100%
rename from docs/manual/.gitignore
rename to docs/info/.gitignore
diff --git a/docs/manual/Makefile b/docs/info/Makefile
similarity index 100%
rename from docs/manual/Makefile
rename to docs/info/Makefile
diff --git a/docs/manual/_header.html b/docs/info/_header.html
similarity index 100%
rename from docs/manual/_header.html
rename to docs/info/_header.html
diff --git a/docs/manual/contribution-guide.texi b/docs/info/contribution-guide.texi
similarity index 100%
rename from docs/manual/contribution-guide.texi
rename to docs/info/contribution-guide.texi
diff --git a/docs/manual/getting-started.texi b/docs/info/getting-started.texi
similarity index 100%
rename from docs/manual/getting-started.texi
rename to docs/info/getting-started.texi
diff --git a/docs/manual/installation.texi b/docs/info/installation.texi
similarity index 100%
rename from docs/manual/installation.texi
rename to docs/info/installation.texi
diff --git a/docs/manual/introduction.texi b/docs/info/introduction.texi
similarity index 100%
rename from docs/manual/introduction.texi
rename to docs/info/introduction.texi
diff --git a/docs/manual/olang.texi b/docs/info/olang.texi
similarity index 100%
rename from docs/manual/olang.texi
rename to docs/info/olang.texi
diff --git a/docs/manual/specification.texi b/docs/info/specification.texi
similarity index 99%
rename from docs/manual/specification.texi
rename to docs/info/specification.texi
index e028fe9..df5c029 100644
--- a/docs/manual/specification.texi
+++ b/docs/info/specification.texi
@@ -1,4 +1,4 @@
-@node Specification
+@node Language Specification
 @chapter Specification
 
 @section Introduction
-- 
2.46.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH olang v1 2/4] build: add install/uninstall targets for man pages
  2024-09-17 12:46 [PATCH olang v1 0/4] build: add install and uninstall targets Johnny Richard
  2024-09-17 12:46 ` [PATCH olang v1 1/4] build: add install/uninstall targets for info docs Johnny Richard
@ 2024-09-17 12:46 ` Johnny Richard
  2024-09-17 12:46 ` [PATCH olang v1 3/4] build: add install/uninstall targets for olang bin Johnny Richard
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Johnny Richard @ 2024-09-17 12:46 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Johnny Richard

Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
---
 Makefile                            | 20 ++++++++++++++++++--
 docs/Makefile                       | 11 +----------
 docs/{manpages => man/man1}/olang.1 |  2 --
 3 files changed, 19 insertions(+), 14 deletions(-)
 rename docs/{manpages => man/man1}/olang.1 (99%)

diff --git a/Makefile b/Makefile
index 120cb7f..35f0283 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ BINDIR ?= ${PREFIX}/bin
 DATADIR ?= ${PREFIX}/share
 INFODIR ?= ${DATADIR}/info
 MANDIR ?= ${DATADIR}/man
+MAN1DIR ?= ${MANDIR}/man1
 SRCDIR := src
 BUILDDIR := build
 
@@ -30,7 +31,15 @@ info: olang.info
 # install target
 
 .PHONY: install
-install: install-info
+install: install-man install-info
+
+.PHONY: install-man
+install-man: install-man1
+
+.PHONY: install-man1
+install-man1: docs/man/man1/olang.1
+	install -Dm 644 docs/man/man1/olang.1 ${DESTDIR}${MAN1DIR}/olang.1
+	gzip -f ${DESTDIR}${MAN1DIR}/olang.1
 
 .PHONY: install-info
 install-info: olang.info
@@ -40,7 +49,14 @@ install-info: olang.info
 # uninstall target
 
 .PHONY: uninstall
-uninstall: uninstall-info
+uninstall: uninstall-man uninstall-info
+
+.PHONY: uninstall-man
+uninstall-man: uninstall-man1
+
+.PHONY: uninstall-man1
+uninstall-man1:
+	@rm -f ${DESTDIR}${MAN1DIR}/olang.1.gz
 
 .PHONY: uninstall-info
 uninstall-info:
diff --git a/docs/Makefile b/docs/Makefile
index f069ff1..a17c1d6 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -5,10 +5,9 @@ SITE_DIR   := $(BUILD_DIR)/site
 TARGET     := $(SITE_DIR)/index.html
 DIST_FILE  := site.tar.gz
 STYLE      := style.css
-MANPAGES   := $(BUILD_DIR)/man
 
 .PHONY: all
-all:  $(BUILD_DIR) $(STYLE) $(TARGET) manpages manual
+all:  $(BUILD_DIR) $(STYLE) $(TARGET) manual
 
 .PHONY: clean
 clean:
@@ -19,16 +18,9 @@ clean:
 .PHONY: dist
 dist: $(DIST_FILE)
 
-.PHONY: manpages
-manpages: $(BUILD_DIR) $(MANPAGES)/olang.1
-
 .PHONY: manual
 manual: $(SITE_DIR)/manual/index.html
 
-
-$(MANPAGES)/%.1: manpages/%.1
-	@cp $< $@
-
 $(DIST_FILE): all
 	tar -czf $(DIST_FILE) -C $(SITE_DIR) .
 
@@ -38,7 +30,6 @@ $(TARGET): index.html
 $(BUILD_DIR):
 	@mkdir -p $@
 	@mkdir -p $(SITE_DIR)
-	@mkdir -p $(MANPAGES)
 
 $(STYLE): $(BUILD_DIR)
 	cp style.css $(SITE_DIR)
diff --git a/docs/manpages/olang.1 b/docs/man/man1/olang.1
similarity index 99%
rename from docs/manpages/olang.1
rename to docs/man/man1/olang.1
index fed1e4e..fa6544f 100644
--- a/docs/manpages/olang.1
+++ b/docs/man/man1/olang.1
@@ -39,12 +39,10 @@ Keep temp files used to compile program
 
 .TP
 .BI \-\-arch\  arch
-
 Binary arch: default to "x86_64", avaliable options ("x86_64" | "aarch64")
 
 .TP
 .BI \-\-sysroot\  dir
-
 System root dir where the GNU Assembler and GNU Linker are located: default to '/'
 
 
-- 
2.46.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH olang v1 3/4] build: add install/uninstall targets for olang bin
  2024-09-17 12:46 [PATCH olang v1 0/4] build: add install and uninstall targets Johnny Richard
  2024-09-17 12:46 ` [PATCH olang v1 1/4] build: add install/uninstall targets for info docs Johnny Richard
  2024-09-17 12:46 ` [PATCH olang v1 2/4] build: add install/uninstall targets for man pages Johnny Richard
@ 2024-09-17 12:46 ` Johnny Richard
  2024-09-17 12:46 ` [PATCH olang v1 4/4] docs: info: add instructions to install/uninstall olang Johnny Richard
  2024-09-17 15:33 ` [PATCH olang v1 0/4] build: add install and uninstall targets Carlos Maniero
  4 siblings, 0 replies; 7+ messages in thread
From: Johnny Richard @ 2024-09-17 12:46 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Johnny Richard

Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
---
 Makefile | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 35f0283..12b09a4 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,11 @@ info: olang.info
 # install target
 
 .PHONY: install
-install: install-man install-info
+install: install-bin install-man install-info
+
+.PHONY: install-bin
+install-bin: $(TARGET)
+	install -Dm755 $< ${DESTDIR}${BINDIR}/$<
 
 .PHONY: install-man
 install-man: install-man1
@@ -49,7 +53,11 @@ install-info: olang.info
 # uninstall target
 
 .PHONY: uninstall
-uninstall: uninstall-man uninstall-info
+uninstall: uninstall-bin uninstall-man uninstall-info
+
+.PHONY: uninstall-bin
+uninstall-bin: ${DESTDIR}${BINDIR}/olang
+	@rm -f ${DESTDIR}${BINDIR}/olang
 
 .PHONY: uninstall-man
 uninstall-man: uninstall-man1
-- 
2.46.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH olang v1 4/4] docs: info: add instructions to install/uninstall olang
  2024-09-17 12:46 [PATCH olang v1 0/4] build: add install and uninstall targets Johnny Richard
                   ` (2 preceding siblings ...)
  2024-09-17 12:46 ` [PATCH olang v1 3/4] build: add install/uninstall targets for olang bin Johnny Richard
@ 2024-09-17 12:46 ` Johnny Richard
  2024-09-17 10:48   ` [olang/patches/.build.yml] build success builds.sr.ht
  2024-09-17 15:33 ` [PATCH olang v1 0/4] build: add install and uninstall targets Carlos Maniero
  4 siblings, 1 reply; 7+ messages in thread
From: Johnny Richard @ 2024-09-17 12:46 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Johnny Richard

Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
---
 docs/info/installation.texi | 78 +++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/docs/info/installation.texi b/docs/info/installation.texi
index ef79184..d61b0e9 100644
--- a/docs/info/installation.texi
+++ b/docs/info/installation.texi
@@ -1,2 +1,80 @@
 @node Installation
 @chapter Installation
+
+This installation assumes you are running an unix like operation system and
+requires @code{make}, @code{makeinfo} and a @strong{c compiler} installed.
+
+The following commands will compile the the code and install @code{olang}
+binary, @code{man} pages and @code{info} docs into your system.
+
+@verbatim
+$ make
+$ make install
+@end verbatim
+
+And for uninstall the program run
+
+@verbatim
+$ make uninstall
+@end verbatim
+
+@section Custom Installation
+
+There are few @code{make} variables which can be used to customize your
+installation as described bellow.
+
+@table @samp
+
+@item PREFIX
+
+The prefix where the compiler and docs should be installed, it is set to
+@code{/usr/local} if not specified.
+
+@item BINDIR
+
+The path where the compiler binary will be installed, it is set to
+@code{$PREFIX/bin} if not specified.
+
+@item DATADIR
+
+The path where the read-only documents will be installed, it is set to
+@code{$PREFIX/share} if not specified.
+
+@item MANDIR
+
+The path where the man documents will be installed, it is set to
+@code{$DATADIR/man} if not specified.
+
+@item MAN1DIR
+
+The path where the man1 documents will be installed, it is set to
+@code{$MANDIR/man1} if not specified.
+
+@item INFODIR
+
+The path where the info documents will be installed, it is set to
+@code{$DATADIR/info} if not specified.
+
+@item DESTDIR
+
+In case you are installing the compiler on different root than @code{/} (by
+default the install assumes the destination dir as root), you can set the
+variable @strong{DESTDIR} on @code{make} for example:
+
+@verbatim
+$ make DESTDIR=/mnt/linux-root install
+@end verbatim
+
+@end table
+
+@section Developer Tips
+
+If you want to install the compiler but do not want to make it system
+available, you might want to have it installed on the @code{XDG}
+@strong{~/.local} directory.  Make sure you have set @code{PATH},
+@code{MANPATH} and @code{INFOPATH} correctly so you can have the resources
+installed available on your shell.
+
+@verbatim
+$ make PREFIX=~/.local install
+@end verbatim
-- 
2.46.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH olang v1 0/4] build: add install and uninstall targets
  2024-09-17 12:46 [PATCH olang v1 0/4] build: add install and uninstall targets Johnny Richard
                   ` (3 preceding siblings ...)
  2024-09-17 12:46 ` [PATCH olang v1 4/4] docs: info: add instructions to install/uninstall olang Johnny Richard
@ 2024-09-17 15:33 ` Carlos Maniero
  4 siblings, 0 replies; 7+ messages in thread
From: Carlos Maniero @ 2024-09-17 15:33 UTC (permalink / raw)
  To: Johnny Richard, ~johnnyrichard/olang-devel

Thank you so much! This is a great contribution.

I'm happy to execute *make install* and have olang available on my
system.

To git.sr.ht:~johnnyrichard/olang
   14ff487..29cc9fc  main -> main

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-09-17 15:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-17 12:46 [PATCH olang v1 0/4] build: add install and uninstall targets Johnny Richard
2024-09-17 12:46 ` [PATCH olang v1 1/4] build: add install/uninstall targets for info docs Johnny Richard
2024-09-17 12:46 ` [PATCH olang v1 2/4] build: add install/uninstall targets for man pages Johnny Richard
2024-09-17 12:46 ` [PATCH olang v1 3/4] build: add install/uninstall targets for olang bin Johnny Richard
2024-09-17 12:46 ` [PATCH olang v1 4/4] docs: info: add instructions to install/uninstall olang Johnny Richard
2024-09-17 10:48   ` [olang/patches/.build.yml] build success builds.sr.ht
2024-09-17 15:33 ` [PATCH olang v1 0/4] build: add install and uninstall targets Carlos Maniero

Code repositories for project(s) associated with this public inbox

	https://git.johnnyrichard.com/olang.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox