Skip to content

Commit

Permalink
Unmark real files as .PHONY, avoid unnecessary rebuilds
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Kruse committed Oct 19, 2012
1 parent abf9860 commit 29bf757
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 41 deletions.
Empty file modified GIT-VERSION-GEN
100644 → 100755
Empty file.
24 changes: 2 additions & 22 deletions Makefile.global
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

# refresh Makefile and other stuff

PROGRAMS_WITH_GIT_HASH := hmc_tm invert

.SUFFIXES:

Makefile: ${top_srcdir}/Makefile.global $(srcdir)/Makefile.in $(abs_top_builddir)/config.status
Expand All @@ -15,7 +13,7 @@ $(abs_top_builddir)/config.status: $(top_srcdir)/configure
( cd ${abs_top_builddir} && $(SHELL) ./config.status --recheck )

$(abs_top_builddir)/config.h: $(top_srcdir)/config.h.in $(abs_top_builddir)/config.status $(top_srcdir)/configure
( cd ${abs_top_builddir} && $(SHELL) ./config.status --header=config.h )
( cd ${abs_top_builddir} && $(SHELL) ./config.status --header=config.h && touch config.h )

# rebuild configure if configure.in changes but ignore errors
# on many machines some of the macros fail to be recognized
Expand All @@ -35,26 +33,8 @@ $(LINKLIBS): %.a: Makefile $(abs_top_builddir)/config.status $(top_srcdir)/confi

#dep rules

# PROGRAMS_WITH_GIT_HASH require git_hash.h which is dynamically built by a phony make target
# to prevent too frequent building of git_hash (slowing down the build)
# we filter the list of all objects and treat these separately
$(addsuffix .d, $(filter-out ${PROGRAMS_WITH_GIT_HASH},${ALLOBJ})): %.d: ${srcdir}/%.c Makefile
@ $(CCDEP) ${DEPFLAGS} ${CPPFLAGS} ${INCLUDES} ${DEFS} $< > $@

# dirty hack to prevent make from entering an infinite loop because a phony target is given as a real
# dependency (make will build invert.d and hmc_tm.d indefinitely)
# when git_hash.h does not exist (as checked using wildcard) it is given as a dependency of invert.d and hmc_tm.d
# once it exists, this is no longer the case
# while this does break updating of git_hash.h while the dependencies are built, this is quite
# irrelevant because it will be rebuilt during the compilation of either invert or hmc_tm
ifneq (git_hash.h, $(findstring git_hash.h,$(wildcard $(top_srcdir)/git_has*.h)))
$(addsuffix .d, $(filter ${PROGRAMS_WITH_GIT_HASH},${ALLOBJ})): %.d: ${srcdir}/%.c ${top_srcdir}/git_hash.h Makefile
$(addsuffix .d, ${ALLOBJ}): %.d: ${srcdir}/%.c Makefile
@ $(CCDEP) ${DEPFLAGS} ${CPPFLAGS} ${INCLUDES} ${DEFS} $< > $@
else
$(addsuffix .d, $(filter ${PROGRAMS_WITH_GIT_HASH},${ALLOBJ})): %.d: ${srcdir}/%.c Makefile
@ $(CCDEP) ${DEPFLAGS} ${CPPFLAGS} ${INCLUDES} ${DEFS} $< > $@
endif


${top_builddir}/fixed_volume.h: ${top_srcdir}/fixed_volume.h.in ${top_builddir}/config.status
cd ${abs_top_builddir} && CONFIG_FILES=fixed_volume.h CONFIG_HEADERS= $(SHELL) ${top_builddir}/config.status
Expand Down
18 changes: 10 additions & 8 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ all: Makefile all-recursive dep hmc_tm invert

# run the GIT-VERSION-GEN script to generate version information in git_hash.h
# making sure that we run in the correct directory
${top_srcdir}/git_hash.h:
@cd @srcdir@ && sh GIT-VERSION-GEN
${top_srcdir}/git_hash.h: .git
@echo "Rebuilding git_hash.h"
@sh GIT-VERSION-GEN
@touch git_hash.h

-include $(addsuffix .d,$(ALLOBJ))

Expand Down Expand Up @@ -132,10 +134,10 @@ $(addsuffix .o,$(filter ${NOOPTMOD},${MODULES})): %.o: ${srcdir}/%.c %.d Makefil
${addsuffix .o, ${SMODULES}}: %.o: ${srcdir}/%.c %.d Makefile $(abs_top_builddir)/config.h
${COMPILE} ${SOPTARGS} -c $<

${addsuffix .o, ${PROGRAMS}}: %.o: ${srcdir}/%.c %.d Makefile $(abs_top_builddir)/config.h ${top_srcdir}/git_hash.h
${addsuffix .o, ${PROGRAMS}}: %.o: ${srcdir}/%.c %.d Makefile $(abs_top_builddir)/config.h
${COMPILE} ${OPTARGS} -c $<

${PROGRAMS}: %: %.o libhmc.a all-recursive
${PROGRAMS}: %: %.o libhmc.a
${LINK} $@.o $(GPUOBJECTS) $(GPUOBJECTS_C) $(LIBS)

# The rules for unit tests are kept in a separate file for tidyness
Expand Down Expand Up @@ -171,9 +173,9 @@ distclean: distclean-recursive Makefile
rm -f hmc_tm hybrid *.o *.d *~ Makefile config.log config.status fixed_volume.h
rm -f config.h

