[gtk+] examples: Clean up the standalone Makefiles
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] examples: Clean up the standalone Makefiles
- Date: Tue, 26 May 2015 17:02:36 +0000 (UTC)
commit 9aae351487cc916e157a8e261f1bc3a7677dbfab
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue May 19 16:14:49 2015 +0100
examples: Clean up the standalone Makefiles
Do not hardcode GCC as the compiler; use $(shell) expansion instead of
backticks; split the built source into its own variable.
examples/application1/Makefile.example | 6 +++---
examples/application10/Makefile.example | 17 +++++++++--------
examples/application2/Makefile.example | 15 ++++++++-------
examples/application3/Makefile.example | 15 ++++++++-------
examples/application4/Makefile.example | 15 ++++++++-------
examples/application5/Makefile.example | 17 +++++++++--------
examples/application6/Makefile.example | 17 +++++++++--------
examples/application7/Makefile.example | 17 +++++++++--------
examples/application8/Makefile.example | 17 +++++++++--------
examples/application9/Makefile.example | 17 +++++++++--------
10 files changed, 81 insertions(+), 72 deletions(-)
---
diff --git a/examples/application1/Makefile.example b/examples/application1/Makefile.example
index 7b99cb5..ffab3d4 100644
--- a/examples/application1/Makefile.example
+++ b/examples/application1/Makefile.example
@@ -1,7 +1,7 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
SRC = main.c exampleapp.c exampleappwin.c
diff --git a/examples/application10/Makefile.example b/examples/application10/Makefile.example
index 0561f77..917e3c7 100644
--- a/examples/application10/Makefile.example
+++ b/examples/application10/Makefile.example
@@ -1,13 +1,14 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
-GLIB_COMPILE_RESOURCES = `$(PKGCONFIG) --variable=glib_compile_resources gio-2.0`
-GLIB_COMPILE_SCHEMAS = `$(PKGCONFIG) --variable=glib_compile_schemas gio-2.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
+GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
+GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
-SRC = resources.c exampleapp.c exampleappwin.c exampleappprefs.c main.c
+SRC = exampleapp.c exampleappwin.c exampleappprefs.c main.c
+BUILT_SRC = resources.c
-OBJS = $(SRC:.c=.o)
+OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
all: exampleapp
@@ -29,6 +30,6 @@ exampleapp: $(OBJS) gschemas.compiled
clean:
rm -f org.gtk.exampleapp.gschema.valid
rm -f gschemas.compiled
- rm -f resources.c
+ rm -f $(BUILT_SRC)
rm -f $(OBJS)
rm -f exampleapp
diff --git a/examples/application2/Makefile.example b/examples/application2/Makefile.example
index f3d175f..c6f8293 100644
--- a/examples/application2/Makefile.example
+++ b/examples/application2/Makefile.example
@@ -1,12 +1,13 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
-GLIB_COMPILE_RESOURCES = `$(PKGCONFIG) --variable=glib_compile_resources gio-2.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
+GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
-SRC = resources.c exampleapp.c exampleappwin.c main.c
+SRC = exampleapp.c exampleappwin.c main.c
+BUILT_SRC = resources.c
-OBJS = $(SRC:.c=.o)
+OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
all: exampleapp
@@ -20,6 +21,6 @@ exampleapp: $(OBJS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
- rm -f resources.c
+ rm -f $(BUILT_SRC)
rm -f $(OBJS)
rm -f exampleapp
diff --git a/examples/application3/Makefile.example b/examples/application3/Makefile.example
index f3d175f..c6f8293 100644
--- a/examples/application3/Makefile.example
+++ b/examples/application3/Makefile.example
@@ -1,12 +1,13 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
-GLIB_COMPILE_RESOURCES = `$(PKGCONFIG) --variable=glib_compile_resources gio-2.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
+GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
-SRC = resources.c exampleapp.c exampleappwin.c main.c
+SRC = exampleapp.c exampleappwin.c main.c
+BUILT_SRC = resources.c
-OBJS = $(SRC:.c=.o)
+OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
all: exampleapp
@@ -20,6 +21,6 @@ exampleapp: $(OBJS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
- rm -f resources.c
+ rm -f $(BUILT_SRC)
rm -f $(OBJS)
rm -f exampleapp
diff --git a/examples/application4/Makefile.example b/examples/application4/Makefile.example
index 6a7f46b..97b2265 100644
--- a/examples/application4/Makefile.example
+++ b/examples/application4/Makefile.example
@@ -1,12 +1,13 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
-GLIB_COMPILE_RESOURCES = `$(PKGCONFIG) --variable=glib_compile_resources gio-2.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
+GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
-SRC = resources.c exampleapp.c exampleappwin.c main.c
+SRC = exampleapp.c exampleappwin.c main.c
+BUILT_SRC = resources.c
-OBJS = $(SRC:.c=.o)
+OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
all: exampleapp
@@ -20,6 +21,6 @@ exampleapp: $(OBJS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
- rm -f resources.c
+ rm -f $(BUILT_SRC)
rm -f $(OBJS)
rm -f exampleapp
diff --git a/examples/application5/Makefile.example b/examples/application5/Makefile.example
index ecfbe29..e667ebf 100644
--- a/examples/application5/Makefile.example
+++ b/examples/application5/Makefile.example
@@ -1,13 +1,14 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
-GLIB_COMPILE_RESOURCES = `$(PKGCONFIG) --variable=glib_compile_resources gio-2.0`
-GLIB_COMPILE_SCHEMAS = `$(PKGCONFIG) --variable=glib_compile_schemas gio-2.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
+GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
+GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
-SRC = resources.c exampleapp.c exampleappwin.c main.c
+SRC = exampleapp.c exampleappwin.c main.c
+BUILT_SRC = resources.c
-OBJS = $(SRC:.c=.o)
+OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
all: exampleapp
@@ -29,6 +30,6 @@ exampleapp: $(OBJS) gschemas.compiled
clean:
rm -f org.gtk.exampleapp.gschema.valid
rm -f gschemas.compiled
- rm -f resources.c
+ rm -f $(BUILT_SRC)
rm -f $(OBJS)
rm -f exampleapp
diff --git a/examples/application6/Makefile.example b/examples/application6/Makefile.example
index 418cc4d..eb9cff4 100644
--- a/examples/application6/Makefile.example
+++ b/examples/application6/Makefile.example
@@ -1,13 +1,14 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
-GLIB_COMPILE_RESOURCES = `$(PKGCONFIG) --variable=glib_compile_resources gio-2.0`
-GLIB_COMPILE_SCHEMAS = `$(PKGCONFIG) --variable=glib_compile_schemas gio-2.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
+GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
+GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
-SRC = resources.c exampleapp.c exampleappwin.c exampleappprefs.c main.c
+SRC = exampleapp.c exampleappwin.c exampleappprefs.c main.c
+BUILT_SRC = resources.c
-OBJS = $(SRC:.c=.o)
+OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
all: exampleapp
@@ -29,6 +30,6 @@ exampleapp: $(OBJS) gschemas.compiled
clean:
rm -f org.gtk.exampleapp.gschema.valid
rm -f gschemas.compiled
- rm -f resources.c
+ rm -f $(BUILT_SRC)
rm -f $(OBJS)
rm -f exampleapp
diff --git a/examples/application7/Makefile.example b/examples/application7/Makefile.example
index 0561f77..917e3c7 100644
--- a/examples/application7/Makefile.example
+++ b/examples/application7/Makefile.example
@@ -1,13 +1,14 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
-GLIB_COMPILE_RESOURCES = `$(PKGCONFIG) --variable=glib_compile_resources gio-2.0`
-GLIB_COMPILE_SCHEMAS = `$(PKGCONFIG) --variable=glib_compile_schemas gio-2.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
+GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
+GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
-SRC = resources.c exampleapp.c exampleappwin.c exampleappprefs.c main.c
+SRC = exampleapp.c exampleappwin.c exampleappprefs.c main.c
+BUILT_SRC = resources.c
-OBJS = $(SRC:.c=.o)
+OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
all: exampleapp
@@ -29,6 +30,6 @@ exampleapp: $(OBJS) gschemas.compiled
clean:
rm -f org.gtk.exampleapp.gschema.valid
rm -f gschemas.compiled
- rm -f resources.c
+ rm -f $(BUILT_SRC)
rm -f $(OBJS)
rm -f exampleapp
diff --git a/examples/application8/Makefile.example b/examples/application8/Makefile.example
index 0561f77..917e3c7 100644
--- a/examples/application8/Makefile.example
+++ b/examples/application8/Makefile.example
@@ -1,13 +1,14 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
-GLIB_COMPILE_RESOURCES = `$(PKGCONFIG) --variable=glib_compile_resources gio-2.0`
-GLIB_COMPILE_SCHEMAS = `$(PKGCONFIG) --variable=glib_compile_schemas gio-2.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
+GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
+GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
-SRC = resources.c exampleapp.c exampleappwin.c exampleappprefs.c main.c
+SRC = exampleapp.c exampleappwin.c exampleappprefs.c main.c
+BUILT_SRC = resources.c
-OBJS = $(SRC:.c=.o)
+OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
all: exampleapp
@@ -29,6 +30,6 @@ exampleapp: $(OBJS) gschemas.compiled
clean:
rm -f org.gtk.exampleapp.gschema.valid
rm -f gschemas.compiled
- rm -f resources.c
+ rm -f $(BUILT_SRC)
rm -f $(OBJS)
rm -f exampleapp
diff --git a/examples/application9/Makefile.example b/examples/application9/Makefile.example
index 0561f77..917e3c7 100644
--- a/examples/application9/Makefile.example
+++ b/examples/application9/Makefile.example
@@ -1,13 +1,14 @@
-CC = gcc
+CC ?= gcc
PKGCONFIG = $(shell which pkg-config)
-CFLAGS = `$(PKGCONFIG) --cflags gtk+-3.0`
-LIBS = `$(PKGCONFIG) --libs gtk+-3.0`
-GLIB_COMPILE_RESOURCES = `$(PKGCONFIG) --variable=glib_compile_resources gio-2.0`
-GLIB_COMPILE_SCHEMAS = `$(PKGCONFIG) --variable=glib_compile_schemas gio-2.0`
+CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
+LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
+GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
+GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
-SRC = resources.c exampleapp.c exampleappwin.c exampleappprefs.c main.c
+SRC = exampleapp.c exampleappwin.c exampleappprefs.c main.c
+BUILT_SRC = resources.c
-OBJS = $(SRC:.c=.o)
+OBJS = $(BUILT_SRC:.c=.o) $(SRC:.c=.o)
all: exampleapp
@@ -29,6 +30,6 @@ exampleapp: $(OBJS) gschemas.compiled
clean:
rm -f org.gtk.exampleapp.gschema.valid
rm -f gschemas.compiled
- rm -f resources.c
+ rm -f $(BUILT_SRC)
rm -f $(OBJS)
rm -f exampleapp
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]