Permalink
Browse files

Moving blokus core code to package 'blokus'.

  • Loading branch information...
1 parent 174c971 commit b014904476403c878a93aa2e95f57cef854dd112 @thejoshwolfe committed Jun 5, 2011
Showing with 57 additions and 7 deletions.
  1. +1 −1 .gitignore
  2. +4 −5 Makefile
  3. +16 −0 blokus/Makefile
  4. BIN blokus/_obj/blokus.a
  5. +1 −1 { → blokus}/blokus.go
  6. +3 −0 main.go
  7. +32 −0 packages.mk
View
@@ -1,2 +1,2 @@
_go_.[568]
-blokus
+blokus.bin
View
@@ -5,12 +5,11 @@ ifeq ($(GOROOT),)
endif
include $(GOROOT)/src/Make.inc
-TARG=blokus
+TARG=blokus.bin
GOFILES:=$(wildcard *.go)
-include $(GOROOT)/src/Make.cmd
+PACKAGES = blokus
+include packages.mk
-.PHONY: fmt
-fmt:
- gofmt -w $(GOFILES)
+include $(GOROOT)/src/Make.cmd
View
@@ -0,0 +1,16 @@
+
+include $(GOROOT)/src/Make.inc
+
+TARG=blokus
+GOFILES:=$(wildcard *.go)
+
+include $(GOROOT)/src/Make.pkg
+
+PACKAGES = ../blokus/blokus.a
+$(PREREQ): $(PACKAGES)
+$(PACKAGES):
+ @make --no-print-directory -C $(dir $@)
+
+.PHONY: fmt
+fmt:
+ gofmt -w $(GOFILES)
View
Binary file not shown.
@@ -1,4 +1,4 @@
-package main
+package blockus
const BoardSize = 20
View
@@ -3,9 +3,12 @@ package main
import (
"sdl"
"fmt"
+ // TODO: why is the explicit name required?
+ blokus "blokus"
)
func main() {
+ fmt.Println("loaded", len(blokus.Tiles), "shapes")
if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
panic(sdl.GetError())
}
View
@@ -0,0 +1,32 @@
+
+PACKAGE_OBJ_DIR = $(1)/_obj
+PACKAGE_FILE = $(call PACKAGE_OBJ_DIR,$(1))/$(1).a
+PACKAGE_OBJ_DIRS = $(foreach P,$(PACKAGES),$(call PACKAGE_OBJ_DIR,$(P)))
+PACKAGE_FILES = $(foreach P,$(PACKAGES),$(call PACKAGE_FILE,$(P)))
+PREREQ += $(PACKAGE_FILES)
+
+FIRST_DIR = $(firstword $(subst /, ,$(1)))
+RECURSE = make --no-print-directory -C
+PROPOGATE = $(foreach P,$(PACKAGES),$(RECURSE) $(P) $(1) && )true
+
+# TODO: make this work for more than a single package
+$(call PACKAGE_FILE,$(PACKAGES)):
+ @$(RECURSE) $(PACKAGES)
+
+GC += $(foreach P,$(PACKAGE_OBJ_DIRS),-I$(P))
+LD += $(foreach P,$(PACKAGE_OBJ_DIRS),-L$(P))
+
+.PHONY: fmt
+fmt:
+ gofmt -w $(GOFILES)
+ @$(call PROPOGATE,$@)
+
+.PHONY: clean_propogate
+clean: clean_propogate
+clean_propogate:
+ @$(call PROPOGATE,clean)
+
+# Don't let the targets in this file be used
+# as the default make target.
+.DEFAULT_GOAL:=
+

0 comments on commit b014904

Please sign in to comment.