# # Makefile for Windows systems using gmake # # # Try "make" to do a default build, using cygwin. # # Try "make CONSOLE=yes" to use PDCurses, as long as you set # PDCURSES_INCLUDE_DIR and PDCURSES_LIB. # # Other options: # OBJ_DIR=x will place .o files into directory 'x' # MINGW=yes will use the mingw compiler # # Include list of object files and add system-specific ones include Makefile.inc # Executable name and default target include Makefile.src PROGNAME = sil EXE = $(PROGNAME).exe all: ../$(EXE) ifneq (,$(findstring \SYSTEM32,$(PATH))) dos = TRUE endif ifneq (,$(findstring \system32,$(PATH))) dos = TRUE endif ifdef dos CP = copy RM = del BAR = "\" else CP = -cp RM = -rm BAR = "/" endif ifndef MINGW CYGWIN=yes endif MAINFILES="$(WINMAINFILES)" ifdef CONSOLE CFLAGS = -DUSE_GCU -DWIN32_CONSOLE_MODE -I$(PDCURSES_INC) LIBS = -s $(PDCURSES_LIB) IOBJS = $(BASEOBJS) main-gcu.o main.o #PDCURSES_INC = ../../pdcurses/include #PDCURSES_LIB = ../../pdcurses/lib/pdcurses.a else CFLAGS = -DWINDOWS -static CFLAGS += -Iwin/include -Lwin/lib LDFLAGS += -Lwin/lib IOBJS = $(BASEOBJS) $(PROGNAME).res $(SOUNDFILES) main-win.o win/readdib.o win/readpng.o win/scrnshot.o win/win-layout.o LIBS = -mwindows -lwinmm -lzlib -llibpng -lmsimg32 endif CC = $(CROSS)gcc WRES = $(CROSS)windres WARNINGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers CFLAGS += $(WARNINGS) -std=c99 -DUSE_PRIVATE_PATHS -DSOUND -g -I. ifdef BUILD_ID CFLAGS += -DBUILD_ID="$(BUILD_ID)" endif ifdef CYGWIN LIBS += -mno-cygwin -e _mainCRTStartup CFLAGS += -mno-cygwin # Note the additional -DNEAR= flag to cope with the 'NEAR' # keyword used in readdib.c win/readdib.o: win/readdib.c win/readdib.h $(CC) $(CFLAGS) -DNEAR= $(INCDIRS) -c -o $@ $< win/readpng.o: win/readpng.c win/readdib.h $(CC) $(CFLAGS) -DNEAR= $(INCDIRS) -c -o $@ $< endif # Handle cross compiles ifdef CROSS CFLAGS += -DCROSS_COMPILE ifdef MINGW # This is an issue on mingw32 on linux CFLAGS += -D_stdcall= endif endif # Handle object output in a different directory ifdef OBJDIR OBJS = $(patsubst %.o, $(OBJDIR)%.o, $(IOBJS)) mkdirs:; -mkdir -p $(OBJDIR) $(OBJDIR)win $(EXE): mkdirs else OBJS = $(IOBJS) endif # # Targets # ../$(EXE): $(EXE) $(CP) $(EXE) .. $(CP) win$(BAR)dll$(BAR)libpng12.dll .. $(CP) win$(BAR)dll$(BAR)zlib1.dll .. $(EXE): $(OBJS) $(CC) $(CFLAGS) -o $(EXE) $(OBJS) $(LIBS) clean: $(RM) -f $(EXE) $(OBJS) $(RM) -f libpng12.dll $(RM) -f zlib1.dll # # Rules # win/$(PROGNAME).res: win/$(PROGNAME).rc $(WRES) $< -O coff -o $@ $(OBJDIR)%.o: %.c $(INCS) $(CC) $(CFLAGS) -c -o $@ $<