-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (31 loc) · 865 Bytes
/
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
39
40
41
42
43
44
45
46
47
CC = gcc
BIN = lib/libnmea.a
MODULES = generate generator parse parser tok context time info gmath sentence
SAMPLES = generate generator parse parse_file math
OBJ = $(MODULES:%=build/nmea_gcc/%.o)
LINKOBJ = $(OBJ) $(RES)
SMPLS = $(SAMPLES:%=samples_%)
SMPLOBJ = $(SAMPLES:%=samples/%/main.o)
INCS = -I include
LIBS = -Llib -lnmea -lm
CFLAGS=-lm
.PHONY: all all-before all-after clean clean-custom doc
all: all-before $(BIN) samples all-after
all-before:
mkdir -p build/nmea_gcc
mkdir -p lib
clean: clean-custom
rm -f $(LINKOBJ) $(BIN) $(SMPLOBJ) $(SMPLS)
doc:
$(MAKE) -C doc
remake: clean all
$(BIN): $(LINKOBJ)
ar rsc $@ $^
ranlib $@
build/nmea_gcc/%.o: src/%.c
$(CC) $(INCS) -c $< -o $@
samples: $(SMPLS)
samples_%: samples/%/main.o
$(CC) $< $(LIBS) -o build/$@
samples/%/main.o: samples/%/main.c
$(CC) $(INCS) -c $< -o $@