Last active
January 17, 2019 22:07
-
-
Save spino327/a58cb76891ce75aa236e0ea1ddddad90 to your computer and use it in GitHub Desktop.
Sample Makefiles
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
web: | |
jekyll clean -s frontend -d src/main/resources/assets | |
jekyll build -s frontend -d src/main/resources/assets | |
web_ci: | |
jekyll build -s frontend -d target/classes/assets -w& | |
package: web | |
mvn package | |
mkdir -p .prelease | |
cp server.sh partner4cs_db.mv.db config.yaml target/app-0.1.0.jar .prelease | |
tar -cf release.tar -C .prelease config.yaml app-0.1.0.jar app.mv.db server.sh | |
clean: | |
mvn clean | |
compile: | |
jekyll clean -s frontend -d target/classes/assets | |
jekyll build -s frontend -d target/classes/assets | |
mvn compile | |
create_local_db: | |
./create_local_db.sh | |
run: compile create_local_db | |
mvn exec:java -Dexec.mainClass="com.App" -Dexec.args="serve config_local.yaml" | |
run_ci: web_ci create_local_db | |
mvn exec:java -Dexec.mainClass="com.App" -Dexec.args="serve config_local.yaml" | |
./kill_ci.sh | |
kill_ci: | |
./kill_ci.sh | |
debug: | |
mvn package -DskipTests | |
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9000 -jar target/app-0.1.0.jar serve config_local.yaml | |
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
SHELL=/usr/bin/env sh | |
include sys/make.def | |
################################################## | |
# Verbose & Log | |
################################################# | |
QUIET:=@ | |
ifdef VERBOSE | |
QUIET:= | |
endif | |
RECORD:= | |
ifdef LOGS | |
RECORD:= | tee -a logs.txt | |
endif | |
ifdef LOGS_ALL | |
RECORD:= |& tee -a logs.txt | |
endif | |
RUN_TEST=sys/run_test.sh | |
################################################## | |
# Source files | |
################################################# | |
SOURCES_C := $(shell find $(CURDIR) -name '*.c') | |
SOURCES_CPP := $(shell find $(CURDIR) -name '*.cpp') | |
OBJS_C := $(SOURCES_C:.c=.o) | |
OBJS_CPP := $(SOURCES_CPP:.cpp=.o) | |
RUN_C := $(addprefix $(BINDIR)/,$(notdir $(SOURCES_C:.c=.run))) | |
RUN_CPP := $(addprefix $(BINDIR)/,$(notdir $(SOURCES_CPP:.cpp=.run))) | |
.PHONY: all | |
all: $(RUN_C) $(RUN_CPP) | |
@echo "DONE" ${RECORD} | |
################################################## | |
# Compilation rules | |
################################################## | |
# c files rule | |
%.o: %.c $(BINDIR) | |
@echo -e $(TXTYLW) compile: $< $(TXTNOC) ${RECORD} | |
-$(QUIET)$(CCOMPILE) $< -o $(BINDIR)/$(notdir $@) $(RECORD) | |
# c++ files rule | |
%.o: %.cpp $(BINDIR) | |
@echo -e $(TXTYLW) compile: $< $(TXTNOC) ${RECORD} | |
-$(QUIET)$(CXXCOMPILE) $< -o $(BINDIR)/$(notdir $@) $(RECORD) | |
################################################## | |
# Running tests rules | |
################################################## | |
# run c app rule | |
%.run: $(OBJS_C) | |
@echo -e $(TXTGRN) running: $@ $(TXTNOC) ${RECORD} | |
-@$(RUN_TEST) $(@:.run=.o) $(VERBOSE) $(RECORD) | |
# run cpp app rule | |
%.run: $(OBJS_CPP) | |
@echo -e $(TXTGRN) running: $@ $(TXTNOC) ${RECORD} | |
-@$(RUN_TEST) $(@:.run=.o) $(VERBOSE) $(RECORD) | |
# Creates the BINDIR folder | |
$(BINDIR): | |
mkdir $@ | |
.PHONY: clean | |
clean: | |
- rm -r $(BINDIR) | |
.PHONY: compilers | |
compilers: | |
@echo "C compilers: "$(CCOMPILERS) | |
@echo "C++ compilers: "$(CXXCOMPILERS) | |
.PHONY: help | |
help: | |
@echo "OpenMP Offloading Validation Suite" | |
@echo "" | |
@echo "Do make CC=ccompiler CXX=cppcompiler [VERBOSE=1] [LOGS=1] [rule] (e.g. make CC=clang CXX=clang++ all), where rule may be one of:" | |
@echo " all" | |
@echo " Build and run all the OpenMP tests." | |
@echo " clean" | |
@echo " Remove all executables from bin/ directory" | |
@echo " compilers" | |
@echo " Shows available compiler configuration" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment