tAdapt more suckless file structure - ve - a minimal text editor (work in progress)
(HTM) git clone git://src.adamsgaard.dk/ve
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit d3c6a5c61fddd9d07d135ea3b02b0a024c258ce6
(DIR) parent 59092f03497bf45762c483931b59b5c8927a9fae
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Wed, 7 Aug 2019 22:41:25 +0200
Adapt more suckless file structure
Diffstat:
M Makefile | 38 ++++++++++++++++++++-----------
A config.def.h | 0
M ve.c | 11 ++++++++---
3 files changed, 33 insertions(+), 16 deletions(-)
---
(DIR) diff --git a/Makefile b/Makefile
t@@ -10,13 +10,7 @@ VECFLAGS = -DVERSION=\"$(VERSION)\" -DPROGNAME=\"$(BIN)\" -D_DEFAULT_SOURCE $(CF
PREFIX ?= /usr/local
STRIP ?= strip
-default: $(BIN)
-
-$(BIN): $(OBJ)
- $(CC) $(LDFLAGS) $(OBJ) -o $@
-
-.c.o:
- $(CC) $(VECFLAGS) -c $<
+all: options $(BIN)
options:
@echo $(BIN) build options:
t@@ -24,7 +18,29 @@ options:
@echo "LDFLAGS = $(LDFLAGS)"
@echo "CC = $(CC)"
-install: $(BIN)
+.c.o:
+ $(CC) $(VECFLAGS) -c $<
+
+$(OBJ): config.h config.mk
+
+config.h: config.def.h
+ cp $< $@
+
+$(BIN): $(OBJ)
+ $(CC) $(LDFLAGS) $(OBJ) -o $@
+
+clean:
+ $(RM) $(BIN) $(OBJ) $(BIN)-$(VERSION).tar.gz
+
+dist: clean
+ mkdir -p $(BIN)-$(VERSION)
+ cp -R LICENSE Makefile README config.def.h config.mk\
+ $(BIN).1 $(SRC) $(BIN)-$(VERSION)
+ tar -cf $(BIN)-$(VERSION).tar $(BIN)-$(VERSION)
+ gzip $(BIN)-$(VERSION).tar
+ $(RM) -r $(BIN)-$(VERSION)
+
+install: all
$(STRIP) $(BIN)
mkdir -p $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
t@@ -39,8 +55,4 @@ uninstall:
$(RM) $(DESTDIR)$(MANPREFIX)/man1/$(BIN).1
$(RM) -r $(DESTDIR)$(DOCPREFIX)/$(BIN)
-clean:
- $(RM) *.o
- $(RM) $(BIN)
-
-.PHONY: default install uninstall clean options
+.PHONY: all options clean dist install uninstall
(DIR) diff --git a/config.def.h b/config.def.h
(DIR) diff --git a/ve.c b/ve.c
t@@ -1,5 +1,8 @@
/* see LICENSE for license details */
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
t@@ -8,21 +11,21 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>
+#include "config.h"
+
/* macros */
+
#define TAB_WIDTH 4
#define STATUS_MESSAGE_TIMEOUT 3
#define ABUF_INIT {NULL, 0}
#define CTRL_KEY(k) ((k) & 0x1f)
-
/* types */
struct abuf {
t@@ -57,11 +60,13 @@ struct editor_config {
/* function declarations */
+
char* editor_prompt(char *prompt);
void editor_set_status_message(const char *fmt, ...);
/* global variables */
+
struct editor_config E;