forked from halide/Halide
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
42 lines (31 loc) · 1.22 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
include ../support/Makefile.inc
.PHONY: build clean test
build: $(BIN)/$(HL_TARGET)/wavelet
clean:
@rm -rf $(BIN)
# By default, %.generator is produced by building %_generator.cpp
$(GENERATOR_BIN)/%.generator: %_generator.cpp $(GENERATOR_DEPS)
@echo Building Generator $(filter %_generator.cpp,$^)
@mkdir -p $(@D)
@$(CXX) $(CXXFLAGS) $(filter %.cpp,$^) $(GENERATOR_LDFLAGS) -o $@
# Can't have multiple wildcards in Make, so we'll use a macro
# to stamp out all the rules we need
VARIANTS = daubechies_x haar_x inverse_daubechies_x inverse_haar_x
define GEN_RULE
$$(BIN)/%/$(1).a: $$(GENERATOR_BIN)/$(1).generator
@echo Running Generator $$<
@mkdir -p $$(@D)
@$$< -g $(1) -o $$(@D) target=$$*-no_runtime
endef
$(foreach V,$(VARIANTS),$(eval $(call GEN_RULE,$(V))))
$(BIN)/%/runtime.a: $(GENERATOR_BIN)/haar_x.generator
@echo Compiling Halide runtime for target $*
@mkdir -p $(@D)
@$< -r runtime -o $(@D) target=$*
$(BIN)/%/wavelet: wavelet.cpp $(foreach V,$(VARIANTS),$(BIN)/%/$(V).a) $(BIN)/%/runtime.a
@$(CXX) $(CXXFLAGS) $(IMAGE_IO_CXX_FLAGS) -I$(BIN)/$* $^ $(IMAGE_IO_LIBS) $(LDFLAGS) -o $@
test: $(BIN)/$(HL_TARGET)/wavelet
@echo Testing wavelet...
@$< ../images/gray.png $(<D)
# Don't auto-delete the generators.
.SECONDARY: