mirror of
https://github.com/vsergeev/c-periphery.git
synced 2026-02-06 23:42:24 +08:00
make: improve portability
Modifications to initial commit: * Collapse conditional NULL device assignment into single line resolves #55. Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
This commit is contained in:
committed by
Vanya A. Sergeev
parent
1f8545b1f8
commit
024a25d18e
7
Makefile
7
Makefile
@@ -10,11 +10,12 @@ TEST_PROGRAMS = $(basename $(wildcard tests/*.c))
|
||||
|
||||
OBJECTS = $(patsubst $(SRCDIR)/%.c,$(OBJDIR)/%.o,$(SRCS))
|
||||
|
||||
GPIO_CDEV_V1_SUPPORT := $(shell ! echo -e "#include <linux/gpio.h>\n#ifndef GPIO_GET_LINEEVENT_IOCTL\n#error\n#endif" | $(CC) -E - >/dev/null 2>&1; echo $$?)
|
||||
GPIO_CDEV_V2_SUPPORT := $(shell ! echo -e "#include <linux/gpio.h>\nint main(void) { GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME; return 0; }" | $(CC) -x c - >/dev/null 2>&1; echo $$?)
|
||||
NULL := $(if $(filter Windows_NT,$(OS)),NUL,/dev/null)
|
||||
GPIO_CDEV_V1_SUPPORT := $(shell ! echo -e "\x23include <linux/gpio.h>\n\x23ifndef GPIO_GET_LINEEVENT_IOCTL\n\x23error\n\x23endif" | $(CC) -E - >$(NULL) 2>&1; echo $$?)
|
||||
GPIO_CDEV_V2_SUPPORT := $(shell ! echo -e "\x23include <linux/gpio.h>\nint main(void) { GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME; return 0; }" | $(CC) -x c - >$(NULL) 2>&1; echo $$?)
|
||||
GPIO_CDEV_SUPPORT = $(if $(filter 1,$(GPIO_CDEV_V2_SUPPORT)),2,$(if $(filter 1,$(GPIO_CDEV_V1_SUPPORT)),1,0))
|
||||
|
||||
COMMIT_ID := $(shell git describe --abbrev --always --tags --dirty 2>/dev/null || echo "")
|
||||
COMMIT_ID := $(shell git describe --abbrev --always --tags --dirty 2>$(NULL) || echo "")
|
||||
|
||||
OPT ?= -O3
|
||||
CFLAGS += -std=gnu99 -pedantic
|
||||
|
||||
Reference in New Issue
Block a user