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