rayfract
view 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 source
1 csrc = $(wildcard src/*.c) $(wildcard src/imtk/*.c) $(wildcard src/glew/*.c)
2 ccsrc = $(wildcard src/*.cc)
3 obj = $(ccsrc:.cc=.o) $(csrc:.c=.o)
4 dep = $(ccsrc:.cc=.d) $(csrc:.c=.d)
5 bin = rayfract
7 sys := $(shell uname -s | sed 's/MINGW.*/mingw/')
8 ifeq ($(sys), mingw)
9 bin = rayfract.exe
10 libgl = -lopengl32 -lglu32 -lfreeglut
11 obj = $(ccsrc:.cc=.w32.o) $(csrc:.c=.w32.o)
12 else ifeq ($(sys), Darwin)
13 libgl = -framework OpenGL -framework GLUT
14 else
15 libgl = -lGL -lGLU -lglut
16 endif
18 CFLAGS = -pedantic -Wall -g -Isrc/glew -I/usr/local/include -DGLEW_STATIC -MMD
19 CXXFLAGS = -pedantic -Wall -g -Isrc/glew -I/usr/local/include -DGLEW_STATIC -MMD
20 LDFLAGS = -L/usr/local/lib $(libgl)
22 $(bin): $(obj)
23 $(CXX) -o $@ $(obj) $(LDFLAGS)
25 -include $(dep)
27 %.w32.o: %.c
28 $(CC) -o $@ $(CFLAGS) -c $<
30 %.w32.o: %.cc
31 $(CXX) -o $@ $(CXXFLAGS) -c $<
33 .PHONY: clean
34 clean:
35 rm -f $(obj) $(bin)
37 .PHONY: cleandep
38 cleandep:
39 rm -f $(dep)
41 .PHONY: win
42 win:
43 $(MAKE) sys=mingw CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++
45 .PHONY: clean-win
46 clean-win:
47 $(MAKE) sys=mingw CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ clean
49 .PHONY: cleandep-win
50 cleandep-win:
51 $(MAKE) sys=mingw CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ cleandep