Created
June 5, 2010 16:33
-
-
Save ksf/426753 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static. = | |
VERSION = $(if $(CheckProg git), $(shell git describe --tags --always), unknown) | |
FULLVERSION = $(VERSION) $(shell uname -m -o) | |
CXXFLAGS = -g3 -Wall -pedantic -pipe | |
CXXMM = $(CXX) $(CXXFLAGS) $(PREFIXED_INCLUDES) -MM # FIXME legacy: clean this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open OMakeconf | |
open OMakelib | |
.PHONY: cleanp clean | |
# .SUBDIRS: | |
# CXXFLAGS += | |
# LDFLAGS += | |
# INCLUDES += | |
################################################ | |
# Uncomment the following section if you want | |
# to build a C program in the current directory. | |
# | |
CProg(hello,main) | |
.DEFAULT: hello$(EXE) | |
CGeneratedFiles(version.h) | |
version.h: :value: $(FULLVERSION) | |
fprint( version.h, $"""$(AUTOGEN_WARNING) | |
#define VERSION "$(FULLVERSION)" | |
""") | |
cleanp: | |
git clean -xn | |
clean: | |
git clean -xf | |
@echo "!!! omake: remember to use omake -U on the next run" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The heuristic couldn't be easier (to fool): If there's a .h file included that | |
# has a corresponding .cpp file, the main app depends on the resulting .o | |
ObjectDependencies(target) = | |
eprint( ---- $(addsuffix .o, $(target)): ) | |
deps = $(shell $(CXXMM) $(addsuffix .cpp, $(target))) | |
deps = $(removesuffix $(filter %.h %.hpp, $(deps))) | |
deps = $(removesuffix $(filter-exists $(addsuffix .cpp, $(deps)))) | |
eprintln( $(addsuffix .o, $(deps)) ) | |
return $(deps) | |
ScanDependenciesI(target, acc) = | |
deps = $(ObjectDependencies $(target)) | |
acc += $(target) | |
new = $(set-diff $(deps), $(acc)) | |
acc += $(new) | |
foreach( n, $(new) ) | |
acc = $(set $(ScanDependenciesI $n, $(acc))) | |
export | |
return $(acc) | |
ScanDependencies(target) = | |
eprintln( --- Generating object dependency tree for root $(target)... ) | |
ret = $(set-diff $(ScanDependenciesI $(target), $(Sequence)), $(Sequence)) | |
ret = $(addsuffix .o, $(ret)) | |
eprintln( ----- $(target): $(ret)) | |
return $(ret) | |
CProg(name, main) = | |
exe = $(name)$(EXE) | |
section | |
OMakeFlags( -s ) | |
.SCANNER: $(exe): /.PHONY/CGeneratedFilesTarget :value: $(digest-in-path-optional $(INCLUDES), $&) :value: $(CXXMM) | |
println($(exe): $(string $(ScanDependencies $(main)))) | |
$(exe): /.PHONY/CGeneratedFilesTarget | |
$(CXX) $(CXXFLAGS) $(LDOUT)$@ $(filter %.o, $(dependencies $(exe))) $(LDFLAGS) | |
AUTOGEN_WARNING = /* DO NOT EDIT: build-system autogenerated file */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open build/C | |
open build/LaTeX | |
DefineCommandVars() | |
.SUBDIRS: . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment