[2] | 1 | # |
---|
| 2 | # $Id: Makefile.Common 97 2008-12-19 15:34:00Z rosiere $ |
---|
| 3 | # |
---|
[83] | 4 | # [ Description ] |
---|
[2] | 5 | # |
---|
| 6 | # Makefile |
---|
| 7 | # |
---|
| 8 | |
---|
[88] | 9 | ifeq ($(origin MORPHEO_TOPLEVEL), undefined) |
---|
| 10 | $(error "variable MORPHEO_TOPLEVEL is undefined"); |
---|
| 11 | else |
---|
| 12 | include $(MORPHEO_TOPLEVEL)/Makefile.tools |
---|
| 13 | endif |
---|
| 14 | ifeq ($(origin MORPHEO_TMP), undefined) |
---|
| 15 | $(error "variable MORPHEO_TMP is undefined"); |
---|
| 16 | endif |
---|
| 17 | ifeq ($(origin MORPHEO_SCRIPT), undefined) |
---|
| 18 | $(error "variable MORPHEO_SCRIPT is undefined"); |
---|
| 19 | endif |
---|
| 20 | ifeq ($(origin DIR_MORPHEO), undefined) |
---|
| 21 | $(error "variable DIR_MORPHEO is undefined"); |
---|
| 22 | endif |
---|
[15] | 23 | |
---|
[53] | 24 | #-----[ Directory ]---------------------------------------- |
---|
[88] | 25 | DIR_TMP = $(MORPHEO_TMP) |
---|
[2] | 26 | DIR_INC = include |
---|
| 27 | DIR_SRC = src |
---|
| 28 | DIR_OBJ = obj |
---|
[15] | 29 | DIR_SCRIPT = $(MORPHEO_SCRIPT) |
---|
[2] | 30 | |
---|
[53] | 31 | #-----[ Compilation ]-------------------------------------- |
---|
[15] | 32 | INCDIR = $(SYSTEMC_INCDIR_$(SIMULATOR)) \ |
---|
[85] | 33 | -I. \ |
---|
[2] | 34 | -I$(DIR_MORPHEO) |
---|
| 35 | |
---|
| 36 | LIBDIR = $(DIR_LIBRARY) \ |
---|
[62] | 37 | $(SYSTEMC_LIBDIR_$(SIMULATOR)) |
---|
| 38 | # $(OR1K_LIBDIR) |
---|
[2] | 39 | |
---|
[81] | 40 | LIBS = $(LIBRARY) -lm $(SYSTEMC_LIBNAME_$(SIMULATOR)) |
---|
[2] | 41 | |
---|
[81] | 42 | # $(OR1K_LIBNAME) -lbfd |
---|
[62] | 43 | |
---|
[15] | 44 | FLAGS_COMMON = $(SYSTEMC_CFLAGS_$(SIMULATOR)) \ |
---|
[78] | 45 | $(CXX_FLAGS) |
---|
[15] | 46 | |
---|
[55] | 47 | CFLAGS = $(MORPHEO_FLAGS) $(FLAGS_COMMON) $(INCDIR) |
---|
| 48 | LFLAGS = $(MORPHEO_FLAGS) $(FLAGS_COMMON) $(LIBDIR) |
---|
[2] | 49 | |
---|
[53] | 50 | #-----[ Variable ]----------------------------------------- |
---|
[88] | 51 | ENTITY = $$($(BASENAME) $$PWD) |
---|
[2] | 52 | |
---|
| 53 | OBJECTS_COMMON = $(patsubst $(DIR_SRC)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_SRC)/*.cpp)) |
---|
| 54 | |
---|
| 55 | HEADERS = $(wildcard $(DIR_INC)/*.h) |
---|
| 56 | |
---|
[53] | 57 | #-----[ Rules ]-------------------------------------------- |
---|
[2] | 58 | .PRECIOUS : $(DIR_OBJ)/%.o |
---|
| 59 | |
---|
| 60 | test_env : |
---|
[83] | 61 | @$(ECHO) "-------------------| $(ENTITY)" |
---|
[2] | 62 | |
---|
[83] | 63 | |
---|
[2] | 64 | $(DIR_OBJ)/%.o : $(DIR_SRC)/%.cpp $(HEADERS) |
---|
[48] | 65 | @\ |
---|
| 66 | $(ECHO) "Compilation : $*";\ |
---|
| 67 | $(CXX) $(CFLAGS) -c -o $@ $<; |
---|
[2] | 68 | |
---|
| 69 | $(DIR_OBJ) : |
---|
[48] | 70 | @\ |
---|
| 71 | $(ECHO) "Create directory : $@";\ |
---|
| 72 | $(MKDIR) $@ |
---|
[2] | 73 | |
---|
| 74 | common_clean : |
---|
[48] | 75 | @\ |
---|
[83] | 76 | $(ECHO) "Delete temporary files in directory $(PWD)";\ |
---|
[48] | 77 | $(RM) $(DIR_OBJ) \ |
---|
[2] | 78 | $(DIR_BIN) \ |
---|
| 79 | *~ \ |
---|
| 80 | $(DIR_SRC)/*~ \ |
---|
[48] | 81 | $(DIR_INC)/*~; |
---|
[2] | 82 | |
---|
[88] | 83 | common_clean_all : common_clean |
---|
| 84 | |
---|
[2] | 85 | common_help : |
---|
[48] | 86 | @\ |
---|
[53] | 87 | $(ECHO) " -----[ Common ]-------------------------------------";\ |
---|
[48] | 88 | $(ECHO) "";\ |
---|
| 89 | $(ECHO) " * test_env : test if environnment's variable is set";\ |
---|
| 90 | $(ECHO) ""; |
---|