projects
/
censuslogo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
windows build
[censuslogo]
/
Makefile
diff --git
a/Makefile
b/Makefile
index
a1dc85b
..
ffa81be
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-3,8
+3,18
@@
obj = $(src:.c=.o)
dep = $(obj:.o=.d)
bin = censuslogo
dep = $(obj:.o=.d)
bin = censuslogo
+sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/')
+
CFLAGS = -pedantic -Wall -g
CFLAGS = -pedantic -Wall -g
-LDFLAGS = -lGL -lGLU -lglut -lm
+LDFLAGS = $(LDFLAGS_$(sys)) -lm
+
+LDFLAGS_Linux = -lGL -lGLU -lglut
+LDFLAGS_mingw = -lmingw32 -mconsole -lopengl32 -lglu32 -lfreeglut
+
+ifeq ($(sys), mingw)
+ obj = $(src:.c=.w32.o)
+ bin = censuslogo.exe
+endif
$(bin): $(obj)
$(CC) -o $@ $(obj) $(LDFLAGS)
$(bin): $(obj)
$(CC) -o $@ $(obj) $(LDFLAGS)
@@
-21,3
+31,15
@@
clean:
.PHONY: cleandep
cleandep:
rm -f $(dep)
.PHONY: cleandep
cleandep:
rm -f $(dep)
+
+# --- cross-compile rules for win32 ---
+%.w32.o: %.c
+ $(CC) -o $@ $(CFLAGS) -c $<
+
+.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