First shot at recursive Makefile in top dir and in examples dir.

This commit is contained in:
Göran Krampe 2011-09-29 17:09:26 +02:00
parent a574b00de1
commit abc0ae8c8e
5 changed files with 80 additions and 5 deletions

52
Makefile Normal file
View File

@ -0,0 +1,52 @@
# Makefile for sub directories
AMBER = st
SERVER = server
EXAMPLES = examples
# REST is all except AMBER
REST = $(SERVER) $(EXAMPLES)
# And these are all
DIRS = $(AMBER) $(REST)
# The sets of directories to do various things in
BUILDDIRS = $(DIRS:%=build-%)
EXAMPLESDIRS = $(EXAMPLES:%=build-%)
INSTALLDIRS = $(AMBER:%=install-%)
CLEANDIRS = $(REST:%=clean-%)
CLEANALLDIRS = $(DIRS:%=clean-%)
all: $(BUILDDIRS)
$(DIRS): $(BUILDDIRS)
$(BUILDDIRS):
$(MAKE) -C $(@:build-%=%)
amber: build-st
# Examples and server need Amber first
build-server: build-st
build-examples: build-st
examples: $(EXAMPLESDIRS)
$(EXAMPLESDIRS):
$(MAKE) -C $(@:build-%=%)
install: $(INSTALLDIRS)
$(INSTALLDIRS):
$(MAKE) -C $(@:install-%=%) install
clean: $(CLEANDIRS)
$(CLEANDIRS):
$(MAKE) -C $(@:clean-%=%) clean
cleanall: $(CLEANALLDIRS)
$(CLEANALLDIRS):
$(MAKE) -C $(@:clean-%=%) clean
.PHONY: subdirs $(DIRS)
.PHONY: subdirs $(BUILDDIRS)
.PHONY: subdirs $(INSTALLDIRS)
.PHONY: subdirs $(CLEANDIRS)
.PHONY: subdirs $(CLEANALLDIRS)
.PHONY: all install clean

23
examples/Makefile Normal file
View File

@ -0,0 +1,23 @@
# Makefile for sub directories
#
# mindepth makes sure we do not include this Makeile
MAKEFILES = $(shell find . -mindepth 2 -name 'Makefile')
DIRS = $(patsubst %/Makefile, %, $(MAKEFILES))
# The sets of directories to do various things in
BUILDDIRS = $(DIRS:%=build-%)
CLEANDIRS = $(DIRS:%=clean-%)
all: $(BUILDDIRS)
$(DIRS): $(BUILDDIRS)
$(BUILDDIRS):
$(MAKE) -C $(@:build-%=%)
clean: $(CLEANDIRS)
$(CLEANDIRS):
$(MAKE) -C $(@:clean-%=%) clean
.PHONY: subdirs $(DIRS)
.PHONY: subdirs $(BUILDDIRS)
.PHONY: subdirs $(CLEANDIRS)
.PHONY: all clean

View File

@ -22,7 +22,7 @@ $(IPK): $(FILEJS)
clean:
rm -f $(FILEJS) $(OBJECTS) $(IPK)
palm-install -r $(PACKAGE)
# palm-install -r $(PACKAGE)
install: $(IPK)
palm-install $(IPK)

View File

@ -8,7 +8,7 @@ PACKAGE := amber.helloamber
VERSION := 1.0.0
# -O for Closure optimization of js code.
FLAGS := -O
FLAGS :=
IPK := $(PACKAGE)_$(VERSION)_all.ipk
FILE := Program
SOURCES := $(wildcard *.st)
@ -23,7 +23,7 @@ $(IPK): $(FILEJS)
clean:
rm -f $(FILEJS) $(OBJECTS) $(IPK)
palm-install -r $(PACKAGE)
# palm-install -r $(PACKAGE)
install: $(IPK)
palm-install $(IPK)

View File

@ -1,7 +1,7 @@
Program.js: FileServer.st
server.js: FileServer.st
../bin/amberc -m FileServer FileServer.st server
run: Program.js
run: server.js
./server
clean: