field-theory.org
the blog of wolfram schroers

Source code — Makefile.orbit2

 1 #!/usr/bin/env make
 2 #
 3 # Orbit2 example program - The Protocol client, an implementation of a
 4 # logging facility that can receive messages from different processes
 5 # and even different machines. This file compiles and runs the client
 6 # for the Orbit2 ORB only. The source code is in C.
 7 #
 8 # This file only compiles the Orbit2 client. For the other clients use
 9 # the "Makefile.mico" and "Makefile.java" files!
10 #
11 # Written 2010 by Dr. W. Schroers, NuAS <http://www.field-theory.org>
12 #
13 # Published under the GPLv3, see file <gpl-3.0.txt>
14 #
15 
16 # NOTE: This Makefile has been used for Orbit2 v2.14.17 installed via
17 #       Fink (32-bit, unstable tree enabled) on MacOS X 10.6.4 On
18 #       different systems (or for non-standard Fink installations) you
19 #       HAVE to adjust the following directory!
20 
21 PREFIX = /sw
22 
23 
24 # The following settings work for Orbit2 v2.14.17. They will need to
25 # be adjusted for different CORBA implementations!
26 
27 ORBIT2-IDL = orbit-idl-2
28 ORBIT2-C = gcc
29 CFLAGS = -g -DORBIT2=1 -D_REENTRANT -I$(PREFIX)/include/orbit-2.0 \
30          -I$(PREFIX)/include/linc-1.0 -I$(PREFIX)/include/glib-2.0 \
31          -I$(PREFIX)/lib/glib-2.0/include -Wall -arch i386
32 LDFLAGS = -Wl --export-dynamic -L$(PREFIX)/lib -lORBit-2 -lgmodule-2.0 \
33           -ldl -lgobject-2.0 -lgthread-2.0 -lpthread -lglib-2.0 -lm
34 
35 
36 # The following are general commands and file dependencies 
37 
38 # General makefile command configuration
39 .PHONY: all clean clean-idl
40 .SUFFIXES:
41 .SUFFIXES: .idl .c .h .o
42 .SILENT:
43 
44 # IDL-file dependencies, targets and general commands
45 IDL-OBJS = protocol.h protocol-common.c protocol-stubs.c
46 TARGETS = client_orbit2
47 
48 # NOTE: The "clean-idl" target is necessary for an issue with mixing
49 # C++ and C-based ORBs - both create mutually incompatible files named
50 # "protocol.h". Thus, they cannot be mixed and the work-around makes
51 # sure that this never happens!
52 
53 all: clean-idl $(IDL-OBJS) $(TARGETS)
54 
55 clean: clean-idl
56 	printf "Cleaning up ..."
57 	\$(RM) *.o $(TARGETS) protocol-skels.c
58 	printf " done.\n"
59 
60 clean-idl:
61 	\$(RM) $(IDL-OBJS)
62 
63 client_orbit2: client_orbit2.o protocol-common.o protocol-stubs.o
64 	printf "Linking target $@ ..."
65 	$(ORBIT2-C) $(CFLAGS) -o $@ $+ $(LDFLAGS)
66 	printf " done.\n"
67 
68 $(IDL-OBJS): protocol.idl
69 	printf "Parsing IDL file $< ..."
70 	$(ORBIT2-IDL) $<
71 	printf " done.\n"
72 
73 # Specific dependencies
74 client_orbit2.o: client_orbit2.c protocol.h
75 protocol-common.o: protocol-common.c protocol.h
76 protocol-stubs.o: protocol-stubs.c protocol.h
77 
78 # Generic compilation command
79 %.o: %.c
80 	printf "Compiling file $< -> $@ ..."
81 	$(ORBIT2-C) $(CFLAGS) -c -o $@ $<
82 	printf " done.\n"