From 3b2ca90ec55bc2985ebf3e2888703160b6095402 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Thu, 17 Sep 2015 08:14:32 +0300 Subject: A couple of changes to Makefile - include HOST in object filenames - remove -g from CFLAGS - fix CC/LD variables when HOST is empty --- Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 89431e5..db526eb 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,15 @@ # Specify HOST to cross compile # HOST = i686-w64-mingw32 -CC = $(HOST)-gcc -LD = $(HOST)-gcc +CC = gcc +LD = gcc -CFLAGS += -std=c99 -Wall -g +CFLAGS += -std=c99 -Wall -Wextra + +ifneq ($(HOST),) +CC := $(HOST)-$(CC) +LD := $(HOST)-$(LD) +endif SOURCES = main.c htable.c @@ -24,7 +29,10 @@ E = SOURCES += randgen_unix.c endif -OBJECTS = $(SOURCES:%.c=%.o) +OBJECTS = $(addprefix $(HOST)_,$(SOURCES:%.c=%.o)) + +$(HOST)_%.o: %.c + $(COMPILE.c) -o $@ $< diceware$(E): $(OBJECTS) $(LINK.c) -o $@ $^ -- cgit v1.2.3