OpenCores
URL https://opencores.org/ocsvn/minsoc/minsoc/trunk

Subversion Repositories minsoc

[/] [minsoc/] [trunk/] [sw/] [eth/] [Makefile] - Diff between revs 80 and 158

Only display areas with differences | Details | Blame | View Log

Rev 80 Rev 158
include ../support/Makefile.inc
include ../support/Makefile.inc
include $(BACKEND_DIR)/gcc-opt.mk
include $(BACKEND_DIR)/gcc-opt.mk
#USER INPUT
#USER INPUT
SRCS = eth.c
SRCS = eth.c
OR32_TARGET = eth.hex
OR32_TARGET = eth.hex
TARGET =
TARGET =
TARGETLIB =
TARGETLIB =
MODEL = static          #dynamic|static
MODEL = static          #dynamic|static
VERSION = 0.1
VERSION = 0.1
MODE = debug            #release|debug
MODE = debug            #release|debug
 
 
INCLUDEDIRS = $(BACKEND_DIR) $(SUPPORT_DIR) $(DRIVERS_DIR)
INCLUDEDIRS = $(SUPPORT_DIR) $(DRIVERS_DIR)
#libsystemc or systemc (system ignores lib at the beginning)
#libsystemc or systemc (system ignores lib at the beginning)
LIBNAMES =
LIBNAMES =
LIBDIRS =
LIBDIRS =
DEPENDDIR = ./depend
DEPENDDIR = ./depend
#CONFIGURATION
#CONFIGURATION
DEBUGPARAM =
DEBUGPARAM =
RELEASEPARAM =
RELEASEPARAM =
DEBUGFLAGS = -g -O0
DEBUGFLAGS = -g -O0
RELEASEFLAGS = -O2 -fomit-frame-pointer
RELEASEFLAGS = -O2 -fomit-frame-pointer
CFLAGS = -Wall
CFLAGS = -Wall
CC = or32-elf-gcc
CC = or32-elf-gcc
AR = or32-elf-ar
AR = or32-elf-ar
RANLIB = or32-elf-ranlib
RANLIB = or32-elf-ranlib
CFLAGS += $(GCC_OPT)
CFLAGS += $(GCC_OPT)
#MECHANICS
#MECHANICS
INCLUDESPATH = $(addprefix -I, $(INCLUDEDIRS))
INCLUDESPATH = $(addprefix -I, $(INCLUDEDIRS))
LIBSPATH = $(addprefix -L, $(LIBDIRS))
LIBSPATH = $(addprefix -L, $(LIBDIRS))
LIBSLINKAGE = $(addprefix -l, $(subst lib, , $(LIBNAMES)) )
LIBSLINKAGE = $(addprefix -l, $(subst lib, , $(LIBNAMES)) )
COMMA = ,
COMMA = ,
RPATH = $(addprefix -Wl$(COMMA)-R, $(LIBDIRS))
RPATH = $(addprefix -Wl$(COMMA)-R, $(LIBDIRS))
OBJS = $(addsuffix .o, $(basename $(SRCS)))
OBJS = $(addsuffix .o, $(basename $(SRCS)))
DEPS = $(addprefix $(DEPENDDIR)/, $(addsuffix .d, $(basename $(SRCS) ) ) )
DEPS = $(addprefix $(DEPENDDIR)/, $(addsuffix .d, $(basename $(SRCS) ) ) )
STATICLIB = $(addprefix lib, $(addsuffix .a, $(TARGETLIB) ) )
STATICLIB = $(addprefix lib, $(addsuffix .a, $(TARGETLIB) ) )
DYNAMICLIB = $(addprefix lib, $(addsuffix .so, $(TARGETLIB) ) )
DYNAMICLIB = $(addprefix lib, $(addsuffix .so, $(TARGETLIB) ) )
SONAME = $(addsuffix .$(VERSION), $(DYNAMICLIB))
SONAME = $(addsuffix .$(VERSION), $(DYNAMICLIB))
ifeq (debug,$(findstring debug, $(MODE)))
ifeq (debug,$(findstring debug, $(MODE)))
CFLAGS += $(DEBUGFLAGS) $(addprefix -D, $(DEBUGPARAM))
CFLAGS += $(DEBUGFLAGS) $(addprefix -D, $(DEBUGPARAM))
else
else
CFLAGS += $(RELEASEFLAGS) $(addprefix -D, $(RELEASEPARAM))
CFLAGS += $(RELEASEFLAGS) $(addprefix -D, $(RELEASEPARAM))
endif
endif
ifdef TARGETLIB
ifdef TARGETLIB
ifeq (dynamic,$(findstring dynamic, $(MODEL)))
ifeq (dynamic,$(findstring dynamic, $(MODEL)))
TARGET = $(DYNAMICLIB)
TARGET = $(DYNAMICLIB)
CFLAGS += -fPIC
CFLAGS += -fPIC
else
else
TARGET = $(STATICLIB)
TARGET = $(STATICLIB)
endif
endif
endif
endif
#MAKEFILE RULES
#MAKEFILE RULES
all: $(TARGET) $(OR32_TARGET)
all: $(TARGET) $(OR32_TARGET)
depend: $(DEPS)
depend: $(DEPS)
docs: Doxyfile
docs: Doxyfile
        doxygen
        doxygen
