Skip to content

Commit

Permalink
Use common variable for parameters in Makefile
Browse files Browse the repository at this point in the history
By storing the whole string of parameters into one variable inside the
Makefile, maintenance of the Makefile is eased and users can insert
arbitrary custom parameters to the compiler.
  • Loading branch information
Brian "DragonLord" Wong authored and Brian "DragonLord" Wong committed Dec 28, 2014
1 parent 85354cb commit cde7354
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
all: int16 int32 int64 short double longdouble

# Variables
ADVANCE = 1.2589
NSAMP = 5000
NTRIAL = 5
PATIENCE = 10
RUNTM = 0.5
STOPRT = 0.15
STOPTM = 60
ADVANCE = 1.2589
NSAMP = 5000
NTRIAL = 5
PATIENCE = 10
RUNTM = 0.5
STOPRT = 0.15
STOPTM = 60

PARAMETERS = -DADVANCE=$(ADVANCE) -DNSAMP=$(NSAMP) -DNTRIAL=$(NTRIAL) -DPATIENCE=$(PATIENCE) -DRUNTM=$(RUNTM) -DSTOPRT=$(STOPRT) -DSTOPTM=$(STOPTM)

int16:
gcc -O1 -funroll-loops -march=native -DDSIZE=int16_t -DISIZE=uint64_t -DADVANCE=$(ADVANCE) -DNSAMP=$(NSAMP) -DNTRIAL=$(NTRIAL) -DPATIENCE=$(PATIENCE) -DRUNTM=$(RUNTM) -DSTOPRT=$(STOPRT) -DSTOPTM=$(STOPTM) -o hi64-int16 hi64.c hkernel.c
gcc -O1 -funroll-loops -march=native -DDSIZE=int16_t -DISIZE=uint64_t $(PARAMETERS) -o hi64-int16 hi64.c hkernel.c
int32:
gcc -O1 -funroll-loops -march=native -DDSIZE=int32_t -DISIZE=uint64_t -DADVANCE=$(ADVANCE) -DNSAMP=$(NSAMP) -DNTRIAL=$(NTRIAL) -DPATIENCE=$(PATIENCE) -DRUNTM=$(RUNTM) -DSTOPRT=$(STOPRT) -DSTOPTM=$(STOPTM) -o hi64-int32 hi64.c hkernel.c
gcc -O1 -funroll-loops -march=native -DDSIZE=int32_t -DISIZE=uint64_t $(PARAMETERS) -o hi64-int32 hi64.c hkernel.c
int64:
gcc -O1 -funroll-loops -march=native -DDSIZE=int64_t -DISIZE=uint64_t -DADVANCE=$(ADVANCE) -DNSAMP=$(NSAMP) -DNTRIAL=$(NTRIAL) -DPATIENCE=$(PATIENCE) -DRUNTM=$(RUNTM) -DSTOPRT=$(STOPRT) -DSTOPTM=$(STOPTM) -o hi64-int64 hi64.c hkernel.c
gcc -O1 -funroll-loops -march=native -DDSIZE=int64_t -DISIZE=uint64_t $(PARAMETERS) -o hi64-int64 hi64.c hkernel.c
short:
gcc -O1 -funroll-loops -march=native -DDSIZE=short -DISIZE=uint64_t -DADVANCE=$(ADVANCE) -DNSAMP=$(NSAMP) -DNTRIAL=$(NTRIAL) -DPATIENCE=$(PATIENCE) -DRUNTM=$(RUNTM) -DSTOPRT=$(STOPRT) -DSTOPTM=$(STOPTM) -o hi64-short hi64.c hkernel.c
gcc -O1 -funroll-loops -march=native -DDSIZE=short -DISIZE=uint64_t $(PARAMETERS) -o hi64-short hi64.c hkernel.c
double:
gcc -O1 -funroll-loops -march=native -DDSIZE=double -DISIZE=uint64_t -DADVANCE=$(ADVANCE) -DNSAMP=$(NSAMP) -DNTRIAL=$(NTRIAL) -DPATIENCE=$(PATIENCE) -DRUNTM=$(RUNTM) -DSTOPRT=$(STOPRT) -DSTOPTM=$(STOPTM) -o hi64-double hi64.c hkernel.c
gcc -O1 -funroll-loops -march=native -DDSIZE=double -DISIZE=uint64_t $(PARAMETERS) -o hi64-double hi64.c hkernel.c
longdouble:
gcc -O1 -funroll-loops -march=native -DDSIZE="long double" -DISIZE=uint64_t -DADVANCE=$(ADVANCE) -DNSAMP=$(NSAMP) -DNTRIAL=$(NTRIAL) -DPATIENCE=$(PATIENCE) -DRUNTM=$(RUNTM) -DSTOPRT=$(STOPRT) -DSTOPTM=$(STOPTM) -o hi64-longdouble hi64.c hkernel.c
gcc -O1 -funroll-loops -march=native -DDSIZE="long double" -DISIZE=uint64_t $(PARAMETERS) -o hi64-longdouble hi64.c hkernel.c

0 comments on commit cde7354

Please sign in to comment.