X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=censuslogo;a=blobdiff_plain;f=Makefile;h=f27fe8553960aaf4b8db45992ff0a7751fdbdccf;hp=a1dc85bec22ccf2a8c2057a564c395d7e1ad1467;hb=ba970dd01d42881977bcb41a346d82910f6cda5f;hpb=fc0cfd2c7c9f5efddddb21fc94a15cc42685ca1d diff --git a/Makefile b/Makefile index a1dc85b..f27fe85 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,19 @@ obj = $(src:.c=.o) dep = $(obj:.o=.d) bin = censuslogo -CFLAGS = -pedantic -Wall -g -LDFLAGS = -lGL -lGLU -lglut -lm +sys ?= $(shell uname -s | sed 's/MINGW.*/mingw/') + +CFLAGS = -pedantic -Wall -g -DNOLOAD +LDFLAGS = $(LDFLAGS_$(sys)) -lm + +LDFLAGS_Linux = -lGL -lGLU -lglut +LDFLAGS_mingw = -lmingw32 -mconsole -lfreeglut_static -lopengl32 -lglu32 -lgdi32 -lwinmm + +ifeq ($(sys), mingw) + obj = $(src:.c=.w32.o) + bin = censuslogo.exe + CFLAGS += -DFREEGLUT_STATIC +endif $(bin): $(obj) $(CC) -o $@ $(obj) $(LDFLAGS) @@ -21,3 +32,15 @@ clean: .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