commit cdf296e

Michael Forney  ·  2013-11-20 01:23:30 +0000 UTC
parent 58ce446
Move compile/link rules to Makefile.common
4 files changed,  +15, -20
+6, -0
 1@@ -12,5 +12,11 @@ install-$(dir):
 2 .deps/$(dir):
 3 	@mkdir -p "$@"
 4 
 5+$(dir)/%.o: $(dir)/%.c | .deps/$(dir)
 6+	$(compile) $($(@D)_CFLAGS) $($(@D)_PACKAGE_CFLAGS)
 7+
 8+$(dir)/%.lo: $(dir)/%.c | .deps/$(dir)
 9+	$(compile) -fPIC $($(@D)_CFLAGS) $($(@D)_PACKAGE_CFLAGS)
10+
11 CLEAN_FILES += $($(dir)_TARGETS)
12 
+4, -4
 1@@ -27,8 +27,8 @@ SWC_PACKAGES    =   \
 2 LAUNCH_PACKAGES =   \
 3     libdrm
 4 
 5-SWC_PACKAGE_CFLAGS      = $$($(PKG_CONFIG) --cflags $(SWC_PACKAGES))
 6-SWC_PACKAGE_LIBS        = $$($(PKG_CONFIG) --libs $(SWC_PACKAGES))
 7-LAUNCH_PACKAGE_CFLAGS   = $$($(PKG_CONFIG) --cflags $(LAUNCH_PACKAGES))
 8-LAUNCH_PACKAGE_LIBS     = $$($(PKG_CONFIG) --libs $(LAUNCH_PACKAGES))
 9+libswc_PACKAGE_CFLAGS   = $$($(PKG_CONFIG) --cflags $(SWC_PACKAGES))
10+libswc_PACKAGE_LIBS     = $$($(PKG_CONFIG) --libs $(SWC_PACKAGES))
11+launch_PACKAGE_CFLAGS   = $$($(PKG_CONFIG) --cflags $(LAUNCH_PACKAGES))
12+launch_PACKAGE_LIBS     = $$($(PKG_CONFIG) --libs $(LAUNCH_PACKAGES))
13 
+2, -5
 1@@ -4,11 +4,8 @@ dir := launch
 2 
 3 $(dir)_TARGETS := $(dir)/swc-launch
 4 
 5-$(dir)/launch.o: $(dir)/launch.c
 6-	$(compile) $(LAUNCH_PACKAGE_CFLAGS)
 7-
 8-$(dir)/swc-launch: $(dir)/launch.o $(dir)/protocol.static.o
 9-	$(link) $(LAUNCH_PACKAGE_LIBS)
10+$(dir)/swc-launch: $(dir)/launch.o $(dir)/protocol.o
11+	$(link) $(launch_PACKAGE_LIBS)
12 
13 check-dependencies-$(dir):
14 	$(call check_deps,swc-launch,$(LAUNCH_PACKAGES))
+3, -11
 1@@ -51,25 +51,17 @@ SWC_SOURCES +=                      \
 2     libswc/shell_surface.c          \
 3     libswc/binding.c
 4 
 5-SWC_SHARED_OBJECTS = $(SWC_SOURCES:%.c=%.shared.o)
 6-SWC_STATIC_OBJECTS = $(SWC_SOURCES:%.c=%.static.o)
 7+SWC_STATIC_OBJECTS = $(SWC_SOURCES:%.c=%.o)
 8+SWC_SHARED_OBJECTS = $(SWC_SOURCES:%.c=%.lo)
 9 
10 # Explicitly state dependencies on generated files
11 $(dir)/drm.c $(dir)/drm_buffer.c: protocol/wayland-drm-server-protocol.h
12 
13-%.shared.o: %.c
14-	@mkdir -p .deps/$(dir $@)
15-	$(compile) -fPIC $(SWC_PACKAGE_CFLAGS)
16-
17-%.static.o: %.c
18-	@mkdir -p .deps/$(dir $@)
19-	$(compile) $(SWC_PACKAGE_CFLAGS)
20-
21 $(dir)/libswc.a: $(SWC_STATIC_OBJECTS)
22 	$(call quiet,AR) cru $@ $^
23 
24 $(dir)/$(LIBSWC_LIB): $(SWC_SHARED_OBJECTS)
25-	$(link) -shared -Wl,-soname,$(LIBSWC_SO) $(SWC_PACKAGE_LIBS)
26+	$(link) -shared -Wl,-soname,$(LIBSWC_SO) $(libswc_PACKAGE_LIBS)
27 
28 $(dir)/$(LIBSWC_SO): $(dir)/$(LIBSWC_LIB)
29 	$(call quiet,SYM,ln -sf) $(notdir $<) $@