Skip to content

Commit

Permalink
Filter source files if CURSES not found ♻️
Browse files Browse the repository at this point in the history
- Updated `Makefile` to exclude `athr_terminal_curses.c/h` if CURSES not found
- Defined `_POSIX_C_SOURCE 200809L` in `athr_terminal_ioctl.c` to ensure compatibility

These changes improve the build process by conditionally excluding source files
related to CURSES if not found, preventing build errors. Additionally, setting
_POSIC_C_SOURCE ensures the `athr_terminal_ioctl.c` file adheres to the correct
POSIX standard for broader compatibility.
  • Loading branch information
horta committed Nov 7, 2024
1 parent fee0bb2 commit 8f36cd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ else
HDR := $(filter-out athr_terminal_win32.h,$(SRC))
endif

ifeq ($(CURSES_FOUND),false)
SRC := $(filter-out athr_terminal_curses.c,$(SRC))
HDR := $(filter-out athr_terminal_curses.h,$(SRC))
endif

CFLAGS += -DATHR_TERMINAL_WIN32=$(ATHR_TERMINAL_WIN32)
CFLAGS += -DATHR_TERMINAL_CURSES=$(ATHR_TERMINAL_CURSES)
CFLAGS += -DATHR_TERMINAL_IOCTL=$(ATHR_TERMINAL_IOCTL)
Expand Down
5 changes: 5 additions & 0 deletions athr_terminal_ioctl.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#endif

#include "athr_terminal_ioctl.h"
#include "athr_logger.h"
#include "athr_terminal.h"
Expand Down

0 comments on commit 8f36cd2

Please sign in to comment.