forked from ric2k1/qsyn.lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (45 loc) · 1.4 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
REFPKGS :=
SRCPKGS := extractor optimizer duostra device qcir simplifier lattice gflow m2 graph tensor cmd argparse util
SRCLIBS := $(addsuffix .a, $(addprefix lib, $(SRCPKGS)))
EXTINCDIR := include
VENDOR_DIR := vendor
VENDOR_HDRS := tqdm
SRC_DIR := src
BUILD_DIR := bin/qsyn-dev
BUILD_SRC_DIR := $(BUILD_DIR)/$(SRC_DIR)
LIB_DIR := $(BUILD_DIR)/lib
EXEC := qsyn
OPTIMIZE_LEVEL := -O3
DEBUG_FLAG := -DDEBUG
.PHONY: all
all: main
## Clean all objects files
.PHONY: clean
clean: $(addprefix clean_, $(SRCPKGS) main)
## Clean all objects files, .depend.mk, extheader.mk, and include/*
.PHONY: cleanall
cleanall: clean
@echo "Removing bin/*..."
@rm -rf bin/*
@echo "Removing include/*.h..."
@rm -f include/*.h
@echo "Removing vendor header links..."
@rm -f $(VENDOR_LINKS)
## lint the source files in-place
.PHONY: lint
lint:
@find ./src -regex ".*\.\(h\|cpp\)" -type f | xargs clang-format -i
.PHONY: libs
libs: $(addprefix $(BUILD_SRC_DIR), $(SRCLIBS))
## Linking external headers
.PHONY: extheader
EXTHEADER_MKS := $(addsuffix /.extheader.mk, $(addprefix $(BUILD_SRC_DIR)/, $(SRCPKGS) main))
extheader: $(EXTHEADER_MKS)
.PHONY: vendor-headers
VENDOR_LINKS := $(addprefix $(EXTINCDIR)/, $(VENDOR_HDRS))
vendor-headers: $(VENDOR_LINKS)
$(VENDOR_LINKS):
@$(ECHO) "Linking vendor header $(@F)..."
@rm -f $@
@ln -s ../$(VENDOR_DIR)/$@ $@
include $(SRC_DIR)/rules.mk