1# Makefile for PDCurses library for SDL 2 3O = o 4 5ifeq ($(OS),Windows_NT) 6 E = .exe 7 CC = gcc 8 RM = cmd /c del 9 10 SFLAGS = -Ic:/sdl2-2.0.7/include 11 SLIBS = -Lc:/sdl2-2.0.7/lib/x64 -lSDL2main -lSDL2 12 13 TFLAGS = -Ic:/sdl2_ttf-2.0.14/include 14 TLIBS =-Lc:/sdl2_ttf-2.0.14/lib/x64 -lSDL2_ttf 15 16 DEMOFLAGS = -mwindows 17else 18 RM = rm -f 19 20 SFLAGS = $(shell sdl2-config --cflags) 21 SLIBS = $(shell sdl2-config --libs) 22 23 TLIBS = -lSDL2_ttf 24endif 25 26ifndef PDCURSES_SRCDIR 27 PDCURSES_SRCDIR = .. 28endif 29 30include $(PDCURSES_SRCDIR)/libobjs.mif 31 32osdir = $(PDCURSES_SRCDIR)/sdl2 33 34PDCURSES_SDL_H = $(osdir)/pdcsdl.h 35 36# If your system doesn't have these, remove the defines here 37SFLAGS += -DHAVE_VSNPRINTF -DHAVE_VSSCANF 38 39ifeq ($(DEBUG),Y) 40 CFLAGS = -g -Wall -DPDCDEBUG -fPIC 41else 42 CFLAGS += -O2 -Wall -fPIC 43endif 44 45ifeq ($(WIDE),Y) 46 CFLAGS += -DPDC_WIDE $(TFLAGS) 47 SLIBS += $(TLIBS) 48endif 49 50ifeq ($(UTF8),Y) 51 CFLAGS += -DPDC_FORCE_UTF8 52endif 53 54BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) 55 56LINK = $(CC) 57LDFLAGS = $(LIBCURSES) $(SLIBS) 58RANLIB = ranlib 59LIBCURSES = libpdcurses.a 60 61DEMOS += sdltest$(E) 62 63.PHONY: all libs clean demos install 64 65all: libs demos 66 67libs: $(LIBCURSES) 68 69clean: 70 -$(RM) *.o trace $(LIBCURSES) $(DEMOS) 71 72demos: $(DEMOS) 73ifneq ($(DEBUG),Y) 74 strip $(DEMOS) 75endif 76 77$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) 78 ar rv $@ $? 79 -$(RANLIB) $@ 80 81$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) 82$(PDCOBJS) : $(PDCURSES_SDL_H) 83$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) 84tui.o tuidemo.o : $(PDCURSES_CURSES_H) 85terminfo.o: $(TERM_HEADER) 86panel.o ptest$(E): $(PANEL_HEADER) 87 88$(LIBOBJS) : %.o: $(srcdir)/%.c 89 $(BUILD) $(SFLAGS) -c $< 90 91$(PDCOBJS) : %.o: $(osdir)/%.c 92 $(BUILD) $(SFLAGS) -c $< 93 94firework$(E): $(demodir)/firework.c 95 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 96 97ozdemo$(E): $(demodir)/ozdemo.c 98 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 99 100ptest$(E): $(demodir)/ptest.c 101 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 102 103rain$(E): $(demodir)/rain.c 104 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 105 106testcurs$(E): $(demodir)/testcurs.c 107 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 108 109tuidemo$(E): tuidemo.o tui.o 110 $(LINK) tui.o tuidemo.o -o $@ $(LDFLAGS) 111 112worm$(E): $(demodir)/worm.c 113 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 114 115xmas$(E): $(demodir)/xmas.c 116 $(BUILD) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 117 118sdltest$(E): $(osdir)/sdltest.c 119 $(BUILD) $(SFLAGS) $(DEMOFLAGS) -o $@ $< $(LDFLAGS) 120 121tui.o: $(demodir)/tui.c $(demodir)/tui.h 122 $(BUILD) -c $(DEMOFLAGS) $(demodir)/tui.c 123 124tuidemo.o: $(demodir)/tuidemo.c 125 $(BUILD) -c $(DEMOFLAGS) $(demodir)/tuidemo.c 126 127ncurses_testdir = $(HOME)/ncurses-5.9/test 128include $(demodir)/nctests.mif 129