Skip to content

Commit 3f2d621

Browse files
committed
Added a couple of flags to makefiles to fully enable compilation in 32-bit mode on 64-bit OS, using 'EXTRA_FLAGS=-m32'. It was tested on 64-bit Windows 7, set up according to http://code.google.com/p/a-dda/wiki/InstallingMinGW#Multilib_configuration_on_Windows
Also added removing of *.d.* files (produced when build is aborted) to clean commands.
1 parent bf6ae18 commit 3f2d621

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ VALID_OPTS := DEBUG DEBUGFULL FFT_TEMPERTON PRECISE_TIMING NOT_USE_LOCK ONLY_LOC
138138
# in later versions of CUDA and/or icc.
139139
COMPILER := gnu
140140

141-
# Additional options for compiler. For instance, one may use -m32 to force 32 bit compilation in 64
142-
# bit environment. Flags specified below are appended to the ones specified in the environment or
143-
# command line of make (see explanation above for OPTIONS). The same value is used for all
144-
# programming languages to be compiled.
141+
# Additional options for compiler. Flags specified below are appended to the ones specified in the
142+
# environment or command line of make (see explanation above for OPTIONS). The same value is used
143+
# for all programming languages to be compiled and for linker.
144+
# In particular, "-m32" may be used to force 32 bit compilation in 64 bit environment. However, it
145+
# also requires proper libraries (especially, external ones, like FFTW3 or MPI) to be supplied.
145146
override EXTRA_FLAGS +=
146147

147148
# --FFTW3 paths--
@@ -274,6 +275,7 @@ ifneq ($(strip $(EXTRA_FLAGS)),)
274275
CFLAGS += $(EXTRA_FLAGS)
275276
FFLAGS += $(EXTRA_FLAGS)
276277
CPPFLAGS += $(EXTRA_FLAGS)
278+
LDFLAGS += $(EXTRA_FLAGS)
277279
endif
278280

279281
# By default Fortran anc C++ optimization options are the same as C, but specific options can be
@@ -425,12 +427,12 @@ clean: cleanseq cleanmpi cleanocl
425427
# compilation and thus contain quite heavy processing.
426428
cleanseq:
427429
@echo "Removing sequential compiled files"
428-
cd $(SEQ) && rm -f *.o *.d $(OPTSFILES) $(PROGSEQ) $(PROGSEQ).exe
430+
cd $(SEQ) && rm -f *.o *.d *.d.* $(OPTSFILES) $(PROGSEQ) $(PROGSEQ).exe
429431

430432
cleanmpi:
431433
@echo "Removing MPI compiled files"
432-
cd $(MPI) && rm -f *.o *.d $(OPTSFILES) $(PROGMPI) $(PROGMPI).exe
434+
cd $(MPI) && rm -f *.o *.d *.d.* $(OPTSFILES) $(PROGMPI) $(PROGMPI).exe
433435

434436
cleanocl:
435437
@echo "Removing OpenCL compiled files"
436-
cd $(OCL) && rm -f *.o *.d $(OPTSFILES) $(PROGOCL) $(PROGOCL).exe *.clstr
438+
cd $(OCL) && rm -f *.o *.d *.d.* $(OPTSFILES) $(PROGOCL) $(PROGOCL).exe *.clstr

src/ocl/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ else
5555
CLSOURCE := oclkernels.cl
5656
endif
5757

58+
# This fix is to disable linker warnings when linking against 32-bit OpenCL.dll on 64-bit Windows.
59+
# The issue appeared with Nvidia library supplied with driver 301.42
60+
ifneq ($(filter -m32,$(LDFLAGS)),)
61+
LDFLAGS += -Wl,--enable-stdcall-fixup
62+
endif
63+
5864
# This is a weird prefix, which is required since that is how .clstr files are quoted in .d files
5965
CLSPREFIX := ../$(OCL)/
6066
CLSTRING := $(CLSOURCE:.cl=.clstr)

0 commit comments

Comments
 (0)