rayfract
diff Makefile @ 10:1496aae2e7d4
- simplified build by including dependences in the source tree
- added make dep tracking
- added mingw cross-build rules
- added readme & licence
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 31 Jul 2023 18:58:56 +0300 |
parents | c27b24c9fdd2 |
children |
line diff
1.1 --- a/Makefile Thu Nov 03 13:41:33 2011 +0200 1.2 +++ b/Makefile Mon Jul 31 18:58:56 2023 +0300 1.3 @@ -1,23 +1,51 @@ 1.4 -csrc = $(wildcard src/*.c) 1.5 +csrc = $(wildcard src/*.c) $(wildcard src/imtk/*.c) $(wildcard src/glew/*.c) 1.6 ccsrc = $(wildcard src/*.cc) 1.7 obj = $(ccsrc:.cc=.o) $(csrc:.c=.o) 1.8 +dep = $(ccsrc:.cc=.d) $(csrc:.c=.d) 1.9 bin = rayfract 1.10 1.11 -ifeq ($(shell uname -s), Darwin) 1.12 - libgl = -framework OpenGL -framework GLUT -lGLEW 1.13 +sys := $(shell uname -s | sed 's/MINGW.*/mingw/') 1.14 +ifeq ($(sys), mingw) 1.15 + bin = rayfract.exe 1.16 + libgl = -lopengl32 -lglu32 -lfreeglut 1.17 + obj = $(ccsrc:.cc=.w32.o) $(csrc:.c=.w32.o) 1.18 +else ifeq ($(sys), Darwin) 1.19 + libgl = -framework OpenGL -framework GLUT 1.20 else 1.21 - libgl = -lGL -lGLU -lglut -lGLEW 1.22 + libgl = -lGL -lGLU -lglut 1.23 endif 1.24 1.25 -CC = gcc 1.26 -CXX = g++ 1.27 -CFLAGS = -pedantic -Wall -g -I/usr/local/include `pkg-config --cflags vmath` 1.28 -CXXFLAGS = -pedantic -Wall -g -I/usr/local/include `pkg-config --cflags vmath` 1.29 -LDFLAGS = -L/usr/local/lib $(libgl) `pkg-config --libs vmath` -limtk 1.30 +CFLAGS = -pedantic -Wall -g -Isrc/glew -I/usr/local/include -DGLEW_STATIC -MMD 1.31 +CXXFLAGS = -pedantic -Wall -g -Isrc/glew -I/usr/local/include -DGLEW_STATIC -MMD 1.32 +LDFLAGS = -L/usr/local/lib $(libgl) 1.33 1.34 $(bin): $(obj) 1.35 $(CXX) -o $@ $(obj) $(LDFLAGS) 1.36 1.37 +-include $(dep) 1.38 + 1.39 +%.w32.o: %.c 1.40 + $(CC) -o $@ $(CFLAGS) -c $< 1.41 + 1.42 +%.w32.o: %.cc 1.43 + $(CXX) -o $@ $(CXXFLAGS) -c $< 1.44 + 1.45 .PHONY: clean 1.46 clean: 1.47 rm -f $(obj) $(bin) 1.48 + 1.49 +.PHONY: cleandep 1.50 +cleandep: 1.51 + rm -f $(dep) 1.52 + 1.53 +.PHONY: win 1.54 +win: 1.55 + $(MAKE) sys=mingw CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ 1.56 + 1.57 +.PHONY: clean-win 1.58 +clean-win: 1.59 + $(MAKE) sys=mingw CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ clean 1.60 + 1.61 +.PHONY: cleandep-win 1.62 +cleandep-win: 1.63 + $(MAKE) sys=mingw CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ cleandep