-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (31 loc) · 906 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
# vim: ft=make noexpandtab
BINDIR := bin
OBJDIR := obj
OBJECTS := src/mctyfile.o src/mctymaps.o
OBJECTS_TESTS := \
$(OBJDIR)/tests/check.o \
$(OBJDIR)/tests/chkmcfil.o \
$(OBJDIR)/tests/chkmcmap.o \
$(OBJDIR)/tests/chksetup.o
MD := mkdir -v -p
CFLAGS := -Wall -Werror -fpic
test_mcity2k: LDFLAGS += $(shell pkg-config --libs check) -L$(BINDIR)/static -lmcity2k
test_mcity2k: CFLAGS += -DCHECK -g
all: $(BINDIR)/static/libmcity2k.a $(BINDIR)/shared/libmcity2k.so test_mcity2k
test_mcity2k: $(BINDIR)/static/libmcity2k.a $(OBJECTS_TESTS)
$(MD) $(dir $@)
$(CC) -o $@ $^ $(LDFLAGS)
$(BINDIR)/static/libmcity2k.a: $(OBJECTS)
$(MD) $(dir $@)
$(AR) rcs $@ $^
$(BINDIR)/shared/libmcity2k.so: $(OBJECTS)
$(MD) $(dir $@)
$(CC) -shared -o $@ $^
$(OBJDIR)/%.o: %.c
$(MD) $(dir $@)
$(CC) -c -o $@ $(CFLAGS) $<
.PHONY: clean
clean:
rm -rf $(OBJDIR); \
rm -f test_mcity2k; \
rm -rf $(BINDIR)