rewrite Makefile

This commit is contained in:
Night Kaly 2024-03-15 11:51:58 +00:00
parent 53b56e40a8
commit c1387bcee1
No known key found for this signature in database
GPG key ID: 8E829D3381CFEBBE
2 changed files with 22 additions and 11 deletions

View file

@ -1,26 +1,31 @@
.POSIX: .POSIX:
.SUFFIXES: .SUFFIXES:
CC = cc
VERSION = 1.0
TARGET = ccc TARGET = ccc
MANPAGE = ccc.1 MANPAGE = ccc.1
SRC = ccc.c util.c file.c config.h CONF = config.h
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
# Flags # Flags
LDFLAGS = $(shell pkg-config --libs ncurses) LDFLAGS = $(shell pkg-config --libs ncurses)
CFLAGS = -march=native -mtune=native -O3 -pipe -s -std=c99 -pedantic $(shell pkg-config --cflags ncurses) -Wall # -Wextra -Werror CFLAGS = -march=native -mtune=native -O3 -pipe -s -std=c99 -pedantic $(shell pkg-config --cflags ncurses) -Wall # -Wextra -Werror
CC=cc
PREFIX ?= /usr/local
CONF = config.h
BINDIR = $(PREFIX)/bin SRC = ccc.c util.c file.c $(CONF)
MANDIR = $(PREFIX)/share/man/man1
.PHONY: all install uninstall clean
$(TARGET): $(SRC) $(TARGET): $(SRC)
$(CC) $(CFLAGS) $(LDFLAGS) $(SRC) -o $@ $(CC) $(CFLAGS) $(LDFLAGS) $(SRC) -o $@
strip $(TARGET)
all: $(TARGET) dist:
mkdir -p $(TARGET)-$(VERSION)
cp -R README.md $(MANPAGE) $(TARGET) $(TARGET)-$(VERSION)
tar -cf $(TARGET)-$(VERSION).tar $(TARGET)-$(VERSION)
gzip $(TARGET)-$(VERSION).tar
rm -rf $(TARGET)-$(VERSION)
install: $(TARGET) install: $(TARGET)
mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(BINDIR)
@ -36,3 +41,7 @@ uninstall:
clean: clean:
$(RM) $(TARGET) $(RM) $(TARGET)
all: $(TARGET)
.PHONY: all dist install uninstall clean

View file

@ -1,7 +1,7 @@
#define CTRLD 0x04 #define CTRLD 0x04
#define ENTER 0xA #define ENTER 0xA
#define CTRLU 0x15 #define CTRLU 0x15
#define ESC 0x1B /* \e or \033 */ #define ESC 0x1B
#define SPACE 0x20 #define SPACE 0x20
#define TILDE 0x7E #define TILDE 0x7E
#define DOWN 0x102 #define DOWN 0x102
@ -11,3 +11,5 @@
#define BACKSPACE 0x107 #define BACKSPACE 0x107
#define PH 1 /* panel height */ #define PH 1 /* panel height */
#define JUMP_NUM 14 /* how long ctrl + u/d jump are */ #define JUMP_NUM 14 /* how long ctrl + u/d jump are */
static const char *editor = "nvim"; /* default text editor */