Patrick Georgi | 3b77b72 | 2011-07-07 15:41:53 +0200 | [diff] [blame] | 1 | # Makefile for PDCurses library for SDL |
| 2 | |
| 3 | O = o |
| 4 | |
| 5 | ifndef PDCURSES_SRCDIR |
| 6 | PDCURSES_SRCDIR = .. |
| 7 | endif |
| 8 | |
| 9 | include $(PDCURSES_SRCDIR)/libobjs.mif |
| 10 | |
| 11 | osdir = $(PDCURSES_SRCDIR)/sdl1 |
| 12 | |
| 13 | PDCURSES_SDL_H = $(osdir)/pdcsdl.h |
| 14 | |
| 15 | ifeq ($(DEBUG),Y) |
| 16 | CFLAGS = -g -Wall -DPDCDEBUG |
| 17 | else |
| 18 | CFLAGS = -O2 -Wall |
| 19 | endif |
| 20 | |
| 21 | CC = gcc |
| 22 | BUILD = $(CC) $(CFLAGS) -I$(PDCURSES_SRCDIR) |
| 23 | LDFLAGS = -mwindows $(LIBCURSES) |
| 24 | |
| 25 | BASEDEF = $(PDCURSES_SRCDIR)\exp-base.def |
| 26 | |
| 27 | DEFDEPS = $(BASEDEF) |
| 28 | |
| 29 | DEFFILE = pdcurses.def |
| 30 | |
| 31 | ifeq ($(DLL),Y) |
| 32 | BUILD += -DPDC_DLL_BUILD |
| 33 | LIBEXE = gcc $(DEFFILE) |
| 34 | LIBFLAGS = -Wl,--out-implib,libpdcurses.a -shared -o |
| 35 | LIBCURSES = pdcurses.dll |
| 36 | CLEAN = $(LIBCURSES) *.a $(DEFFILE) |
| 37 | POST = -lSDL |
| 38 | else |
| 39 | LIBEXE = ar |
| 40 | LIBFLAGS = rcv |
| 41 | LIBCURSES = libpdcurses.a |
| 42 | CLEAN = *.a |
| 43 | LDFLAGS += -lSDL |
| 44 | endif |
| 45 | |
| 46 | DEMOS += sdltest.exe |
| 47 | |
| 48 | .PHONY: all libs clean demos |
| 49 | |
| 50 | all: libs demos |
| 51 | |
| 52 | libs: $(LIBCURSES) |
| 53 | |
| 54 | clean: |
| 55 | -del *.o $(CLEAN) *.exe |
| 56 | |
| 57 | demos: $(DEMOS) |
| 58 | strip *.exe |
| 59 | |
| 60 | pdcurses.dll: $(DEFFILE) |
| 61 | |
| 62 | $(DEFFILE): $(DEFDEPS) |
Stefan Reinauer | 5bbc5e5 | 2015-11-10 09:13:43 -0800 | [diff] [blame] | 63 | echo LIBRARY pdcurses > $@ |
| 64 | echo EXPORTS >> $@ |
| 65 | type $(BASEDEF) >> $@ |
Patrick Georgi | 3b77b72 | 2011-07-07 15:41:53 +0200 | [diff] [blame] | 66 | echo pdc_screen >> $@ |
| 67 | echo pdc_font >> $@ |
| 68 | echo pdc_icon >> $@ |
| 69 | echo pdc_back >> $@ |
| 70 | echo pdc_sheight >> $@ |
| 71 | echo pdc_swidth >> $@ |
| 72 | echo pdc_yoffset >> $@ |
| 73 | echo pdc_xoffset >> $@ |
| 74 | |
| 75 | $(LIBCURSES) : $(LIBOBJS) $(PDCOBJS) |
| 76 | $(LIBEXE) $(LIBFLAGS) $@ $? $(POST) |
| 77 | |
| 78 | $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) |
| 79 | $(PDCOBJS) : $(PDCURSES_SDL_H) |
| 80 | $(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) |
| 81 | tui.o tuidemo.o : $(PDCURSES_CURSES_H) |
| 82 | terminfo.o: $(TERM_HEADER) |
| 83 | panel.o ptest.exe: $(PANEL_HEADER) |
| 84 | |
| 85 | $(LIBOBJS) : %.o: $(srcdir)/%.c |
| 86 | $(BUILD) -c $< |
| 87 | |
| 88 | $(PDCOBJS) : %.o: $(osdir)/%.c |
| 89 | $(BUILD) -c $< |
| 90 | |
| 91 | firework.exe newdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \ |
| 92 | ptest.exe: %.exe: $(demodir)/%.c |
| 93 | $(BUILD) -o $@ $< $(LDFLAGS) |
| 94 | |
| 95 | tuidemo.exe: tuidemo.o tui.o |
| 96 | $(CC) -o $@ tuidemo.o tui.o $(LDFLAGS) |
| 97 | |
| 98 | tui.o: $(demodir)/tui.c $(demodir)/tui.h |
| 99 | $(BUILD) -c $< |
| 100 | |
| 101 | tuidemo.o: $(demodir)/tuidemo.c $(demodir)/tui.h |
| 102 | $(BUILD) -c $< |
| 103 | |
| 104 | sdltest.exe: $(osdir)/sdltest.c |
| 105 | $(BUILD) -o $@ $< -mwindows $(LIBCURSES) -lmingw32 -lSDLmain -lSDL |