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