From: hadaq Date: Thu, 13 Oct 2011 22:50:24 +0000 (+0000) Subject: Makefiel to be used when compiling library for the TRB3 GBIT board X-Git-Tag: v6.0~121 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=500297b3702d043c7549e224f981ee43d6f173b9;p=trbnettools.git Makefiel to be used when compiling library for the TRB3 GBIT board --- diff --git a/libtrbnet/Makefile.gbit b/libtrbnet/Makefile.gbit new file mode 100644 index 0000000..6077656 --- /dev/null +++ b/libtrbnet/Makefile.gbit @@ -0,0 +1,113 @@ +# ------------ Compiler / Linker Options ------------------------------- + +ifeq ($(shell uname -m), x86_64) + CPPFLAGS = -DX86_64 -DGBIT +else + CPPFLAGS = -DGBIT +endif + +CC = gcc +INCDIR = -I. +CPPFLAGS += #-DTRB_DEBUGGER #-DHEXMODE + +CFLAGS = -pipe -g -Wall -Winline -O3 -fPIC -finline-functions -finline-limit=600000 + +LD = $(CC) +LDFLAGS = +LIBDIR = +LOADLIBES = + +# ------------ TARGETS ------------------------------------------------- + +TARGETS = trbcmd trbdhcp trbflash + +LIB_TARGETS = libtrbnet.a + +# ------------ Libaries ------------------------------------------------ + +ifeq ($ARCH, crisv32) + AR = ar-cris +else + AR = ar +endif +ARFLAGS = -srv + +# ------------ Pattern Rules ------------------------------------------- + +# C Code: +%.o: %.c + $(CC) $< -c $(CFLAGS) $(CPPFLAGS) $(INCDIR) -o $@ + +# C++ Code: +%.o: %.cpp + $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS) $(INCDIR) -o $@ + +%.o: %.cc + $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS) $(INCDIR) -o $@ + +%.o: %.C + $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS) $(INCDIR) -o $@ + +# C/C++ Objects (set LD accordingly) +%: %.o + @echo LINKING $@ + $(LD) $^ $(LDFLAGS) $(LIBDIR) $(LOADLIBES) -o $@ + @echo DONE! + +# Libaries +%.a: $% + @echo CREATING library $@ + $(AR) $(ARFLAGS) $@ $^ + @echo DONE! + +%.so: $% + @echo CREATING shared library $@ + $(LD) -shared -O $^ -o $@ + @echo DONE! + +# ------------ Targets ------------------------------------------------- + +.PHONY: all +all: $(LIB_TARGETS) $(TARGETS) + +.PHONY: clean +clean: + rm -f *.o core core.* + rcsclean + +.PHONY: distclean +distclean: clean + rm -f $(TARGETS) $(LIB_TARGETS) + find . -type l -exec rm {} \; + rcsclean -u + +.PHONY: depend +depend: + $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(INCDIR) *.c + +# ------------ Dependencies -------------------------------------------- + +ifndef AXIS_TOP_DIR +pexor_user.h: + ln -s ../pexor/kernel-module/pexor_user.h + +trbnet.o: trbnet.c trberror.h trbnet.h pexor_user.h +else +trbnet.o: trbnet.c trberror.h trbnet.h +endif + +trberror.o: trberror.c trberror.h + +libtrbnet.a: trberror.o trbnet.o + +libtrbnet.so: trberror.o trbnet.o + +trbcmd: trbcmd.o libtrbnet.a +trbcmd.o: trbcmd.c trbnet.h trberror.h + +trbdhcp: trbdhcp.o libtrbnet.a +trbdhcp.o: trbdhcp.c trbnet.h trberror.h + +trbflash: trbflash.o libtrbnet.a +trbflash.o: trbflash.c +