ProgrammingThis 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.
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.
# ---------------------------------
# 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}
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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.