# # Makefile # # Copyright (C) 2004 Koji Nakamaru # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # TARGET=fv SRCS=\ CApp.c \ common.c \ error.c \ CAppFV.c \ CFile.c \ CReader.c \ CReaderHDR.c \ CReaderPFM.c \ CImage.c \ OBJS=$(SRCS:.c=.o) OPTIMIZER=release CC=g++ ifeq ("$(OPTIMIZER)", "release") OPT=\ -Wall -O3 -march=i686 \ -fomit-frame-pointer -finline-functions -fstrength-reduce \ -falign-loops=2 -falign-jumps=2 -falign-functions=2 \ -DNDEBUG else OPT=\ -Wall -g endif ifeq ("$(shell uname)", "CYGWIN_NT-5.1") CFLAGS=\ $(OPT) -mno-cygwin -mwindows -Imingw/inc LDFLAGS=\ -Lmingw/lib -lpng -lz -lbz2 -lpthreadGC2 \ -lglut32 -lglu32 -lopengl32 -lwinmm else ifeq ("$(shell uname)", "Darwin") CFLAGS=\ $(OPT) -I/opt/local/include LDFLAGS=\ -framework OpenGL -framework GLUT -framework Foundation \ -L/opt/local/lib -lpng -lz -lbz2 -lpthread \ -lm else CFLAGS=\ $(OPT) LDFLAGS=\ -lpng -lz -lbz2 -lpthread \ -lglut -lGLU -lGL -L/usr/X11R6/lib -lXi -lXmu -lX11 -lXext -lSM \ -lm endif endif ifeq ("$(shell uname)", "CYGWIN_NT-5.1") $(TARGET): $(OBJS) windres -i resource.rc -o resource.o $(CC) $(CFLAGS) -o $@ $(OBJS) resource.o $(LDFLAGS) else $(TARGET): $(OBJS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) endif allclean: clean rm -f $(TARGET) $(TARGET).exe rm -rf .deps clean: rm -f *.o core *~ archive: allclean $(TARGET) version=`grep '#define k_version' CAppFV.c | sed -e 's/#define k_version *"//' -e 's/"//'`; \ name=fv-src-$$version; \ mkdir $$name; \ cp AUTHORS COPYING ChangeLog INSTALL NEWS README $$name; \ cp -r Makefile *.[ch] $$name; \ cp resource.ico resource.rc resource.xpm $$name; \ rm -f $$name.zip; \ zip -qr9 $$name.zip $$name; \ rm -rf $$name; \ name=$$name-win32; \ mkdir $$name; \ cp AUTHORS COPYING ChangeLog INSTALL NEWS README $$name; \ cp -r Makefile *.[ch] $$name; \ cp resource.ico resource.rc resource.xpm $$name; \ mkdir $$name/mingw; \ cp -r mingw/inc mingw/lib $$name/mingw; \ rm -f $$name.zip; \ zip -qr9 $$name.zip $$name; \ rm -rf $$name; \ name=fv-bin-$$version-win32; \ mkdir $$name ; \ cp fv.exe pthreadGC2.dll README $$name; \ rm -f $$name.zip; \ zip -qr9 $$name.zip $$name; \ rm -rf $$name ifneq ($(MAKECMDGOALS),allclean) include $(SRCS:%.c=.deps/%.c) endif .deps/%.c: %.c @mkdir -p .deps @$(CC) -MM $(CFLAGS) $< > $@.$$$$; \ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$