Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2008-09-22 14:28:12 -0400
committereutarass2008-09-22 14:28:12 -0400
commita3e68f01b6d211fc5832e695037a562a7a65af2d (patch)
tree8ce854545c847075c20b5e1373b768bf617337c1 /examples
parent6b640dd701f8793fb43f2cdd4f8721c0342af80e (diff)
downloadorg.eclipse.tcf-a3e68f01b6d211fc5832e695037a562a7a65af2d.tar.gz
org.eclipse.tcf-a3e68f01b6d211fc5832e695037a562a7a65af2d.tar.xz
org.eclipse.tcf-a3e68f01b6d211fc5832e695037a562a7a65af2d.zip
Better support for TCF Agent portability:
1. Changed TCF Agent Makefile to use different output directories for different build targets. 2. Agent binary files are now created in "<OS name>/<CPU name>/<Debug|Release>" directories. 3. Changed agent CDT project file to include multiple build configurations: Cygwin Debug, Cygwin Release, Msys Debug, etc.
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile50
1 files changed, 32 insertions, 18 deletions
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile b/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile
index 6e4e99dd7..188feb701 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile
@@ -1,35 +1,49 @@
-CC=gcc
-CFLAGS=-g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -Wmissing-prototypes -I. -I../../agent -I-
+CONF=Debug
-CFILES=$(basename $(wildcard *.c)) $(basename $(notdir $(wildcard ../../agent/*.c)))
-OFILES=$(filter-out main%.o, $(addsuffix .o, $(CFILES)))
-HFILES=$(wildcard *.h) $(wildcard ../../agent/*.h) Makefile
-
-EXES=agent
-
-UNAME=$(shell uname -o)
+CC=gcc
+ifeq ($(CONF),Debug)
+CFLAGS=-g
+else
+CFLAGS=-O
+endif
+CFLAGS:=$(CFLAGS) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -Wmissing-prototypes -I. -I../../agent -I-
-ifeq ($(UNAME),Cygwin)
+OPSYS=$(shell uname -o)
+MACHINE=$(shell uname -m)
+ifeq ($(OPSYS),Cygwin)
LIBS=-lws2_32 -liphlpapi
else
-ifeq ($(UNAME),Msys)
+ifeq ($(OPSYS),Msys)
CFLAGS:=-mwin32 $(CFLAGS)
LIBS=-lws2_32 -liphlpapi
else
-LIBS=-lpthread -lrt -lelf
+LIBS=-lpthread -lrt
endif
endif
-all: $(EXES)
+BINDIR=$(OPSYS)/$(MACHINE)/$(CONF)
+
+CFILES=$(basename $(wildcard *.c)) $(basename $(notdir $(wildcard ../../agent/*.c)))
+OFILES=$(addprefix $(BINDIR)/,$(filter-out main%.o, $(addsuffix .o, $(CFILES))))
+HFILES=$(wildcard *.h) $(wildcard ../../agent/*.h) Makefile
+
+EXECS=$(BINDIR)/agent
+
+all: $(EXECS)
+
+$(BINDIR)/libtcf.a : $(OFILES)
+ ar -rc $@ $(OFILES)
-agent: main.o $(OFILES)
- $(CC) $(CFLAGS) -o $@ main.o $(OFILES) $(LIBS)
+$(BINDIR)/agent: $(BINDIR)/main.o $(BINDIR)/libtcf.a
+ $(CC) $(CFLAGS) -o $@ $(BINDIR)/main.o $(BINDIR)/libtcf.a $(LIBS)
-%.o: %.c $(HFILES)
+$(BINDIR)/%.o: %.c $(HFILES) $(BINDIR)
+ @mkdir -p $(BINDIR)
$(CC) $(CFLAGS) -c -o $@ $<
-%.o: ../../agent/%.c $(HFILES)
+$(BINDIR)/%.o: ../../agent/%.c $(HFILES)
+ @mkdir -p $(BINDIR)
$(CC) $(CFLAGS) -c -o $@ $<
clean:
- rm -f *.o $(EXES)
+ rm -rf $(BINDIR)

Back to the top