forked from mcclurmc/vncterm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (43 loc) · 991 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
TARGET = vncterm
OBJS := main.o console.o
LIBS_so := libvnc/libvnc.so
LIBS := libvnc/libvnc.a
CFLAGS = -I$(shell pwd)/include
# _GNU_SOURCE for asprintf.
CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
CFLAGS += -Wall -Werror -g -O1
ifeq ($(shell uname),Linux)
LDLIBS := -lutil
endif
ifndef WITHOUT_XENSTORE
LDLIBS += -lxenstore
else
CFLAGS += -DNXENSTORE
endif
# Get gcc to generate the dependencies for us.
CFLAGS += -Wp,-MD,$(@D)/.$(@F).d
SUBDIRS = $(filter-out ./,$(dir $(OBJS) $(LIBS)))
DEPS = .*.d
LDFLAGS := -g
all: $(TARGET)
$(TARGET): $(LIBS) $(OBJS)
gcc -o $@ $(LDFLAGS) $(OBJS) $(LIBS) $(LDLIBS)
%.o: %.c
gcc -o $@ $(CFLAGS) -c $<
$(LIBS_so): %.so: ALWAYS
$(MAKE) -C $(*D)
$(LIBS): %.a: ALWAYS
$(MAKE) -C $(*D)
.PHONY: ALWAYS
clean:
$(foreach dir,$(SUBDIRS),make -C $(dir) clean)
rm -f $(OBJS)
rm -f $(DEPS)
rm -f $(TARGET)
rm -f TAGS
.PHONY: TAGS
TAGS:
find . -name \*.[ch] | etags -
-include $(DEPS)
print-%:
echo $($*)