Add PDCurses and make Windows option

This commit is contained in:
Aaron Cook 2023-08-23 22:04:48 -05:00
commit 15879787a5
2 changed files with 22 additions and 6 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "lib/PDCurses"]
path = lib/PDCurses
url = git@github.com:wmcbrine/PDCurses.git

View file

@ -1,5 +1,19 @@
CC=clang TARGET_OS=LINUX
CFLAGS=-Wall -MMD -pthread -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=199309L CFLAGS=-Wall -MMD -pthread -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=199309L
SRCS=$(wildcard $(DIR_SRC)/*.c)
OBJS=$(addprefix $(DIR_OBJ)/,$(addsuffix .o,$(basename $(SRCS))))
DEPS=$(addprefix $(DIR_OBJ)/,$(addsuffix .d,$(basename $(SRCS))))
ifeq ($(TARGET_OS), LINUX)
CC=clang
else
CC=x86_64-w64-mingw32-gcc
CFLAGS+=-Llib/PDCurses/wincon -Llib/PDCurses
DEPS+=PDCurses
endif
LDFLAGS=-lpthread -lncurses LDFLAGS=-lpthread -lncurses
DIR_SRC=src DIR_SRC=src
@ -16,11 +30,7 @@ else
CFLAGS += -O2 CFLAGS += -O2
endif endif
SRCS=$(wildcard $(DIR_SRC)/*.c) .PHONY: all install uninstall clean PDCurses
OBJS=$(addprefix $(DIR_OBJ)/,$(addsuffix .o,$(basename $(SRCS))))
DEPS=$(addprefix $(DIR_OBJ)/,$(addsuffix .d,$(basename $(SRCS))))
.PHONY: all install uninstall clean
all: $(TARGET) all: $(TARGET)
@ -40,6 +50,9 @@ $(DIR_OBJ)/$(DIR_SRC)/%.o: $(DIR_SRC)/%.c
@echo "compile $<" @echo "compile $<"
@$(CC) $(CFLAGS) -c $< -o $@ @$(CC) $(CFLAGS) -c $< -o $@
PDCurses:
cd lib/PDCurses/wincon && $(MAKE) -j CC=x86_64-w64-mingw32-gcc
clean: clean:
rm -rf $(DIR_BUILD) rm -rf $(DIR_BUILD)