diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8634b5a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/PDCurses"] + path = lib/PDCurses + url = git@github.com:wmcbrine/PDCurses.git diff --git a/Makefile b/Makefile index 2c57a52..e09ca14 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,19 @@ -CC=clang +TARGET_OS=LINUX + 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 DIR_SRC=src @@ -16,11 +30,7 @@ else CFLAGS += -O2 endif -SRCS=$(wildcard $(DIR_SRC)/*.c) -OBJS=$(addprefix $(DIR_OBJ)/,$(addsuffix .o,$(basename $(SRCS)))) -DEPS=$(addprefix $(DIR_OBJ)/,$(addsuffix .d,$(basename $(SRCS)))) - -.PHONY: all install uninstall clean +.PHONY: all install uninstall clean PDCurses all: $(TARGET) @@ -40,6 +50,9 @@ $(DIR_OBJ)/$(DIR_SRC)/%.o: $(DIR_SRC)/%.c @echo "compile $<" @$(CC) $(CFLAGS) -c $< -o $@ +PDCurses: + cd lib/PDCurses/wincon && $(MAKE) -j CC=x86_64-w64-mingw32-gcc + clean: rm -rf $(DIR_BUILD)