refactoring

This commit is contained in:
Maxim Devaev 2024-09-04 15:49:55 +03:00
parent 53ec87b416
commit 3e228c1fb8
4 changed files with 9 additions and 14 deletions

View File

@ -1,3 +1,5 @@
include lib.mk
-include config.mk
DESTDIR ?=
@ -23,10 +25,6 @@ endif
# =====
define optbool
$(filter $(shell echo $(1) | tr A-Z a-z), yes on 1)
endef
ifeq ($(V),)
ECHO = @
endif

View File

@ -1,3 +1,5 @@
include ../lib.mk
R_DESTDIR ?=
PREFIX ?= /usr/local
@ -17,11 +19,6 @@ _SRCS = $(shell ls src/uslibs/*.c src/*.c)
_BUILD = build
define optbool
$(filter $(shell echo $(1) | tr A-Z a-z), yes on 1)
endef
WITH_PTHREAD_NP ?= 1
ifneq ($(call optbool,$(WITH_PTHREAD_NP)),)
override _CFLAGS += -DWITH_PTHREAD_NP

3
lib.mk Normal file
View File

@ -0,0 +1,3 @@
define optbool
$(filter $(shell echo $(1) | tr A-Z a-z), yes on 1)
endef

View File

@ -1,3 +1,5 @@
include ../lib.mk
R_DESTDIR ?=
PREFIX ?= /usr/local
@ -45,11 +47,6 @@ _TARGETS = $(_USTR) $(_DUMP)
_OBJS = $(_USTR_SRCS:%.c=$(_BUILD)/%.o) $(_DUMP_SRCS:%.c=$(_BUILD)/%.o)
define optbool
$(filter $(shell echo $(1) | tr A-Z a-z), yes on 1)
endef
ifneq ($(call optbool,$(WITH_GPIO)),)
override _CFLAGS += -DWITH_GPIO $(shell pkg-config --atleast-version=2 libgpiod 2> /dev/null && echo -DHAVE_GPIOD2)
override _USTR_LDFLAGS += -lgpiod