/ Forside / Teknologi / Operativsystemer / Linux / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
Linux
#NavnPoint
o.v.n. 11177
peque 7911
dk 4814
e.c 2359
Uranus 1334
emesen 1334
stone47 1307
linuxrules 1214
Octon 1100
10  BjarneD 875
makefile problems
Fra : Jokaas


Dato : 16-04-03 23:05

Hi folks !
Regarding a standard (almost) makefile - I have a problem ...
I'm having a hole directory structure (tree) to process for compiling a
larger project, I have got some problems regarding the makefiles, I cant
solve.
I have inserted the make file for better understanding (this make file only
process current directory)...

My problems are:
1) adding a '@' would normally be a "quiet" command. but fails here
2) wants to assemble assembler files (suffix .s or .asm), this seams not to
work

Brief description of the make file first.
The make file processes automatically the .d (dependencies files).
This part work fine for .c and .cc files. The .d files is generated, and
added at the top for automatially dependency check.
But when it comes to .s files it flops - no assembling takes place - the
echo"" are not activated....
This was problem 2)

Problem 1 is quite mysterious for me too!
I have noramlly added and '@' in front of the comamnds to silince them ...
This seams not to work ... that'll be the comamnd is not executed.
So why this ?

any of you who could help me out on this ?

Thanks in advance
J

<makefile.mak>
#-------------------------------------------------------------------
# if this is set to '@' no extra debug info comes out
#WARNING enabling this results in a error -- dont know why ?!?!?!?!
NOMAKEDEBUG =
NOMAKEDEBUG1 = @

#-------------------------------------------------------------------
#include common settings file
include $(DIR_COMMON_PREFIX)/inc/common.inc

#-------------------------------------------------------------------
# std. settings
..PHONY : lib
..DEFAULT : help
PWD.sh=pwd

#-------------------------------------------------------------------
# find all relevant source files and build the list of object files
# missing cc here ??
PART_SRC = $(shell echo *.c)
ALL_SRC = $(PART_SRC)
ALL_OBJS = $(ALL_SRC:.c=.o)

#-------------------------------------------------------------------
# specific section
SIDE=.
THISLIB = system_boot.a
DEPEND = $(ALL_OBJS:.o=.d)
OBJS = $(foreach file,$(ALL_OBJS),$(SIDE)/$(file))

#---------------------------------------------------------
# make special arrangement with the compilation of RTOS
DEFINES_LOC = -DLOCAL_ON

INCLUDE = -I./ -I../inc -I$(RTOS_ENV_INC)

# ----------------------- include dependencies section ----------------
# here we include dependencies from all the source files, which has been
# processed previously
include $(DEPEND)

#-------------- have tried this too - no sucess
# init.o : init.s
# echo "kdjghdjklsg"
#
#
# -------------------------------------------------------- done ---


#--------------------------------------------------------------------
GLOBAL_LIB = $(COMMON_PREFIX)/lib
GLOBAL_LIBPLAT = $(GLOBAL_LIB)/$(PLATFORM)/
THIS_GLOBAL_LIB = $(GLOBAL_LIBPLAT)$(THISLIB)

#-------------------------------------------------------------------
# rules
# Clean all SUFFIXES
..SUFFIXES:

# Define our own SUFFIXES
..SUFFIXES: .s .c .cc .o .h

#----------------- explanations --------------------------------------
# -o outputfilename
# -c dont link - just compiler/assemble
# $@ filename of target
# $< The name of the first prerequisite
#
# example $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
# put '@' in front of a line if it should be quitely executed

# -------------- this is how to compile or assemble a file....
..c.o:
@echo "Compiling: In:'$@' Out:'$<'"
@echo
"---------------------------------------------------------------------------
------"
$(NOMAKEDEBUG)$(CC) -o $@ $(CFLAGS) $(INCLUDE) $(DEFINES)
(DEFINES_LOC) -c $<
@echo ""

..s.o:
@echo "Assembling: In:'$@' Out:'$<'"
@echo
"---------------------------------------------------------------------------
------"
@echo ""
# $(NOMAKEDEBUG)$(CC) -o $@ $(CFLAGS) -c $(INCLUDE) $(DEFINES)
$(DEFINES_LOC) -c $<



#---------------- This is to make dependencies file .c -----------------
# Defines how to make a %.d from a %.c file
%.d: %.c
@echo "Dependencies(%.c): In:'$@' Out:'$<'"
@echo
"---------------------------------------------------------------------------
------"
$(NOMAKEDEBUG)$(SHELL) -ec '$(CC) -MM $(CFLAGS) $(INCLUDE) $(DEFINES)
$(DEFINES_LOC) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
@echo ""


#---------------- This is to make dependencies file .cc ----------------
# Defines how to make a %.d from a %.cc file
%.d: %.cc
@echo "Dependencies(%.cc): In:'$@' Out:'$<'"
@echo
"---------------------------------------------------------------------------
------"
$(NOMAKEDEBUG)$(SHELL) -ec '$(CC) -MM $(CFLAGS) $(INCLUDE) $(DEFINES)
$(DEFINES_LOC) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
@echo ""


#-------------------------------------------------------------------
help : targets prefix

all : lib

targets:
@echo "With this make you can access the following targets"
@echo "all Make lib & program (if possible)"
@echo "lib Generate the libraries"
@echo "clean Sweep clean - not .depend"
@echo "cleanall Sweep clean - also .depend"
@echo ""


prog :
@echo "Warning : Not a valid option for this makefile"


depend : prefix
@echo "Dependencies are updated automatically !"


clean :
@echo
"---------------------------------------------------------------------------
------"
@echo "clean - Removing libs and obj"
$(RM) -f $(THISLIB) $(OBJS)
$(RM) -f *~


cleanall : clean
@echo
"---------------------------------------------------------------------------
------"
@echo "cleanall - Removing .dependencies"
$(RM) -f *.d


lib : objdir $(OBJS)
@echo "Making Library - $(THISLIB)"
$(NOMAKEDEBUG)$(AR) -r $(THISLIB) $(OBJS)
@echo ""
@echo "Copying to $(THIS_GLOBAL_LIB)"
$(NOMAKEDEBUG)$(CP) $(THISLIB) $(THIS_GLOBAL_LIB)
@echo
"---------------------------------------------------------------------------
------"
@echo ""


objdir :
@echo
"---------------------------------------------------------------------------
------"
@echo "objdir - Create obj directories for output (if needed!)"
$(NOMAKEDEBUG)(if [ ! -d $(SIDE) ]; then mkdir $(SIDE); fi)
$(NOMAKEDEBUG)(if [ ! -d $(GLOBAL_LIB) ]; then mkdir $(GLOBAL_LIB); fi)
$(NOMAKEDEBUG)(if [ ! -d $(GLOBAL_LIBPLAT) ]; then mkdir $(GLOBAL_LIBPLAT);
fi)
@echo
"---------------------------------------------------------------------------
------"

<end>



 
 
Søg
Reklame
Statistik
Spørgsmål : 177506
Tips : 31968
Nyheder : 719565
Indlæg : 6408562
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste