Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
12-31-2009, 12:27 PM
|
#31
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
Quote:
Originally Posted by Sergei Steshenko
As I already wrote, complexity of tutorials reflects real world mess.
|
What is that supposed to mean?
|
|
|
01-01-2010, 03:11 PM
|
#32
|
Senior Member
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515
|
here's one of my autogenerating makefiles...
Code:
# ---------------------------------
# Standard (GNU) makefile template
# will take each source file as a
# single source stand-alone
# ---------------------------------
# use this for setting variables e.g CFLAGS LDLIBS
# rather than editing this file
USER_FILE = user.mk
-include ${USER_FILE}
ECHO = @echo
ifndef EXT
ERROR: tidy
@echo
@echo " you need to define the filetype: 'EXT'"
@echo
@echo " i.e 'EXT = .c'"
@echo " or 'EXT = .cc'"
@echo " or 'EXT = .cpp'"
@echo
@echo " you can do it in '$(USER_FILE)'"
@echo
exit
endif
ifneq ($(EXT),.c)
CC = g++
endif
VARFILE = var.mk
DEPENDFILE = depend.mk
# if EXT is not defined we need to make it something silly so
# that ls doesn't pick up spurious stuff (see the VARFILE target)
EXT ?= EXT_file_extension_type_not_defined
-include ${VARFILE}
INCLUDES += -I${HOME}/include -I/usr/local/include
CFLAGS += -Wall ${INCLUDES}
CXXFLAGS += ${CFLAGS}
OBJFILES = ${SRC_FILES:${EXT}=.o}
TARGETS = ${SRC_FILES:${EXT}=}
.IGNORE:
ALL:${TARGETS} tidy
help: tidy
${ECHO} EXT = ${EXT}
${ECHO} CC = ${CC}
${ECHO} TARGETS = ${TARGETS}
${ECHO} OBJFILES = ${OBJFILES}
${ECHO} SRC_FILES = ${SRC_FILES}
RCS:
mkdir RCS
safe: RCS tidy
echo auto generated | ci -t/dev/null -l ${SRC_FILES} *.h
tidy:
ifeq (${MAKE_GZIPS},yes)
gzip -f ${DEPENDFILE} ${VARFILE}
endif
@rm -f ${DEPENDFILE} ${VARFILE}
clean: tidy
rm -f *.o ${RCSMESSAGE}
${ECHO} use 'purge' to get rid of programs
purge:clean
rm -f ${TARGETS}
rm -f ${DEPENDFILE}.gz ${VARFILE}.gz
${DEPENDFILE}:
@${CC} -M ${INCLUDES} *${EXT} > $@
${VARFILE}:
-@ls *${EXT} | xargs echo SRC_FILES= > $@
# generated dependencies (Needs to go late in the file)
-include ${DEPENDFILE}
|
|
|
01-01-2010, 07:55 PM
|
#33
|
Senior Member
Registered: May 2005
Posts: 4,481
|
Quote:
Originally Posted by MTK358
What is that supposed to mean?
|
Read the official GNU autotools documentation - it begins with detailed explanation of the above.
Also, consider carefully my simple example earlier in this thread:
http://www.linuxquestions.org/questi...73#post3808073
|
|
|
01-01-2010, 08:46 PM
|
#34
|
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078
Rep:
|
The real-world mess is that there are so many different implementations of POSIX that writing a build chain to work on more than one of them can be more work than the rest of the development process. Autotools is an attempt to offload those portability problems so that the developer can concentrate on programming, not on porting the build chain.
Kevin Barry
|
|
|
01-02-2010, 02:32 AM
|
#35
|
Senior Member
Registered: May 2005
Posts: 4,481
|
Quote:
Originally Posted by ta0kira
The real-world mess is that there are so many different implementations of POSIX that writing a build chain to work on more than one of them can be more work than the rest of the development process. Autotools is an attempt to offload those portability problems so that the developer can concentrate on programming, not on porting the build chain.
Kevin Barry
|
Yep.
|
|
|
All times are GMT -5. The time now is 05:30 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|