GO-LANG Windows下通用Makefile文件

# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

O=8
AS=${O}a
CC=${O}c
GC=${O}g
LD=${O}l
OS=568vq
CFLAGS=-FVw
ifeq ($(GOOS), windows)
EXT=exe
RM=del /Q
CP=copy
else
EXT=out
RM=rm
CP=cp
endif
MKDIR=mkdir
.SUFFIXES: .go .oo .8 .a .$(EXT)
GOFILES=\
	file.go
	
PACK_FILES=\
    domain.go test.go
    
pkgdir=..\\build

all: package cptobuild

.PHONY : clean
clean: 
	-$(RM) $(pkgdir)
	-$(RM) *.a
	-$(RM) *.oo
	-$(RM) *.8
	-$(RM) *.$(EXT)
	-$(MKDIR) $(pkgdir)

package: $(PACK_FILES:.go=.a) $(GOFILES:.go=.$(EXT))

cptobuild:
	-$(RM) $(pkgdir)
	-$(MKDIR) $(pkgdir)
	-$(CP) *.a $(pkgdir)
	-$(CP) *.$(EXT) $(pkgdir)
	-$(RM) *.a
	-$(RM) *.oo
	-$(RM) *.8
	-$(RM) *.$(EXT)
	echo $(subst \\,/,$(pkgdir))

%.$(EXT): %.8
	$(LD) -L . -o $@ $<

$(GOFILES:.go=.8): %.8: %.go 
	$(GC) -I . -o $@ $(GOFILES)

%.a: %.oo
	gopack grc $@ $<

$(PACK_FILES:.go=.oo): %.oo: %.go
	$(GC) -o $@ $<


你可能感兴趣的:(windows,ext,OS,OO,Go)