Skip to content

Commit 7a1ce79

Browse files
committed
docutils makefile pdf works
1 parent a6904fc commit 7a1ce79

File tree

7 files changed

+303
-66
lines changed

7 files changed

+303
-66
lines changed

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
_gitignore/
2+
#docs, examples, tests
3+
4+
_out/
5+
#output files: bins/.so/.a
6+
7+
_tmp/
8+
#intermediate compilation files: .o
9+
10+
# Compiled Object files
11+
*.slo
12+
*.lo
13+
*.out
14+
*.o
15+
16+
# Compiled Dynamic libraries
17+
*.so
18+
*.dylib
19+
20+
# Compiled Static libraries
21+
*.lai
22+
*.la
23+
*.a
24+
25+
#assembly code
26+
*.s
27+
28+
#temporary files
29+
*.tmp

makefile

Lines changed: 59 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
#sources
1+
##sources
22
#http://www.jfranken.de/homepages/johannes/vortraege/make_inhalt.en.html
33
#http://www-cip.physik.uni-bonn.de/pool/infos/make/advanced.html
44

5-
#motivation
5+
##motivation
66

77
#takes care of dependencies
8+
89
#only builds if requirements were changed! (looks at timestamps)
910

10-
#basics
11+
##basics
1112

1213
target: dep1 dep2
1314

@@ -23,9 +24,10 @@
2324

2425
#$make target #makes target
2526

26-
#conventional targets
27+
##conventional targets
28+
29+
##phony targets
2730

28-
#phony targets
2931
#if you don't give phony, make thinks you want to build a file
3032
#if a file install exists, make does nothing!
3133
#http://stackoverflow.com/questions/2145590/what-is-the-purpose-of-phony-in-a-makefile
@@ -75,7 +77,7 @@
7577
install:
7678
@mv out $(DIRINPATH)
7779

78-
#variables
80+
##variables
7981

8082
CC=gcc
8183
CXX=$(CC)
@@ -142,14 +144,15 @@
142144

143145
#use hyphens '-' or '_' instead
144146

145-
#include
147+
##include
148+
146149
#sources a file
147150
include make.inc
148151

149152
#continue even if missing
150153
-include make.inc
151154

152-
#implicit rules
155+
##implicit rules
153156

154157
# An explicit rule assigns the commands for several targets
155158
coat shoes mobile sweater socks trousers\
@@ -163,39 +166,22 @@
163166
trousers: pants shirt
164167
shirt: undershirt
165168

166-
#duplicate rules ::
169+
##duplicate rules
170+
167171
#must use double colons
168172

169173
#socks will build both
170174
socks:: ; @echo get into left sock
171175
socks:: ; @echo get into right sock
172176

173-
#call other makefiles
174-
$(MAKE)
175-
176-
#builtin function
177+
##call other makefiles
177178

178-
#wildcard. makes an array with wildcard.
179-
SRCS = $(wildcard *$(INEXT))
180-
181-
#pathsub. makes an array with wildcard.
182-
OUTS = $(patsubst %$(INEXT),%$(OUTEXT),$(SRCS))
183-
184-
#compile all files of a type
185-
INEXT=.c
186-
OUTEXT=
187-
SRCS = $(wildcard *$(INEXT))
188-
OUTS = $(patsubst %$(INEXT),%$(OUTEXT),$(SRCS))
189-
all: $(OUTS)
190-
%: %$(INEXT)
191-
$(CC) $(CFLAGS) -o $@$(OUTEXT) $<
192-
193-
#@
179+
$(MAKE)
194180

195-
#silent
181+
##silent
196182

197183
#normally build shows the commands it does
198-
#with @, it omits the commands
184+
#with `@`, it omits the commands
199185
#BUT the stdout/err of the command still shows!
200186
all:
201187
@echo asdf
@@ -205,22 +191,19 @@
205191
#"asdf"
206192
@echo asdf
207193

208-
#ignore errors -
194+
##ignore errors
195+
209196
#normally build stops if error
210-
#not if -
197+
#not if `-`
211198
all:
212199
-gcc a.c
213200

214-
#ignore error and silent
201+
##ignore error and silent
202+
215203
all:
216204
@-gcc a.c
217205

218-
#compile all c files into one target
219-
SRC=$(wildcard *.c)
220-
all: $(SRC)
221-
gcc $(CFLAGS) -o $@ $^ $(LIBS)
222-
223-
#command line variables
206+
##command line variables
224207

225208
###
226209
$make run A='"1"'
@@ -249,7 +232,7 @@ all: $(SRC)
249232
echo $(A)
250233
#as df
251234

252-
#conditionals
235+
##conditional
253236

254237
A=defined
255238
all: a.out
@@ -259,7 +242,22 @@ all: $(SRC)
259242
echo undefined
260243
endif
261244

262-
#builtin funcs
245+
##builtin functions
246+
247+
#wildcard. makes an array with wildcard.
248+
SRCS = $(wildcard *$(INEXT))
249+
250+
#pathsub. makes an array with wildcard.
251+
OUTS = $(patsubst %$(INEXT),%$(OUTEXT),$(SRCS))
252+
253+
#compile all files of a type
254+
INEXT=.c
255+
OUTEXT=
256+
SRCS = $(wildcard *$(INEXT))
257+
OUTS = $(patsubst %$(INEXT),%$(OUTEXT),$(SRCS))
258+
all: $(OUTS)
259+
%: %$(INEXT)
260+
$(CC) $(CFLAGS) -o $@$(OUTEXT) $<
263261

264262
$(subst from,to,text) Replace from with to in text.
265263
$(patsubst pattern,replacement,text) Replace words matching pattern with replacement in text.
@@ -292,7 +290,7 @@ all: $(SRC)
292290

293291
$(eval X := $(AUX_DIR)$* ) define a variable inside a rule
294292

295-
#submake
293+
##submake
296294

297295
#call other makefiles
298296

@@ -308,9 +306,25 @@ all:
308306

309307
make
310308

311-
#recipes
309+
##multiline commands
310+
311+
#when `\` ends the line
312+
313+
#simply make continues reading next line
314+
315+
#`\` is passed to bash
316+
317+
all:
318+
319+
( \
320+
cd d ;\
321+
pwd ;\
322+
)
323+
324+
##recipes
325+
326+
##make all files of an extension inside given path
312327

313-
#make all files of an extension inside given path
314328
CC=pdflatex
315329
IN_EXT=.tex
316330
IN_DIR=src/
@@ -336,4 +350,3 @@ all:
336350
rm -rf $(OUT_DIR) $(AUX_DIR)
337351
#rm *.$(OUT_EXT)
338352
#compile command
339-

0 commit comments

Comments
 (0)