# usage: make -f linuxMakeFile64 all

# sudo cc -g -Wall `pkg-config --libs --cflags dbus-1` -o dbus-example-02 dbus-example-02.c

# rgf, 20210602 from <http://maemo.org/development/training/maemo_platform_development_content/plain_html/node10/>
#
# Simple Makefile for the libdbus example that will send the "Display
# Note dialog" RPC message. You need to run the example in the SDK or
# a compatible device.
#

# Define a list of pkg-config packages we want to use
pkg_packages := dbus-1

PKG_CFLAGS  := $(shell pkg-config --cflags $(pkg_packages))
PKG_LDFLAGS := $(shell pkg-config --libs $(pkg_packages))

# Additional flags for the compiler:
#    -g : Add debugging symbols
# -Wall : Enable most gcc warnings
# ADD_CFLAGS := -g -Wall
# ADD_CFLAGS := -Wall -DUNIX  -D__cplusplus
ADD_CFLAGS := -Wall -DUNIX


# Combine user supplied, additional, and pkg-config flags
CFLAGS  := $(PKG_CFLAGS) $(ADD_CFLAGS) $(CFLAGS)
LDFLAGS := $(PKG_LDFLAGS) $(LDFLAGS)

LINK_FLAGS = -shared -rdynamic -lpthread -lc  -lm

# rgf, 2011-06-11: "g++" must be defined explicitly
CC := g++ -fPIC
# rgf, 2011-08-11: create gdb debug infos temporarily
# CC := g++ -fPIC -g
# CC := g++ -fPIC -ggdb
RGF_CFLAGS64 := -DDBUSOOREXX_64 -m64
RGF_OUTPUTLIBNAME := libdbusoorexx.so

targets = dbusoorexx64

.PHONY: all clean

all: $(targets)

dbusoorexx64: dbusoorexx.cc
	$(CC) $(CFLAGS) $(RGF_CFLAGS64) $< -o lib$@.so $(LINK_FLAGS) $(LDFLAGS)
	cp -p lib$@.so $(RGF_OUTPUTLIBNAME)
	cp -p lib$@.so ../install/libs

clean:
	$(RM) libdbusoorexx64.so $(RGF_OUTPUTLIBNAME)


