projects
/
miniglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
more msvc trash in .gitignore
[miniglut]
/
Makefile
diff --git
a/Makefile
b/Makefile
index
655a7d3
..
accf05a
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-3,11
+3,31
@@
obj = $(src:.c=.o)
bin = test
CFLAGS = -pedantic -Wall -g
bin = test
CFLAGS = -pedantic -Wall -g
-LDFLAGS = -lX11 -lGL -lm
+
+sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/')
+ifeq ($(sys), mingw)
+ obj = $(src:.c=.w32.o)
+ bin = test.exe
+
+ LDFLAGS = -mconsole -lopengl32 -lgdi32 -lwinmm
+else
+ LDFLAGS = -lX11 -lGL
+endif
$(bin): $(obj)
$(CC) -o $@ $(obj) $(LDFLAGS)
$(bin): $(obj)
$(CC) -o $@ $(obj) $(LDFLAGS)
+%.w32.o: %.c
+ $(CC) -o $@ $(CFLAGS) -c $<
+
.PHONY: clean
clean:
rm -f $(obj) $(bin)
.PHONY: clean
clean:
rm -f $(obj) $(bin)
+
+.PHONY: cross
+cross:
+ $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw
+
+.PHONY: cross-clean
+cross-clean:
+ $(MAKE) CC=i686-w64-mingw32-gcc sys=mingw clean