X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=Makefile;h=accf05afa8994ecc471d237630c2d7cb15640798;hb=6e1c9e41d8585276e366ada3cab3fb8c1595052c;hp=79c0895b549d9452304187e3572bf69fa31dd7d4;hpb=ea1f048408daa719d70e78dd88f7ff12f03ac902;p=miniglut diff --git a/Makefile b/Makefile index 79c0895..accf05a 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,32 @@ src = miniglut.c test.c obj = $(src:.c=.o) bin = test -CFLAGS = -pedantic -Wall -g -DMINIGLUT_USE_LIBC -LDFLAGS = -lX11 -lGL -lm +CFLAGS = -pedantic -Wall -g + +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) +%.w32.o: %.c + $(CC) -o $@ $(CFLAGS) -c $< + .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