aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2015-09-17 08:14:32 +0300
committerOskari Timperi <oskari.timperi@iki.fi>2015-09-17 08:14:32 +0300
commit3b2ca90ec55bc2985ebf3e2888703160b6095402 (patch)
tree69f4233c4a7e453c3d95f3bb0d192a737bf81c5b
parent396a8ad5b3291776d455a10ebb4951904dbe01bd (diff)
downloaddiceware-3b2ca90ec55bc2985ebf3e2888703160b6095402.tar.gz
diceware-3b2ca90ec55bc2985ebf3e2888703160b6095402.zip
A couple of changes to Makefile
- include HOST in object filenames - remove -g from CFLAGS - fix CC/LD variables when HOST is empty
-rw-r--r--Makefile16
1 files 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 $@ $^