blob: dadffc52f1d307c04454211ccbedf13bfbde1f24 (
plain) (
blame)
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
|
# Common definitions for making shared objects.
#
# Note: $(ROOT)/config.mk must be included before this file.
#
# The includer should probably define SO and TARGET and may also want to define
# EXTRA_HDRS and EXTRA_OBJS and extend CLEANFILES.
HDRS := $(sort $(wildcard *.h)) $(EXTRA_HDRS)
SRCS := $(sort $(wildcard *.c))
OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS)
.PHONY: all
all: $(TARGET)
%.o : %.c $(HDRS) $(ROOT)/config.mk
$(CC) $(SO_CFLAGS) $(CFLAGS) $(INCLUDE) -c $< -o $@
$(SO): $(OBJS) $(ROOT)/config.mk
$(CC) $(SO_LDFLAGS) -shared $(LDFLAGS) -o $@ $(OBJS) -ldl
.PHONY: clean
clean:; rm -fr $(SO) $(CLEANFILES)
.PHONY: distclean
distclean: clean
|