Use a shell script over a makefile
Simpler build system, easier to read.
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
;;; For more information see (info "(emacs) Directory Variables")
|
||||
|
||||
((nil . ((+license/license-choice . "GNU General Public License Version 2")
|
||||
(compile-command . "make run")))
|
||||
(compile-command . "sh build.sh")))
|
||||
(c++-mode . ((mode . clang-format))))
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
build/
|
||||
*.out
|
||||
TAGS
|
||||
|
||||
50
Makefile
50
Makefile
@@ -1,50 +0,0 @@
|
||||
CC=g++
|
||||
OUT=cwtree.out
|
||||
LIBS=-lm -lraylib
|
||||
ARGS=
|
||||
|
||||
RELEASE=0
|
||||
GFLAGS=-Wall -Wextra -Wswitch-enum -std=c++17
|
||||
DFLAGS=-ggdb -fsanitize=address -fsanitize=undefined
|
||||
RFLAGS=-O3
|
||||
DEPFLAGS=-MT $@ -MMD -MP -MF
|
||||
|
||||
ifeq ($(RELEASE), 1)
|
||||
CFLAGS=$(GFLAGS) $(RFLAGS)
|
||||
else
|
||||
CFLAGS=$(GFLAGS) $(DFLAGS)
|
||||
endif
|
||||
|
||||
SRC=src
|
||||
DIST=build
|
||||
CODE=$(addprefix $(SRC)/, numerics.cpp) # add source files here
|
||||
OBJECTS=$(CODE:$(SRC)/%.cpp=$(DIST)/%.o)
|
||||
DEPDIR:=$(DIST)/dependencies
|
||||
DEPS:=$(CODE:$(SRC)/%.cpp=$(DEPDIR):%.d) $(DEPDIR)/main.d
|
||||
|
||||
.PHONY: all
|
||||
all: $(OUT)
|
||||
|
||||
$(OUT): $(DIST)/$(OUT)
|
||||
|
||||
$(DIST)/$(OUT): $(OBJECTS) $(DIST)/main.o | $(DIST)
|
||||
$(CC) $(CFLAGS) $^ -o $@ $(LIBS)
|
||||
|
||||
$(DIST)/%.o: $(SRC)/%.cpp | $(DIST) $(DEPDIR)
|
||||
$(CC) $(CFLAGS) $(DEPFLAGS) $(DEPDIR)/$*.d -c $< -o $@ $(LIBS)
|
||||
|
||||
.PHONY: run
|
||||
run: $(DIST)/$(OUT)
|
||||
./$^ $(ARGS)
|
||||
|
||||
.PHONY:
|
||||
clean:
|
||||
rm -rfv $(DIST)/*
|
||||
|
||||
$(DIST):
|
||||
mkdir -p $(DIST)
|
||||
|
||||
$(DEPDIR):
|
||||
mkdir -p $(DEPDIR)
|
||||
|
||||
-include $(DEPS)
|
||||
Reference in New Issue
Block a user