Skip to content

Commit 7a8a3dd

Browse files
committed
Makefile for csv2sql
Makefile used to generate multi platform 32bit and 64bit versions of csv2sql using standard golang compiler. This is optional - just use: go build csv2sql.go to create the program on its own - but is useful if you want / need to generate multiple versions with one command, and you have make available on your computer of course.
1 parent bcb4058 commit 7a8a3dd

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

Makefile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#
2+
# Makefile for Go Language code
3+
#
4+
# --- CHANGE THESE FOR YOU SOURCE FILE NAME & OUPUT FILENAME (ie minus .go suffix)
5+
SRC=csv2sql.go
6+
OUTNAME=csv2sql
7+
# Go compiler settings
8+
CC=go
9+
CFLAGS=build
10+
#
11+
# To build for Linux 32bit
12+
LIN32=GOOS=linux GOARCH=amd64
13+
# To build for Linux 64bit
14+
LIN64=GOOS=linux GOARCH=amd64
15+
# To build Windows 32 bit version:
16+
WIN32=GOOS=windows GOARCH=386
17+
# To build Windows 64 bit version:
18+
WIN64=GOOS=windows GOARCH=amd64
19+
# To build Mac OS X 32 bit version:
20+
MAC32=GOOS=darwin GOARCH=386
21+
# To build Mac OS X 64 bit version:
22+
MAC64=GOOS=darwin GOARCH=amd64
23+
24+
$(OUTNAME): $(SRC)
25+
$(LIN64) $(CC) $(CFLAGS) -o $(OUTNAME) $(SRC)
26+
27+
lin32: $(SRC)
28+
$(LIN32) $(CC) $(CFLAGS) -o $(OUTNAME)-x386 $(SRC)
29+
30+
lin64: $(SRC)
31+
$(LIN64) $(CC) $(CFLAGS) -o $(OUTNAME) $(SRC)
32+
33+
win32: $(SRC)
34+
$(WIN32) $(CC) $(CFLAGS) -o $(OUTNAME)-x386.exe $(SRC)
35+
36+
win64: $(SRC)
37+
$(WIN64) $(CC) $(CFLAGS) -o $(OUTNAME)-x64.exe $(SRC)
38+
39+
mac32: $(SRC)
40+
$(MAC32) $(CC) $(CFLAGS) -o $(OUTNAME)-mac386 $(SRC)
41+
42+
mac64: $(SRC)
43+
$(MAC64) $(CC) $(CFLAGS) -o $(OUTNAME)-macx64 $(SRC)
44+
45+
clean:
46+
rm $(OUTNAME).exe $(OUTNAME)-x64.exe $(OUTNAME)-x386.exe $(OUTNAME) $(OUTNAME)-x386 $(OUTNAME)-macx64 $(OUTNAME)-mac386
47+
48+
all: lin64 win32 win64 mac64

0 commit comments

Comments
 (0)