From d662c7da2ac2d9fb400f59ffce1624035dd8bf2f Mon Sep 17 00:00:00 2001 From: hadaq Date: Thu, 4 Feb 2010 20:57:13 +0000 Subject: [PATCH] update --- libtrbnet/Makefile | 97 ++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 50 deletions(-) diff --git a/libtrbnet/Makefile b/libtrbnet/Makefile index 88475bc..c3303b8 100644 --- a/libtrbnet/Makefile +++ b/libtrbnet/Makefile @@ -1,94 +1,91 @@ +# ------------ Compiler / Linker Options ------------------------------- + AXIS_USABLE_LIBS = UCLIBC GLIBC include $(AXIS_TOP_DIR)/tools/build/Rules.axis -CFLAGS = -pipe -g -Wall -Winline -O3 -finline-functions -finline-limit=600000 #-DHEXMODE - -CPPFLAGS = - INCDIR = -I. +CPPFLAGS = #-DHEXMODE +CFLAGS = -pipe -g -Wall -Winline -O3 -finline-functions -finline-limit=600000 + +LD = $(CC) LDFLAGS = LIBDIR = -L. LOADLIBES = -ltrbnet -# ------------ Libaries ------------------------------------------------ - -AR = ar-cris -ARFLAGS = -srv - -# ------------ Install ------------------------------------------------- - -BIN.OBJS = -LIB.OBJS = -INC.OBJS = - -BIN_DIR = -LIB_DIR = -INC_DIR = - -# ------------ Objects ------------------------------------------------- +# ------------ TARGETS ------------------------------------------------- TARGETS = trbcmd trbdhcp -trbcmd.OBJS = trbcmd.o - -trbdhcp.OBJS = trbdhcp.o - -# ------------ Library-Objects ---------------------------------------- - LIB_TARGETS = libtrbnet.a -libtrbnet.OBJS = trberror.o trbnet.o +# ------------ Libaries ------------------------------------------------ -# ------------ Suffix Rules ------------------------------------------- +AR = ar-cris +ARFLAGS = -srv -.SUFFIXES: +# ------------ Pattern Rules ------------------------------------------- -# ----- C Code --------- +# C Code: %.o: %.c - $(CC) $< -c $(CPPFLAGS) $(CFLAGS) $(INCDIR) -o $@ - -.SUFFIXES: .o .c + $(CC) $< -c $(CFLAGS) $(CPPFLAGS) $(INCDIR) -o $@ -# ------------ Targets ------------------------------------------------- +# C++ Code: +%.o: %.cpp + $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS) $(INCDIR) -o $@ -all: $(TARGETS) $(LIB_TARGETS) +%.o: %.cc + $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS) $(INCDIR) -o $@ -trbcmd: $(trbcmd.OBJS) libtrbnet.a - @echo LINKING $@ - $(CC) $(trbcmd.OBJS) $(LDFLAGS) $(LIBDIR) $(LOADLIBES) -o $@ - @echo DONE! +%.o: %.C + $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS) $(INCDIR) -o $@ -trbdhcp: $(trbdhcp.OBJS) libtrbnet.a +# C/C++ Objects (set LD accordingly) +%: %.o @echo LINKING $@ - $(CC) $(trbdhcp.OBJS) $(LDFLAGS) $(LIBDIR) $(LOADLIBES) -o $@ + $(LD) $^ $(LDFLAGS) $(LIBDIR) $(LOADLIBES) -o $@ @echo DONE! -libtrbnet.a: $(libtrbnet.OBJS) +# Libaries +%.a: $% @echo CREATING library $@ $(AR) $(ARFLAGS) $@ $^ @echo DONE! -lib: $(LIB_TARGETS) +%.so: $% + @echo CREATING shared library $@ + $(LD) -shared -O $^ -o $@ + @echo DONE! -distclean: clean - rm -f $(TARGETS) $(LIB_TARGETS) - rcsclean -u +# ------------ 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) + rcsclean -u + +.PHONY: depend depend: - $(CC) -MM $(CFLAGS) $(CPPFLAGS) *.c + $(CC) -MM $(CFLAGS) $(CPPFLAGS) $(INCDIR) *.c # ------------ Dependencies -------------------------------------------- -trberror.o: trberror.h trberror.c +trberror.o: trberror.c trberror.h -trbnet.o: trbnet.h trbnet.c trberror.h +trbnet.o: trbnet.c trberror.h trbnet.h +libtrbnet.a: trberror.o trbnet.o + +trbcmd: trbcmd.o trbcmd.o: trbcmd.c trbnet.h trberror.h +trbdhcp: trbdhcp.o trbdhcp.o: trbdhcp.c trbnet.h trberror.h - -- 2.43.0