summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: c89d7074e74b9f3de67662f322f69397766e9d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#============================================================================
# bandwidth, a benchmark to estimate memory transfer bandwidth.
# Copyright (C) 2005-2014 by Zack T Smith.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
# The author may be reached at veritas@comcast.net.
#============================================================================

CFLAGS= -O6 
CFLAGS= -g
CC=gcc
LD=gcc 
SRC=main.c 
OBJ=main.o
LIB= 
AS=nasm

message:
	@echo ""
	@echo "To compile for x86 Linux:          make bandwidth32"
	@echo "To compile for x86_64 Linux:       make bandwidth64"
	@echo "To compile for ppc64el Linux:      make bandwidth-ppc64el"
	@echo "To compile for x86 Mac OS/X:       make bandwidth-mac32"
	@echo "To compile for x86_64 Mac OS/X:    make bandwidth-mac64"
	@echo "To compile for x86 Win32/Cygwin:   make bandwidth-win32"
	@echo "Note! For the Mac you will need to install the latest NASM; Apple's is insufficient."
	@echo ""

bandwidth64:	main.c routines64.asm BMP64.a BMPGraphing64.a
	${AS} -f elf64 routines64.asm -o routines64.o
	${CC} ${CFLAGS} -m64 -c ${SRC}
	${LD} -m64 routines64.o ${OBJ} BMP64.a -lm BMPGraphing64.a -o bandwidth64 

bandwidth-ppc64el:	main.c routines-ppc64el.asm BMP64.a BMPGraphing64.a
	as -mregnames -mpower8 -o routines-ppc64el.o routines-ppc64el.asm
	${CC} ${CFLAGS} -m64 -c ${SRC}
	${LD} -m64 routines-ppc64el.o ${OBJ} BMP64.a -lm BMPGraphing64.a -o bandwidth-ppc64el

bandwidth32:	main.c routines32.asm BMP32.a BMPGraphing32.a
	${AS} -f elf routines32.asm -o routines32.o
	${CC} ${CFLAGS} -m32 -c ${SRC}
	${LD} -m32 routines32.o ${OBJ} BMP32.a -lm BMPGraphing32.a -o bandwidth32 

bandwidth-mac64:	main.c routines64.asm BMPGraphing64.a BMP64.a
	${AS} -f macho64 routines64.asm -o routines64.o
	${CC} ${CFLAGS} -m64 -c ${SRC}
	${LD} -m64 -lm BMPGraphing64.a BMP64.a routines64.o ${OBJ} ${LIB} -o bandwidth-mac64

bandwidth-mac32:	main.c routines32.asm BMP32.a BMPGraphing32.a
	${AS} -f macho routines32.asm -o routines32.o
	${CC} ${CFLAGS} -m32 -c ${SRC}
	${LD} -m32 BMP32.a -lm BMPGraphing32.a  routines32.o ${OBJ} ${LIB} -o bandwidth-mac32

bandwidth-win32:	main.c routines32.asm  BMP32.a BMPGraphing32.a
	${AS} -f win32 routines32.asm -o routines32.o
	${CC} ${CFLAGS} -m32 -c ${SRC} -Wall -O6 -D__WIN32__ -DWINVER=0x0600 
	${LD} -m32 BMP32.a -lm BMPGraphing32.a routines32.o ${OBJ} ${LIB} -o bandwidth-win32

BMPGraphing64.a: BMPGraphing.c 
	${CC} ${CFLAGS} -m64 -c BMPGraphing.c 
	ar rvs BMPGraphing64.a BMPGraphing.o

BMPGraphing32.a: BMPGraphing.c 
	${CC} ${CFLAGS} -m32 -c BMPGraphing.c 
	ar rvs BMPGraphing32.a BMPGraphing.o

BMP64.a: BMP.c
	${CC} ${CFLAGS} -m64 -c BMP.c font.c minifont.c
	ar rvs BMP64.a BMP.o font.o minifont.o

BMP32.a: BMP.c
	${CC} ${CFLAGS} -m32 -c BMP.c font.c minifont.c
	ar rvs BMP32.a BMP.o font.o minifont.o

clean:
	rm -f main.o bandwidth bandwidth32 bandwidth64 routines32.o routines64.o 
	rm -f bandwidth-ppc64el routines-ppc64el.o
	rm -f bandwidth-win32.exe bandwidth.bmp bandwidth-mac32 bandwidth-mac64
	rm -f BMP.o BMP32.a BMP64.a BMPGraphing.o BMPGraphing32.a BMPGraphing64.a
	rm -f font.o minifont.o network_bandwidth.bmp

OpenPOWER on IntegriCloud