Skip to content

Instantly share code, notes, and snippets.

@nazfox
Created February 20, 2022 03:15
Show Gist options
  • Save nazfox/797c37c757a1db328bb8139e2f878685 to your computer and use it in GitHub Desktop.
Save nazfox/797c37c757a1db328bb8139e2f878685 to your computer and use it in GitHub Desktop.
色々書いたけど使わなくなったので供養
##################################################
# GLOBALS
##################################################
LOG_DIR = ./log/
SCRIPT_DIR = ./src/scripts/
NOTEBOOK_DIR = ./notebooks/
FIND_COMMAND = $(SCRIPT_DIR)/find-command.sh
MAKEFILE_USAGE = $(SCRIPT_DIR)/makefile-usage.sh
AUTO_PHONY = $(SCRIPT_DIR)/auto-phony.sh
TARGET_MAX_CHAR = 15
INSTALL_STAMP = .install.stamp
PYTHON = pipenv run python
PHONY = $(shell $(AUTO_PHONY) $(MAKEFILE_LIST))
##################################################
# COMMANDS
##################################################
# Diplays help by default
default: help
## Generate the dataset
data: $(DATA_STAMP)
$(DATA_STAMP): $(CONFIG_FILES)
$(PYTHON) ./src/data/make_dataset.py ./data/raw ./data/processed
## Train the model
train: $(TRAIN_FILES)
$(TRAIN_FILES): $(DATA_STAMP)
$(PYTHON) train.py
resume:
@echo resume
## Launch the Python interpreter
python: install
@pipenv run python
## Launch the tensorboard
tensorboard: install
@pipenv run tensorboard --logdir $(LOGDIR)
## Launch jupyter lab
jupyterlab: install
@pipenv run jupyter-lab --notebook-dir=$(NOTEBOOK_DIR)
## See pip dependencies
pipgraph: install
pipenv graph
## Setting up a development environment
install: $(INSTALL_STAMP)
$(INSTALL_STAMP):
@$(FIND_COMMAND) pipenv "See https://pipenv.pypa.io/en/latest/install/"
pipenv install
touch $(INSTALL_STAMP)
## Remove a development environment
uninstall:
pipenv --rm
rm -f $(INSTALL_STAMP)
## Show this message.
help:
@$(MAKEFILE_USAGE) $(MAKEFILE_LIST) $(TARGET_MAX_CHAR)
# Display .PHONY targets
phonylist:
@echo $(PHONY) | sed 's/ /\n/g' | sort
# .PHONY targets
.PHONY: $(PHONY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment