Commit 4e5ac0b8 authored by Jim Nelson's avatar Jim Nelson

#464: Makefile no longer broken for incremental builds (hard-tab empty command...

#464: Makefile no longer broken for incremental builds (hard-tab empty command fix).  #451: --debug | --release 
in ./configure.  #452: Release build is default (-g -O2).
parent 91fdd120
......@@ -9,23 +9,15 @@ INSTALL_PROGRAM = install
INSTALL_DATA = install -m 644
VALAFLAGS = -g --enable-checking
ifdef dev
DEVFLAGS = --save-temps -X -O0
endif
# C99 takes care of a warning message generated by the use of Math.round in image_util.vala
ALL_VALAFLAGS = $(VALAFLAGS) $(DEVFLAGS) --Xcc=-std=c99
# defaults that may be overridden by configure.mk
PREFIX=/usr/local
BUILD_RELEASE=1
-include configure.mk
DEFINES=_PREFIX='"$(PREFIX)"' _VERSION='"$(VERSION)"'
CFLAGS += -c -g `pkg-config --cflags $(EXT_PKGS)` $(foreach hdir,$(HEADER_DIRS),-I$(hdir)) \
$(foreach def,$(DEFINES),-D$(def))
LDFLAGS += `pkg-config --libs $(EXT_PKGS)`
SRC_FILES = \
main.vala \
AppWindow.vala \
......@@ -132,6 +124,20 @@ DIST_TAR_BZ2 = $(DIST_TAR).bz2
DIST_TAR_GZ = $(DIST_TAR).gz
PACKAGE_ORIG_GZ = $(PROGRAM)_$(VERSION).orig.tar.gz
VALA_CFLAGS = `pkg-config --cflags $(EXT_PKGS)` $(foreach hdir,$(HEADER_DIRS),-I$(hdir)) \
$(foreach def,$(DEFINES),-D$(def))
VALA_LDFLAGS = `pkg-config --libs $(EXT_PKGS)`
# setting CFLAGS in configure.mk overrides build type
ifndef CFLAGS
ifdef BUILD_DEBUG
CFLAGS = -g -O0
else
CFLAGS = -g -O2
endif
endif
all: $(PROGRAM)
clean:
......@@ -184,7 +190,7 @@ uninstall:
-update-desktop-database
$(VALA_STAMP): $(EXPANDED_SRC_FILES) $(EXPANDED_VAPI_FILES) $(EXPANDED_SRC_HEADER_FILES) Makefile \
configure $(CONFIG_IN)
$(CONFIG_IN)
@ bash -c "[ '`valac --version`' '>' 'Vala $(MIN_VALAC_VERSION)' ]" || bash -c "[ '`valac --version`' '==' 'Vala $(MIN_VALAC_VERSION)' ]" || ( echo 'Shotwell requires Vala compiler $(MIN_VALAC_VERSION) or greater. You are running' `valac --version` '\b.'; exit 1 )
ifndef ASSUME_PKGS
ifdef EXT_PKG_VERSIONS
......@@ -194,17 +200,22 @@ else ifdef EXT_PKGS
endif
endif
mkdir -p $(BUILD_DIR)
$(VALAC) --ccode --directory=$(BUILD_DIR) --basedir=src $(ALL_VALAFLAGS) \
$(VALAC) --ccode --directory=$(BUILD_DIR) --basedir=src $(VALAFLAGS) \
$(foreach pkg,$(PKGS),--pkg=$(pkg)) \
$(foreach vapidir,$(VAPI_DIRS),--vapidir=$(vapidir)) \
$(foreach def,$(DEFINES),-X -D$(def)) \
$(foreach hdir,$(HEADER_DIRS),-X -I$(hdir)) \
$(EXPANDED_SRC_FILES)
touch $(VALA_STAMP)
touch $@
$(EXPANDED_C_FILES): $(VALA_STAMP) $(EXPANDED_SRC_FILES)
# Do not remove hard tab or at symbol; necessary for dependencies to complete. (Possible make
# bug.)
$(EXPANDED_C_FILES): $(VALA_STAMP)
@
.SECONDARY: $(EXPANDED_OBJ_FILES)
$(EXPANDED_OBJ_FILES): %.o: %.c $(CONFIG_IN)
$(CC) -c $(VALA_CFLAGS) $(CFLAGS) -o $@ $<
$(PROGRAM): $(EXPANDED_OBJ_FILES)
gcc $(LDFLAGS) $(EXPANDED_OBJ_FILES) -o $@
$(CC) $(VALA_LDFLAGS) $(EXPANDED_OBJ_FILES) $(CFLAGS) -o $@
......@@ -15,6 +15,8 @@ configure_help() {
printf "\t-h, --help\t\tPrint this help and exit.\n"
printf "\t--assume-pkgs\t\tTurn off package version checking.\n"
printf "\t--build=DIR\t\tBuild secondary files in DIR.\n"
printf "\t--debug | --release\tBuild executable for debugging or release.\n"
printf "\t\t\t\t[--release]\n"
printf "\t--prefix=PREFIX\t\tPrepend PREFIX to program installation paths.\n"
printf "\t\t\t\t[/usr/local]\n"
printf "\n"
......@@ -57,8 +59,19 @@ do
variables="${variables}BUILD_DIR=$value\n"
;;
--debug) variables="${variables}BUILD_RELEASE=\nBUILD_DEBUG=1\n"
;;
--release) variables="${variables}BUILD_DEBUG=\nBUILD_RELEASE=1\n"
;;
*) abort $1
*) if [ ! $value ]
then
abort $1
fi
variables="${variables}${option}=${value}\n"
;;
esac
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment