# this is written to work with the cygwin tools # it looks for a windows application by finding "windows.h" # near the beginning of a file. CPP = g++ CC = gcc CFLAGS = -Wall -O2 -s # the winmm library is for sound #LIBS = -lm -lwinmm LIbs = -lwinmm WINDOWFLAGS = -mwindows -mno-cygwin -e _mainCRTStartup #WINDOWFLAGS = -mwindows -e _mainCRTStartup SOURCES := $(wildcard *.cc) CSOURCES := $(wildcard *.c) EXECUTABLES := $(addsuffix .exe, $(basename $(SOURCES))) CEXECUTABLES := $(addsuffix .exe, $(basename $(CSOURCES))) all : $(EXECUTABLES) $(CEXECUTABLES) clean : rm -f *.o touch $(SOURCES) $(CSOURCES) # is this a c program %.exe : %.c $(CC) $(CFLAGS) $< $(LIBS) -o $@ ;\ # or a c++ program %.exe : %.cc # is it a windows application? if head -50 $< | grep "windows.h" ; then \ $(CPP) $(WINDOWFLAGS) $(CFLAGS) $< $(LIBS) -o $@ ;\ else \ $(CPP) $(CFLAGS) $< $(LIBS) -o $@ ;\ fi