distclean:
distclean:
        make clean
        make clean
        rm -rf $(DEPENDDIR) Doxygen
        rm -rf $(DEPENDDIR) Doxygen
-include $(DEPS)
-include $(DEPS)
ifndef TARGETLIB
ifndef TARGETLIB
$(TARGET): $(OBJS)
$(TARGET): $(OBJS)
        $(CC) $(LIBSPATH) $(RPATH) -o $@ $^ $(LIBSLINKAGE)
        $(CC) $(LIBSPATH) $(RPATH) -o $@ $^ $(LIBSLINKAGE)
endif
endif
$(STATICLIB): $(OBJS)
$(STATICLIB): $(OBJS)
        $(AR) cru $@ $^
        $(AR) cru $@ $^
        $(RANLIB) $@
        $(RANLIB) $@
$(DYNAMICLIB): $(OBJS)
$(DYNAMICLIB): $(OBJS)
        $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
        $(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^
        ln -fs $@ $(SONAME)
        ln -fs $@ $(SONAME)
%.o: %.c
%.o: %.c
        $(CC) $(CFLAGS) $(INCLUDESPATH) -c $< -o $@
        $(CC) $(CFLAGS) $(INCLUDESPATH) -c $< -o $@
$(DEPENDDIR)/%.d: %.c
$(DEPENDDIR)/%.d: %.c
        mkdir -p $(DEPENDDIR)
        mkdir -p $(DEPENDDIR)
        $(CC) $(INCLUDESPATH) -MM -MF $@ $<
        $(CC) $(INCLUDESPATH) -MM -MF $@ $<
# DO NOT DELETE
# DO NOT DELETE
STEM = $(subst .hex, , $(OR32_TARGET))
STEM = $(subst .hex, , $(OR32_TARGET))
BINARY = $(addsuffix .bin, $(STEM) )
BINARY = $(addsuffix .bin, $(STEM) )
EXECUTABLE = $(addsuffix .or32, $(STEM) )
EXECUTABLE = $(addsuffix .or32, $(STEM) )
$(OR32_TARGET): $(BINARY)
$(OR32_TARGET): $(BINARY)
        $(BIN2HEX) $? 1 -size_word > $@
        $(BIN2HEX) $? 1 -size_word > $@
$(BINARY): $(EXECUTABLE)
$(BINARY): $(EXECUTABLE)
        $(OR32_TOOL_PREFIX)-objcopy -O binary $? $@
        $(OR32_TOOL_PREFIX)-objcopy -O binary $? $@
#except.o and reset.o should be already inside of $(SUPPORT) (libsupport.a) but for some reason the compiler ignores that fact
#except.o and reset.o should be already inside of $(SUPPORT) (libsupport.a) but for some reason the compiler ignores that fact
#(e.g. or32-elf-objdump -t libsupport.a shows it)
#(e.g. or32-elf-objdump -t libsupport.a shows it)
$(EXECUTABLE): $(OBJS) ../support/except.o ../support/reset.o $(SUPPORT) $(DRIVERS)
$(EXECUTABLE): $(OBJS) ../support/except.o ../support/reset.o $(SUPPORT) $(DRIVERS)
        $(CC) $(CFLAGS) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) $^ -o $@
        $(CC) $(CFLAGS) $(GCC_LIB_OPTS) -T $(LINKER_SCRIPT) $^ -o $@
clean:
clean:
        rm -f *.o *~ $(TARGET) $(STATICLIB) $(DYNAMICLIB) $(SONAME) $(OR32_TARGET) $(BINARY) $(EXECUTABLE)
        rm -f *.o *~ $(TARGET) $(STATICLIB) $(DYNAMICLIB) $(SONAME) $(OR32_TARGET) $(BINARY) $(EXECUTABLE)
#EOF
#EOF
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2020 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.