summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/topics/build.txt8
-rw-r--r--makefile36
-rw-r--r--src/main.c4
3 files changed, 34 insertions, 14 deletions
diff --git a/doc/topics/build.txt b/doc/topics/build.txt
index b52901b..adcd6a8 100644
--- a/doc/topics/build.txt
+++ b/doc/topics/build.txt
@@ -5,10 +5,14 @@ List of the make targets. The global `make all` and `make clean` are also define
5 5
6About: Compiling 6About: Compiling
7 7
8> make build 8> make objects
9 9
10Compiles all modules. 10Compiles all modules.
11 11
12> make build
13
14Compiles the application executable file.
15
12 16
13About: Automatic tests 17About: Automatic tests
14 18
@@ -28,7 +32,7 @@ About: Project report
28 32
29> make report 33> make report
30 34
31Generates the project report using Pandoc. 35Generates the project report using Pandoc and generate a commit log file.
32 36
33 37
34About: Project archive 38About: Project archive
diff --git a/makefile b/makefile
index b4cc66a..7726d33 100644
--- a/makefile
+++ b/makefile
@@ -6,6 +6,13 @@ DOC_DIR := doc
6BIN_DIR := bin 6BIN_DIR := bin
7 7
8 8
9##### OUTPUT FILES
10BIN := morph
11ARCHIVE := upem-c-morphing-adam-pacien.tar.gz
12LOG := commits.log
13REPORT := project-report.pdf
14
15
9##### CC PARAMS 16##### CC PARAMS
10CC := gcc 17CC := gcc
11CFLAGS := -ansi -Wall -pedantic -std=gnu99 -O2 18CFLAGS := -ansi -Wall -pedantic -std=gnu99 -O2
@@ -18,21 +25,23 @@ PERCENT := %
18 25
19 26
20##### MAIN TARGETS 27##### MAIN TARGETS
21.PHONY: all check build report clean 28.PHONY: all check build objects report clean
22 29
23all: build check api-doc report; 30all: build check api-doc report;
24 31
32build: objects $(BIN_DIR)/$(BIN);
33
25.SECONDEXPANSION: 34.SECONDEXPANSION:
26build: $$(patsubst $(SRC_DIR)/$$(PERCENT).c,$(BIN_DIR)/$$(PERCENT).o,$$(wildcard $(SRC_DIR)/**/*.c)); 35objects: $$(patsubst $(SRC_DIR)/$$(PERCENT).c,$(BIN_DIR)/$$(PERCENT).o,$$(wildcard $(SRC_DIR)/**/*.c));
27 36
28.SECONDEXPANSION: 37.SECONDEXPANSION:
29check: $$(patsubst $(TEST_DIR)/$$(PERCENT).c,$(BIN_DIR)/$$(PERCENT).test,$$(wildcard $(TEST_DIR)/**/*.c)); 38check: $$(patsubst $(TEST_DIR)/$$(PERCENT).c,$(BIN_DIR)/$$(PERCENT).test,$$(wildcard $(TEST_DIR)/**/*.c));
30 39
31report: $(DOC_DIR)/project-report.pdf $(DOC_DIR)/commits.log; 40report: $(DOC_DIR)/$(REPORT) $(DOC_DIR)/$(LOG);
32 41
33clean: clean-bin clean-api-doc clean-report clean-archive; 42clean: clean-bin clean-api-doc clean-report clean-archive;
34 43
35archive: upem-c-morphing-adam-pacien.tar.gz; 44archive: $(ARCHIVE);
36 45
37 46
38##### BINARIES GENERATION 47##### BINARIES GENERATION
@@ -44,10 +53,13 @@ $(BIN_DIR)/%.o: $$(patsubst $(BIN_DIR)/$$(PERCENT).o,$(SRC_DIR)/$$(PERCENT).c,$$
44 $(CC) $(CFLAGS) $(IFLAGS) -c $< -o $@ 53 $(CC) $(CFLAGS) $(IFLAGS) -c $< -o $@
45 54
46.SECONDEXPANSION: 55.SECONDEXPANSION:
47$(BIN_DIR)/%.test: $$(patsubst $(BIN_DIR)/$$(PERCENT).test,$(TEST_DIR)/$$(PERCENT).c,$$@) build | $$(@D)/ 56$(BIN_DIR)/%.test: $$(patsubst $(BIN_DIR)/$$(PERCENT).test,$(TEST_DIR)/$$(PERCENT).c,$$@) objects | $$(@D)/
48 $(CC) $(CFLAGS) $(IFLAGS) $(BIN_DIR)/**/*.o $< -o $@ $(LFLAGS) 57 $(CC) $(CFLAGS) $(IFLAGS) $(BIN_DIR)/**/*.o $< -o $@ $(LFLAGS)
49 ./$@ 58 ./$@
50 59
60$(BIN_DIR)/$(BIN): $(SRC_DIR)/main.c
61 $(CC) $(CFLAGS) $(IFLAGS) $(BIN_DIR)/**/*.o $< -o $@ $(LFLAGS)
62
51$(BIN_DIR)/%/: 63$(BIN_DIR)/%/:
52 mkdir -p $(@D) 64 mkdir -p $(@D)
53 65
@@ -68,28 +80,28 @@ clean-api-doc:
68 80
69 81
70##### REPORT 82##### REPORT
71.PRECIOUS: $(DOC_DIR)/%.pdf $(DOC_DIR)/commits.log 83.PRECIOUS: $(DOC_DIR)/%.pdf $(DOC_DIR)/$(LOG)
72.PHONY: clean-report 84.PHONY: clean-report
73 85
74.SECONDEXPANSION: 86.SECONDEXPANSION:
75$(DOC_DIR)/%.pdf: $$(patsubst $$(PERCENT).pdf,$$(PERCENT).md,$$@) 87$(DOC_DIR)/%.pdf: $$(patsubst $$(PERCENT).pdf,$$(PERCENT).md,$$@)
76 pandoc --template $(DOC_DIR)/report-template.tex --number-sections --listings --output $@ $< 88 pandoc --template $(DOC_DIR)/report-template.tex --number-sections --listings --output $@ $<
77 89
78$(DOC_DIR)/commits.log: 90$(DOC_DIR)/$(LOG):
79 git log > $@ 91 git log > $@
80 92
81clean-report: 93clean-report:
82 $(RM) -r $(DOC_DIR)/project-report.pdf 94 $(RM) $(DOC_DIR)/$(REPORT)
83 $(RM) -r $(DOC_DIR)/commits.log 95 $(RM) $(DOC_DIR)/$(LOG)
84 96
85 97
86##### ARCHIVE 98##### ARCHIVE
87.PRECIOUS: upem-c-morphing-adam-pacien.tar.gz 99.PRECIOUS: $(ARCHIVE)
88.PHONY: clean-archive 100.PHONY: clean-archive
89 101
90upem-c-morphing-adam-pacien.tar.gz: build check clean report 102$(ARCHIVE): check clean report
91 touch $@ 103 touch $@
92 tar --exclude-vcs --exclude=./$@ -zcvf ./$@ . 104 tar --exclude-vcs --exclude=./$@ -zcvf ./$@ .
93 105
94clean-archive: 106clean-archive:
95 $(RM) upem-c-morphing-adam-pacien.tar.gz 107 $(RM) $(ARCHIVE)
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..b5cd16d
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,4 @@
1int main(int argc, char **argv) {
2 // TODO!
3 return 0;
4}