.PHONY: all ${top_srcdir}/git_hash.h clean compile-clean distclean dep install \
$(PROGRAMS) all-recursive \
.PHONY: all clean compile-clean distclean dep install \
all-recursive \
all-debug-recursive all-profile-recursive \
clean-recursive distclean-recursive \
compile-clean-recursive $(LINKLIBS) \
tests libhmc.a
compile-clean-recursive \
tests
2 changes: 2 additions & 0 deletions build-bgq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ CFLAGS="${CFLAGS} -g"
#CFLAGS="${CFLAGS} -qsimd=auto"
#CFLAGS="${CFLAGS} -qsmp=noauto"

CPPFLAGS=""
#CFLAGS="${CFLAGS} -DXLC=1"
#CFLAGS="${CFLAGS} -DNDEBUG=1"
#CFLAGS="${CFLAGS} -DBGQ=1"
Expand Down Expand Up @@ -111,6 +112,7 @@ CONFIGURE="${CONFIGURE} CC=/bgsys/drivers/ppcfloor/comm/xl/bin/mpixlc_r"
#CONFIGURE="${CONFIGURE} CC=/bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlc_r"
#CONFIGURE="${CONFIGURE} CCDEP=mpixlc_r"
CONFIGURE="${CONFIGURE} CFLAGS="\"'${CFLAGS}'\"
CONFIGURE="${CONFIGURE} CPPFLAGS="\"'${CPPFLAGS}'\"
CONFIGURE="${CONFIGURE} F77=bgf77"
CONFIGURE="${CONFIGURE} LDFLAGS="\"'${LDFLAGS}'\"
CONFIGURE="${CONFIGURE} FC=bgxlf_r"
Expand Down
23 changes: 12 additions & 11 deletions build-x86.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ LAPACK="${LAPACK} -llapack"
#CFLAGS="-g -O0 -ffast-math -fopenmp -Wall -Wundef -DBGQ=1 -DBGQ_QPX=0 -DBGQ_FIELD_COORDCHECK=0 -I/usr/lib/gcc/x86_64-linux-gnu/4.6/include -I/usr/include/openmpi -DBGQ_PREFETCH_EXPLICIT=0 -DBGQ_PREFETCH_STREAM=0 -DBGQ_PREFETCH_LIST=0 -DMPI=1 -DBGQ_HM_CARRY=1 -DBGQ_REPLACE=0"
CFLAGS=""
#CFLAGS="${CFLAGS} -I/usr/lib/gcc/x86_64-linux-gnu/4.6/include"
CFLAGS="${CFLAGS} -I/usr/include/openmpi"
CFLAGS="${CFLAGS} -I/usr/include/openmpi"
CFLAGS="${CFLAGS} -O0"
CFLAGS="${CFLAGS} -g"
CFLAGS="${CFLAGS} -ffast-math"
Expand All @@ -26,20 +24,22 @@ CFLAGS="${CFLAGS} -Wall"
CFLAGS="${CFLAGS} -Wundef"


CPPFLAGS=""
CPPFLAGS="${CPPFLAGS} -I/usr/include/openmpi"
#CFLAGS="${CFLAGS} -DBGQ=1"
#CFLAGS="${CFLAGS} -DXLC=1"
#CFLAGS="${CFLAGS} -DNDEBUG=1"
#CFLAGS="${CFLAGS} -DBGQ_HM_NOKAMUL=1"
CFLAGS="${CFLAGS} -DBGQ_QPX=0"
CFLAGS="${CFLAGS} -DBGQ_PREFETCH_EXPLICIT=0"
CFLAGS="${CFLAGS} -DBGQ_PREFETCH_STREAM=0"
CFLAGS="${CFLAGS} -DBGQ_PREFETCH_LIST=0"
CFLAGS="${CFLAGS} -DBGQ_FIELD_COORDCHECK=0"
CFLAGS="${CFLAGS} -DMPI=1"
CPPFLAGS="${CPPFLAGS} -DBGQ_QPX=0"
CPPFLAGS="${CPPFLAGS} -DBGQ_PREFETCH_EXPLICIT=0"
CPPFLAGS="${CPPFLAGS} -DBGQ_PREFETCH_STREAM=0"
CPPFLAGS="${CPPFLAGS} -DBGQ_PREFETCH_LIST=0"
CPPFLAGS="${CPPFLAGS} -DBGQ_FIELD_COORDCHECK=0"
CPPFLAGS="${CPPFLAGS} -DMPI=1"
#CFLAGS="${CFLAGS} -DXLC=1"
CFLAGS="${CFLAGS} -DBGQ_HM_CARRY=1"
CFLAGS="${CFLAGS} -DBGQ_REPLACE=0"
CFLAGS="${CFLAGS} -DPAPI=0"
CPPFLAGS="${CPPFLAGS} -DBGQ_HM_CARRY=1"
CPPFLAGS="${CPPFLAGS} -DBGQ_REPLACE=0"
CPPFLAGS="${CPPFLAGS} -DPAPI=0"


#LDFLAGS="-lgomp -lblas"
Expand All @@ -64,6 +64,7 @@ CONFIGURE="${CONFIGURE} --enable-largefile"
CONFIGURE="${CONFIGURE} --with-lapack="\"'${LAPACK}'\"
CONFIGURE="${CONFIGURE} CC=mpicc"
CONFIGURE="${CONFIGURE} CFLAGS="\"'${CFLAGS}'\"
CONFIGURE="${CONFIGURE} CPPFLAGS="\"'${CPPFLAGS}'\"
#CONFIGURE="${CONFIGURE} F77=bgf77"
CONFIGURE="${CONFIGURE} LDFLAGS="\"'${LDFLAGS}'\"
#CONFIGURE="${CONFIGURE} FC=bgxlf_r"
Expand Down

0 comments on commit 29bf757

Please sign in to comment.