code / btui

Lines2.2K C1.2K Python549 Markdown219 make156 Lua49
(48 lines)
1 PREFIX=
2 CC ?= gcc
3 O ?= -O2
4 CFLAGS=-std=c99 -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L -Werror
5 CWARN=-Wall -Wpedantic -Wextra \
6 -Wsign-conversion -Wtype-limits -Wunused-result -Wnull-dereference \
7 -Waggregate-return -Walloc-zero -Walloca -Warith-conversion -Wcast-align -Wcast-align=strict \
8 -Wdangling-else -Wdate-time -Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches \
9 -Wduplicated-cond -Wexpansion-to-defined -Wfloat-conversion -Wfloat-equal -Wformat-nonliteral \
10 -Wformat-security -Wformat-signedness -Wframe-address -Winline -Winvalid-pch -Wjump-misses-init \
11 -Wlogical-op -Wlong-long -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn \
12 -Wnull-dereference -Woverlength-strings -Wpacked -Wpacked-not-aligned -Wpointer-arith \
13 -Wredundant-decls -Wshadow -Wshadow=compatible-local -Wshadow=global -Wshadow=local \
14 -Wsign-conversion -Wstack-protector -Wsuggest-attribute=const -Wswitch-default -Wswitch-enum \
15 -Wsync-nand -Wtrampolines -Wundef -Wunused -Wunused-but-set-variable \
16 -Wunused-const-variable -Wunused-local-typedefs -Wvariadic-macros -Wvector-operation-performance \
17 -Wvla -Wwrite-strings
18 #CFLAGS += -fsanitize=address -fno-omit-frame-pointer
19 ifeq ($(shell uname -s),Darwin)
20 CFLAGS += -D_DARWIN_C_SOURCE
21 endif
22 G=
23 LUA_DIR=/usr/local
24 LUA_INC=$(LUA_DIR)/include
25 LUA_BIN=$(LUA_DIR)/bin
26 LUA= lua
27 LUA_O_FLAGS=-fPIC
28 ifeq ($(shell uname -s),Darwin)
29 LUA_SHARED_FLAGS=-bundle -undefined dynamic_lookup
30 else
31 LUA_SHARED_FLAGS=-shared -fPIC
32 endif
34 all: btui.so
36 clean:
37 rm -f lbtui.o btui.so
39 test: btui.so test.lua
40 $(LUA) test.lua
42 btui.so: lbtui.o ../btui.h
43 $(CC) $(CFLAGS) $(CWARN) $(G) $(O) $(LUA_SHARED_FLAGS) -I$(LUA_INC) -o $@ $<
45 lbtui.o: lbtui.c
46 $(CC) $(CFLAGS) $(CWARN) $(G) $(O) $(LUA_O_FLAGS) -c -o $@ $<
48 .PHONY: all, clean, testlua, test