-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rules.makefile
39 lines (33 loc) · 908 Bytes
/
Rules.makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#
# This file contains rules which are shared between multiple Makefiles.
# 2021, d3phys
#
#
# Special variables which should not be exported
#
unexport SUBDIRS
unexport OBJS
clean:
@rm -f *.o
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean); done
subdirs:
@for i in $(SUBDIRS); do (cd $$i && echo $$i && $(MAKE)) || exit; done
#
# Dependencies
#
dep:
@sed '/\#\#\# Dependencies \#\#\#/q' < Makefile > temp_make
@if [[ "$(wildcard *.cpp)" != "" ]]; then $(CPP) -MM *.cpp $(addprefix -I, $(HPATH)) >> temp_make; fi
@cp temp_make Makefile
@rm temp_make
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) dep) || exit; done
rmdep:
@sed '/\#\#\# Dependencies \#\#\#/q' < Makefile > temp_make
@cp temp_make Makefile
@rm temp_make
@for i in $(SUBDIRS); do (cd $$i && $(MAKE) rmdep) || exit; done
#
# Common rules
#
%.o : %.cpp
$(CXX) $(CXXFLAGS) -c $(LIBS) -I$(HPATH) -I$(ASSEMBLY_PATH) $< -o $@