1# GNU MAKE Makefile for PDCurses library - WIN32 Cygnus GCC 2# 3# Usage: make -f [path\]gccwin32.mak [DEBUG=Y] [DLL=Y] [WIDE=Y] [UTF8=Y] [tgt] 4# 5# where tgt can be any of: 6# [all|demos|pdcurses.a|testcurs.exe...] 7 8O = o 9 10ifndef PDCURSES_SRCDIR 11 PDCURSES_SRCDIR = .. 12endif 13 14include $(PDCURSES_SRCDIR)/version.mif 15include $(PDCURSES_SRCDIR)/libobjs.mif 16 17osdir = $(PDCURSES_SRCDIR)/win32 18 19PDCURSES_WIN_H = $(osdir)/pdcwin.h 20 21CC = gcc 22 23ifeq ($(DEBUG),Y) 24 CFLAGS = -g -Wall -DPDCDEBUG 25 LDFLAGS = -g 26else 27 CFLAGS = -O2 -Wall 28 LDFLAGS = 29endif 30 31CFLAGS += -I$(PDCURSES_SRCDIR) 32 33BASEDEF = $(PDCURSES_SRCDIR)/exp-base.def 34WIDEDEF = $(PDCURSES_SRCDIR)/exp-wide.def 35 36DEFDEPS = $(BASEDEF) 37 38ifeq ($(WIDE),Y) 39 CFLAGS += -DPDC_WIDE 40 DEFDEPS += $(WIDEDEF) 41endif 42 43ifeq ($(UTF8),Y) 44 CFLAGS += -DPDC_FORCE_UTF8 45endif 46 47DEFFILE = pdcurses.def 48 49LINK = gcc 50 51ifeq ($(DLL),Y) 52 CFLAGS += -DPDC_DLL_BUILD 53 LIBEXE = gcc $(DEFFILE) 54 LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o 55 LIBCURSES = pdcurses.dll 56 LIBDEPS = $(LIBOBJS) $(PDCOBJS) $(DEFFILE) 57 CLEAN = $(LIBCURSES) *.a $(DEFFILE) 58else 59 LIBEXE = ar 60 LIBFLAGS = rcv 61 LIBCURSES = pdcurses.a 62 LIBDEPS = $(LIBOBJS) $(PDCOBJS) 63 CLEAN = *.a 64endif 65 66.PHONY: all libs clean demos dist 67 68all: libs demos 69 70libs: $(LIBCURSES) 71 72clean: 73 -rm -f *.o 74 -rm -f *.exe 75 -rm -f $(CLEAN) 76 77demos: $(DEMOS) 78 strip *.exe 79 80$(DEFFILE): $(DEFDEPS) 81 echo LIBRARY pdcurses > $@ 82 echo EXPORTS >> $@ 83 cat $(BASEDEF) >> $@ 84ifeq ($(WIDE),Y) 85 cat $(WIDEDEF) >> $@ 86endif 87 88$(LIBCURSES) : $(LIBDEPS) 89 $(LIBEXE) $(LIBFLAGS) $@ $? 90 -cp pdcurses.a panel.a 91 92$(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS) 93$(PDCOBJS) : $(PDCURSES_WIN_H) 94$(DEMOS) : $(PDCURSES_CURSES_H) $(LIBCURSES) 95panel.o : $(PANEL_HEADER) 96terminfo.o: $(TERM_HEADER) 97 98$(LIBOBJS) : %.o: $(srcdir)/%.c 99 $(CC) -c $(CFLAGS) $< 100 101$(PDCOBJS) : %.o: $(osdir)/%.c 102 $(CC) -c $(CFLAGS) $< 103 104firework.exe newdemo.exe rain.exe testcurs.exe worm.exe xmas.exe \ 105ptest.exe: %.exe: $(demodir)/%.c 106 $(CC) $(CFLAGS) -o$@ $< $(LIBCURSES) 107 108tuidemo.exe: tuidemo.o tui.o 109 $(LINK) $(LDFLAGS) -o$@ tuidemo.o tui.o $(LIBCURSES) 110 111tui.o: $(demodir)/tui.c $(demodir)/tui.h $(PDCURSES_CURSES_H) 112 $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< 113 114tuidemo.o: $(demodir)/tuidemo.c $(PDCURSES_CURSES_H) 115 $(CC) -c $(CFLAGS) -I$(demodir) -o$@ $< 116 117dist: $(PDCLIBS) 118 echo PDCurses $(VERDOT) for Cygnus Win32 > file_id.diz 119 echo ------------------------------------------ >> file_id.diz 120 echo Public Domain Curses library for >> file_id.diz 121 echo Cygnus GCC for Win32. >> file_id.diz 122 echo Source available in PDCURS$(VER).ZIP >> file_id.diz 123 echo Public Domain. >> file_id.diz 124 zip -9jX pdc$(VER)_cyg_w32 \ 125 $(PDCURSES_SRCDIR)/README $(PDCURSES_SRCDIR)/HISTORY \ 126 $(PDCURSES_SRCDIR)/curses.h $(PDCURSES_SRCDIR)/panel.h \ 127 $(LIBCURSES) $(LIBPANEL) file_id.diz 128 rm file_id.diz 129