[78] | 1 | include $(MORPHEO_TOPLEVEL)/Makefile.tools |
---|
[82] | 2 | include $(MORPHEO_TOPLEVEL)/IPs/systemC/processor/Morpheo/Behavioural/Makefile.flags |
---|
[78] | 3 | |
---|
| 4 | #-----[ Directory ]---------------------------------------- |
---|
| 5 | DIR_TST = selftest |
---|
| 6 | DIR_INC = include |
---|
| 7 | DIR_SRC = src |
---|
| 8 | DIR_OBJ = obj |
---|
| 9 | DIR_BIN = bin |
---|
| 10 | |
---|
| 11 | #-----[ Compilation ]-------------------------------------- |
---|
| 12 | INCDIR = $(SYSTEMC_INCDIR_$(SIMULATOR)) \ |
---|
[81] | 13 | -I$(DIR_INC) \ |
---|
| 14 | -I../processor/Morpheo |
---|
[78] | 15 | |
---|
[81] | 16 | LIBDIR = $(SYSTEMC_LIBDIR_$(SIMULATOR)) |
---|
[78] | 17 | |
---|
[81] | 18 | LIBNAME = $(SYSTEMC_LIBNAME_$(SIMULATOR)) \ |
---|
| 19 | -lbfd |
---|
[78] | 20 | |
---|
[81] | 21 | FLAGS = $(SYSTEMC_CFLAGS_$(SIMULATOR)) |
---|
[78] | 22 | |
---|
[81] | 23 | MORPHEO_CC_FLAGS = $(MORPHEO_FLAGS) $(CC_FLAGS) $(INCDIR) |
---|
| 24 | MORPHEO_CXX_FLAGS = $(MORPHEO_FLAGS) $(CXX_FLAGS) $(FLAGS) $(INCDIR) |
---|
| 25 | MORPHEO_L_FLAGS = $(MORPHEO_FLAGS) $(CXX_FLAGS) $(FLAGS) $(LIBDIR) |
---|
| 26 | |
---|
[78] | 27 | #-----[ Variable ]----------------------------------------- |
---|
| 28 | |
---|
| 29 | ENTITY = `$(BASENAME) $$PWD` |
---|
| 30 | |
---|
[81] | 31 | OBJECTS = $(patsubst $(DIR_SRC)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.cpp)) \ |
---|
| 32 | $(patsubst $(DIR_SRC)/%.c,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.c)) |
---|
[78] | 33 | OBJECTS_BIN = $(patsubst $(DIR_TST)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_TST)/*.cpp)) |
---|
| 34 | |
---|
| 35 | HEADERS = $(wildcard $(DIR_INC)/*.h) |
---|
| 36 | |
---|
| 37 | EXE = $(DIR_BIN)/soft.x |
---|
| 38 | |
---|
[81] | 39 | EXEC_PREFIX = |
---|
| 40 | #$(VALGRIND) |
---|
| 41 | |
---|
[78] | 42 | #-----[ Rules ]-------------------------------------------- |
---|
| 43 | |
---|
| 44 | .PRECIOUS : $(DIR_OBJ)/%.o $(DIR_BIN)/%.x |
---|
| 45 | |
---|
| 46 | test_env : |
---|
[81] | 47 | @\ |
---|
| 48 | $(ECHO) "-------------------| $(ENTITY)" |
---|
[78] | 49 | |
---|
| 50 | $(DIR_OBJ)/%.o : $(DIR_SRC)/%.cpp $(HEADERS) |
---|
| 51 | @\ |
---|
| 52 | $(ECHO) "Compilation : $*";\ |
---|
[81] | 53 | $(DISTCXX) $(MORPHEO_CXX_FLAGS) -c -o $@ $<; |
---|
[78] | 54 | |
---|
[81] | 55 | $(DIR_OBJ)/%.o : $(DIR_SRC)/%.c $(HEADERS) |
---|
| 56 | @\ |
---|
| 57 | $(ECHO) "Compilation : $*";\ |
---|
| 58 | $(DISTCC) $(MORPHEO_CC_FLAGS) -c -o $@ $<; |
---|
| 59 | |
---|
[78] | 60 | $(DIR_OBJ)/%.o : $(DIR_TST)/%.cpp $(HEADERS) |
---|
| 61 | @\ |
---|
| 62 | $(ECHO) "Compilation : $*";\ |
---|
[81] | 63 | $(DISTCXX) $(MORPHEO_CXX_FLAGS) -c -o $@ $<; |
---|
[78] | 64 | |
---|
| 65 | $(DIR_BIN)/%.x : $(OBJECTS_DEPS) $(OBJECTS) $(OBJECTS_BIN) |
---|
| 66 | \ |
---|
| 67 | $(ECHO) "Compilation : $*";\ |
---|
[81] | 68 | $(CXX) $(MORPHEO_L_FLAGS) -o $@ $^ $(LIBNAME); |
---|
[78] | 69 | |
---|
| 70 | $(DIR_OBJ) : |
---|
| 71 | @\ |
---|
| 72 | $(ECHO) "Create directory : $@";\ |
---|
| 73 | $(MKDIR) $@ |
---|
| 74 | |
---|
| 75 | $(DIR_BIN) : |
---|
| 76 | @\ |
---|
| 77 | $(ECHO) "Create directory : $@";\ |
---|
| 78 | $(MKDIR) $@ |
---|
| 79 | |
---|
| 80 | |
---|
[81] | 81 | exe : all |
---|
[78] | 82 | @\ |
---|
[81] | 83 | export SYSTEMC=$(SYSTEMC_$(SIMULATOR)) ; $(EXEC_PREFIX) ./$(EXE) $(SYSTEMC_EXEC_PARAMS_$(SIMULATOR)) |
---|
[78] | 84 | |
---|
[81] | 85 | |
---|
| 86 | all_environment : test_env $(DIR_OBJ) $(DIR_BIN) |
---|
[78] | 87 | @\ |
---|
| 88 | $(MAKE) $(EXE) |
---|
| 89 | |
---|
[80] | 90 | environment_clean : |
---|
[78] | 91 | @\ |
---|
| 92 | $(ECHO) "Delete temporary files in directory "$(PWD);\ |
---|
| 93 | $(RM) *~ \ |
---|
| 94 | $(DIR_OBJ) \ |
---|
| 95 | $(DIR_BIN) \ |
---|
| 96 | $(DIR_TST)/*~ \ |
---|
| 97 | $(DIR_SRC)/*~ \ |
---|
[81] | 98 | $(DIR_INC)/*~ \ |
---|
| 99 | *.dot \ |
---|
| 100 | *.txt; |
---|
[78] | 101 | |
---|
[80] | 102 | environment_help : |
---|
[78] | 103 | @\ |
---|
[80] | 104 | $(ECHO) " -----[ Environment ]------------------------------";\ |
---|
[78] | 105 | $(ECHO) "";\ |
---|
| 106 | $(ECHO) " * test_env : test if environnment's variable is set";\ |
---|
[80] | 107 | $(ECHO) " * all_environment : generate object";\ |
---|
[78] | 108 | $(ECHO) ""; |
---|