diff options
| author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-06-13 19:33:53 +0200 | 
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-06-13 19:33:53 +0200 | 
| commit | 5ea97553355c8109e81a560ba90ce942fa8db429 (patch) | |
| tree | 6016f0c32612c5ab269a407b1364937b0867ffac | |
| parent | 4f923fbdace27f27421bf18dfc9655b73bd68929 (diff) | |
Clean up Makefile
| -rw-r--r-- | Makefile | 26 | ||||
| -rw-r--r-- | cppbuild.cc | 2 | 
2 files changed, 17 insertions, 11 deletions
@@ -1,14 +1,20 @@ -all: libcppbuild.a cppbuild +all: libcppbuild.a -libcppbuild.a: libcppbuild.cc libcppbuild.h task_cc.cc task_cc.h task_ld.cc task_ld.h task.h execute.cc execute.h -	g++ -g -std=c++17  libcppbuild.cc -c -o libcppbuild.o -	g++ -g -std=c++17  task_cc.cc -c -o task_cc.o -	g++ -g -std=c++17  task_ld.cc -c -o task_ld.o -	g++ -g -std=c++17  execute.cc -c -o execute.o -	ar rcs libcppbuild.a libcppbuild.o task_cc.o task_ld.o execute.o +SRC = \ +	libcppbuild.cc \ +	task_cc.cc \ +	task_ld.cc \ +	execute.cc \ -cppbuild: cppbuild.cc  libcppbuild.h libcppbuild.a -	g++ -g -std=c++17 cppbuild.cc libcppbuild.a -pthread -o cppbuild +OBJ = $(patsubst %.cc,%.o,$(SRC)) + +CXXFLAGS = -s -O3 -std=c++17 + +%.o: %.cc +	g++ $(CXXFLAGS) -c $< -o $@ + +libcppbuild.a: $(OBJ) +	ar rcs $@ $(OBJ)  clean: -	rm -f cppbuild libcppbuild.o task_cc.o task_ld.o libcppbuild.a +	rm -f libcppbuild.a $(OBJ) diff --git a/cppbuild.cc b/cppbuild.cc index 3604260..eb8b78e 100644 --- a/cppbuild.cc +++ b/cppbuild.cc @@ -2,7 +2,7 @@  if [ "cppbuild" -ot "$0" ]  then  	echo "Rebuilding cppbuild" -	g++ -std=c++17 -pthread $0 libcppbuild.a -o cppbuild +	g++ -s -O3 -std=c++17 -pthread $0 libcppbuild.a -o cppbuild  	[ $? != 0 ] && exit 1  fi  | 
