public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
58526ac95f40397a7ef7af73127e217f431a89c3 blob 2370 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
 
.POSIX:

CC := gcc

CFLAGS := ${CFLAGS}
CFLAGS += -Werror -Wall -Wextra -Wmissing-declarations
CFLAGS += -pedantic -std=c11 -ggdb

TARGET := olc

PREFIX ?= /usr/local

BINDIR ?= ${PREFIX}/bin
DATADIR ?= ${PREFIX}/share
INFODIR ?= ${DATADIR}/info
MANDIR ?= ${DATADIR}/man
MAN1DIR ?= ${MANDIR}/man1
SRCDIR := src
BUILDDIR := build

SRCS := $(wildcard $(SRCDIR)/*.c)
HEADERS := $(wildcard $(SRCDIR)/*.h)
OBJS := $(patsubst $(SRCDIR)/%.c, $(BUILDDIR)/%.o, $(SRCS))

.PHONY: all
all: $(TARGET)

.PHONY: info
info: olang.info

# install target

.PHONY: install
install: install-bin install-man install-info

.PHONY: install-bin
install-bin: $(TARGET)
	install -Dm755 $< ${DESTDIR}${BINDIR}/$<

.PHONY: install-man
install-man: install-man1

.PHONY: install-man1
install-man1: docs/man/man1/olc.1
	install -Dm 644 docs/man/man1/olc.1 ${DESTDIR}${MAN1DIR}/olc.1
	gzip -f ${DESTDIR}${MAN1DIR}/olc.1

.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-bin uninstall-man uninstall-info

.PHONY: uninstall-bin
uninstall-bin: ${DESTDIR}${BINDIR}/$(TARGET)
	@rm -f ${DESTDIR}${BINDIR}/$(TARGET)

.PHONY: uninstall-man
uninstall-man: uninstall-man1

.PHONY: uninstall-man1
uninstall-man1:
	@rm -f ${DESTDIR}${MAN1DIR}/olc.1.gz

.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)
	@printf 'CCLD\t%s\n' '$@'

$(BUILDDIR):
	@mkdir -p $@

.PHONY: format
format: $(SRCS) $(HEADERS)
	@clang-format --dry-run --Werror $?
	@$(MAKE) --no-print-directory -C tests/unit/ format

.PHONY: format-fix
format-fix: $(SRCS) $(HEADERS)
	@clang-format -i $?
	@$(MAKE) --no-print-directory -C tests/unit/ format-fix

.PHONY: check-olc
check-olc: $(TARGET)
	$(MAKE) -C tests/olc/

.PHONY: check-unit
check-unit: $(TARGET)
	$(MAKE) -C tests/unit/

.PHONY: clean
clean:
	@rm -f olang.info
	@$(MAKE) --no-print-directory -C tests/unit/ clean
	@rm -rf build/ $(TARGET)

.PHONY: check
check: check-unit check-olc

.PHONY: docs
docs:
	$(MAKE) -C docs

.PHONY: docs-dist
docs-dist:
	$(MAKE) -C docs dist

$(BUILDDIR)/%.o: $(SRCDIR)/%.c
	@$(CC) $(CFLAGS) -c $< -o $@
	@printf 'CC\t%s\n' '$@'
debug log:

solving 58526ac ...
found 58526ac in https://git.johnnyrichard.com/olang.git

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