Allow user to add flags to CFLAGS and LDFLAGS

To build on Mac OS X: `make CFLAGS_ADDTL=-m32 LDFLAGS_ADDTL=-m32`
This commit is contained in:
Mike Meyer 2014-10-20 16:32:53 -04:00
parent 99d38c00a9
commit 1a2cf93965

View File

@ -7,7 +7,7 @@
# Web Site: http://boxes.thomasjensen.com/ # Web Site: http://boxes.thomasjensen.com/
# Platforms: win32 # Platforms: win32
# Purpose: Makefile for boxes, the box drawing program # Purpose: Makefile for boxes, the box drawing program
# #
# License: o This program is free software; you can redistribute it and/or # License: o This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as # modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of # published by the Free Software Foundation; either version 2 of
@ -46,10 +46,10 @@ ALL_FILES = $(ORIG_FILES) $(GEN_FILES) $(OTH_FILES)
build: flags_$(BOXES_PLATFORM) build: flags_$(BOXES_PLATFORM)
$(MAKE) BOXES_PLATFORM=$(BOXES_PLATFORM) ALL_OBJ="$(ALL_OBJ)" CFLAGS_ADDTL=-O STRIP=true flags_$(BOXES_PLATFORM) $(BOXES_EXECUTABLE_NAME) $(MAKE) BOXES_PLATFORM=$(BOXES_PLATFORM) ALL_OBJ="$(ALL_OBJ)" CFLAGS_ADDTL="-O $(CFLAGS_ADDTL)" STRIP=true flags_$(BOXES_PLATFORM) $(BOXES_EXECUTABLE_NAME)
debug: flags_$(BOXES_PLATFORM) debug: flags_$(BOXES_PLATFORM)
$(MAKE) BOXES_PLATFORM=$(BOXES_PLATFORM) ALL_OBJ="$(ALL_OBJ)" CFLAGS_ADDTL=-g STRIP=false flags_$(BOXES_PLATFORM) $(BOXES_EXECUTABLE_NAME) $(MAKE) BOXES_PLATFORM=$(BOXES_PLATFORM) ALL_OBJ="$(ALL_OBJ)" CFLAGS_ADDTL="-g $(CFLAGS_ADDTL)" STRIP=false flags_$(BOXES_PLATFORM) $(BOXES_EXECUTABLE_NAME)
boxes: $(ALL_OBJ) boxes: $(ALL_OBJ)
$(MAKE) -C regexp CC=$(CC) libregexp.a $(MAKE) -C regexp CC=$(CC) libregexp.a
@ -63,7 +63,7 @@ boxes.exe: $(ALL_OBJ)
flags_unix: flags_unix:
$(eval CFLAGS := -ansi -I. -Iregexp -Wall -W $(CFLAGS_ADDTL)) $(eval CFLAGS := -ansi -I. -Iregexp -Wall -W $(CFLAGS_ADDTL))
$(eval LDFLAGS := -Lregexp) $(eval LDFLAGS := -Lregexp $(LDFLAGS_ADDTL))
$(eval BOXES_EXECUTABLE_NAME := boxes) $(eval BOXES_EXECUTABLE_NAME := boxes)
$(eval ALL_OBJ := $(GEN_SRC:.c=.o) $(ORIG_NORM:.c=.o)) $(eval ALL_OBJ := $(GEN_SRC:.c=.o) $(ORIG_NORM:.c=.o))