Add initial make infrastructure
This commit is contained in:
parent
9cab35b159
commit
dae1ad10f9
20
Makefile
20
Makefile
@ -1,3 +1,8 @@
|
||||
ATRIP_ROOT := $(PWD)
|
||||
CONFIG ?= gcc
|
||||
include etc/config/$(CONFIG).mk
|
||||
include ./bench/config.mk
|
||||
|
||||
EMACS = emacs -q --batch
|
||||
define tangle
|
||||
$(EMACS) $(1) --eval "(require 'org)" --eval '(org-babel-tangle)'
|
||||
@ -12,6 +17,17 @@ $(SOURCES): $(MAIN)
|
||||
tangle: $(SOURCES)
|
||||
|
||||
clean:
|
||||
rm -r $(SOURCES)
|
||||
-rm -v $(SOURCES)
|
||||
|
||||
clean-all: bench-clean clean
|
||||
|
||||
bench: $(BENCH_TARGETS)
|
||||
|
||||
.PHONY: clean tangle bench
|
||||
|
||||
%: %.o
|
||||
$(CXX) $< $(CXXFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
%.o: %.cxx
|
||||
$(CXX) -c $< $(CXXFLAGS) -o $@
|
||||
|
||||
.PHONY: clean tangle
|
||||
|
||||
5
bench/config.mk
Normal file
5
bench/config.mk
Normal file
@ -0,0 +1,5 @@
|
||||
BENCH_SOURCES = $(wildcard $(ATRIP_ROOT)/bench/test*.cxx)
|
||||
BENCH_TARGETS = $(patsubst %.cxx,%,$(BENCH_SOURCES))
|
||||
|
||||
bench-clean:
|
||||
-rm -v $(BENCH_TARGETS)
|
||||
6
bench/test_main.cxx
Normal file
6
bench/test_main.cxx
Normal file
@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello world" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
6
etc/config/gcc.mk
Normal file
6
etc/config/gcc.mk
Normal file
@ -0,0 +1,6 @@
|
||||
include etc/ctf.mk
|
||||
|
||||
CXX = mpic++
|
||||
|
||||
CXXFLAGS += -I$(CTF_INCLUDE_PATH)
|
||||
LDFLAGS += -L$(CTF_BUILD_PATH) -lctf
|
||||
2
etc/ctf.mk
Normal file
2
etc/ctf.mk
Normal file
@ -0,0 +1,2 @@
|
||||
include ./etc/ctf_vars.mk
|
||||
include ./etc/ctf_rules.mk
|
||||
20
etc/ctf_rules.mk
Normal file
20
etc/ctf_rules.mk
Normal file
@ -0,0 +1,20 @@
|
||||
$(CTF_SRC_PATH)/configure:
|
||||
mkdir -p $(@D)
|
||||
git clone $(CTF_REPOSITORY) $(@D)
|
||||
cd $(@D) && git checkout $(CTF_COMMIT)
|
||||
|
||||
$(CTF_BUILD_PATH)/Makefile: $(CTF_SRC_PATH)/configure
|
||||
mkdir -p $(CTF_BUILD_PATH)
|
||||
cd $(CTF_BUILD_PATH) && $(CTF_SRC_PATH)/configure $(CTF_CONFIG_FLAGS)
|
||||
|
||||
$(CTF_STATIC_LIB): $(CTF_BUILD_PATH)/Makefile
|
||||
$(info Compiling $@)
|
||||
cd $(CTF_BUILD_PATH) && $(MAKE)
|
||||
|
||||
.PHONY: ctf ctf-clean
|
||||
ctf: $(CTF_STATIC_LIB)
|
||||
|
||||
ctf-clean:
|
||||
rm -rf $(CTF_BUILD_PATH)
|
||||
|
||||
IN_PROJECT_DEPENDENCIES += ctf
|
||||
10
etc/ctf_vars.mk
Normal file
10
etc/ctf_vars.mk
Normal file
@ -0,0 +1,10 @@
|
||||
CTF_REPOSITORY = https://github.com/cyclops-community/ctf
|
||||
CTF_COMMIT ?= v1.5.0
|
||||
|
||||
CTF_SRC_PATH = $(ATRIP_ROOT)/lib/src/ctf/$(CTF_COMMIT)
|
||||
CTF_BUILD_PATH = $(ATRIP_ROOT)/lib/build/ctf/$(CTF_COMMIT)
|
||||
|
||||
CTF_CONFIG_FLAGS =
|
||||
|
||||
CTF_STATIC_LIB = $(CTF_BUILD_PATH)/lib/libctf.a
|
||||
CTF_INCLUDE_PATH = $(CTF_BUILD_PATH)/include
|
||||
Loading…
Reference in New Issue
Block a user