diff options
-rw-r--r-- | doc/topics/build.txt | 8 | ||||
-rw-r--r-- | makefile | 36 | ||||
-rw-r--r-- | src/main.c | 4 |
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 | ||
6 | About: Compiling | 6 | About: Compiling |
7 | 7 | ||
8 | > make build | 8 | > make objects |
9 | 9 | ||
10 | Compiles all modules. | 10 | Compiles all modules. |
11 | 11 | ||
12 | > make build | ||
13 | |||
14 | Compiles the application executable file. | ||
15 | |||
12 | 16 | ||
13 | About: Automatic tests | 17 | About: Automatic tests |
14 | 18 | ||
@@ -28,7 +32,7 @@ About: Project report | |||
28 | 32 | ||
29 | > make report | 33 | > make report |
30 | 34 | ||
31 | Generates the project report using Pandoc. | 35 | Generates the project report using Pandoc and generate a commit log file. |
32 | 36 | ||
33 | 37 | ||
34 | About: Project archive | 38 | About: Project archive |
@@ -6,6 +6,13 @@ DOC_DIR := doc | |||
6 | BIN_DIR := bin | 6 | BIN_DIR := bin |
7 | 7 | ||
8 | 8 | ||
9 | ##### OUTPUT FILES | ||
10 | BIN := morph | ||
11 | ARCHIVE := upem-c-morphing-adam-pacien.tar.gz | ||
12 | LOG := commits.log | ||
13 | REPORT := project-report.pdf | ||
14 | |||
15 | |||
9 | ##### CC PARAMS | 16 | ##### CC PARAMS |
10 | CC := gcc | 17 | CC := gcc |
11 | CFLAGS := -ansi -Wall -pedantic -std=gnu99 -O2 | 18 | CFLAGS := -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 | ||
23 | all: build check api-doc report; | 30 | all: build check api-doc report; |
24 | 31 | ||
32 | build: objects $(BIN_DIR)/$(BIN); | ||
33 | |||
25 | .SECONDEXPANSION: | 34 | .SECONDEXPANSION: |
26 | build: $$(patsubst $(SRC_DIR)/$$(PERCENT).c,$(BIN_DIR)/$$(PERCENT).o,$$(wildcard $(SRC_DIR)/**/*.c)); | 35 | objects: $$(patsubst $(SRC_DIR)/$$(PERCENT).c,$(BIN_DIR)/$$(PERCENT).o,$$(wildcard $(SRC_DIR)/**/*.c)); |
27 | 36 | ||
28 | .SECONDEXPANSION: | 37 | .SECONDEXPANSION: |
29 | check: $$(patsubst $(TEST_DIR)/$$(PERCENT).c,$(BIN_DIR)/$$(PERCENT).test,$$(wildcard $(TEST_DIR)/**/*.c)); | 38 | check: $$(patsubst $(TEST_DIR)/$$(PERCENT).c,$(BIN_DIR)/$$(PERCENT).test,$$(wildcard $(TEST_DIR)/**/*.c)); |
30 | 39 | ||
31 | report: $(DOC_DIR)/project-report.pdf $(DOC_DIR)/commits.log; | 40 | report: $(DOC_DIR)/$(REPORT) $(DOC_DIR)/$(LOG); |
32 | 41 | ||
33 | clean: clean-bin clean-api-doc clean-report clean-archive; | 42 | clean: clean-bin clean-api-doc clean-report clean-archive; |
34 | 43 | ||
35 | archive: upem-c-morphing-adam-pacien.tar.gz; | 44 | archive: $(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 | ||
81 | clean-report: | 93 | clean-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 | ||
90 | upem-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 | ||
94 | clean-archive: | 106 | clean-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 @@ | |||
1 | int main(int argc, char **argv) { | ||
2 | // TODO! | ||
3 | return 0; | ||
4 | } | ||