commit a1b614bd62b6a2b1c0b2fc070a0d1632316804d1
parent 05694b0dc364c8ba01fa879a8a0c54f86b608991
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 10 Dec 2017 01:23:40 -0500
Switch from meson to plain makefile
Diffstat:
4 files changed, 65 insertions(+), 30 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1 +1,3 @@
-build
+.build
+scdoc
+scdoc.1
diff --git a/COPYING b/COPYING
@@ -0,0 +1,19 @@
+Copyright © 2017 Drew DeVault
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the “Software”), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Makefile b/Makefile
@@ -0,0 +1,43 @@
+CC=cc
+CFLAGS=-Wall -Wextra -Werror -Wno-unused-parameter
+LDFLAGS=-static
+INCLUDE=-Iinclude
+PREFIX=/usr/local
+DESTDIR=
+_INSTDIR=$(DESTDIR)$(PREFIX)
+BINDIR=$(_INSTDIR)/bin
+MANDIR=$(_INSTDIR)/share/man
+.DEFAULT_GOAL=all
+
+OBJECTS=\
+ .build/main.o \
+ .build/string.o \
+ .build/utf8_chsize.o \
+ .build/utf8_decode.o \
+ .build/utf8_encode.o \
+ .build/utf8_fgetch.o \
+ .build/utf8_fputch.o \
+ .build/utf8_size.o \
+ .build/util.o
+
+.build/%.o: src/%.c
+ @mkdir -p .build
+ $(CC) -std=c99 -c -o $@ $(CFLAGS) $(INCLUDE) $<
+
+scdoc: $(OBJECTS)
+ $(CC) $(LDFLAGS) -o $@ $^
+
+scdoc.1: scdoc.1.scd scdoc
+ ./scdoc < $< > $@
+
+all: scdoc scdoc.1
+
+clean:
+ rm -rf .build scdoc
+
+install: all
+ mkdir -p $(DESTDIR)
+ install -Dm755 scdoc $(BINDIR)/scdoc
+ install -Dm644 scdoc.1 $(MANDIR)/scdoc.1
+
+.PHONY: all clean install
diff --git a/meson.build b/meson.build
@@ -1,29 +0,0 @@
-# TODO: Just use a makefile
-project(
- 'scdoc',
- 'c',
- license: 'MIT',
- meson_version: '>=0.43.0',
- default_options: [
- 'c_std=c99',
- 'warning_level=2',
- 'werror=true',
- ],
-)
-
-add_project_arguments('-Wno-unused-parameter', language: 'c')
-
-executable(
- 'scdoc', [
- 'src/main.c',
- 'src/string.c',
- 'src/utf8_chsize.c',
- 'src/utf8_decode.c',
- 'src/utf8_encode.c',
- 'src/utf8_fgetch.c',
- 'src/utf8_fputch.c',
- 'src/utf8_size.c',
- 'src/util.c',
- ],
- include_directories: include_directories('include')
-)