Jump to content

  • Log In with Google      Sign In   
  • Create Account

Anyone using the Gnu build tools system?

  • You cannot reply to this topic
2 replies to this topic

#1 Jastiv   Members   -  Reputation: 146

Like
0Likes
Like

Posted 18 August 2013 - 07:41 PM

I know a lot of people are using cmake now, but is anyone using autoconf, automake, libtool etc?

I'm using it, but I really don't understand it as well as I need to make changes in my projects server install process.  (client is Java, so it uses ANT)

 

You know software is using it if it comes with a

./configure

make

sudo make install

build process.



Sponsor:

#2 AllEightUp   Moderators   -  Reputation: 4211

Like
0Likes
Like

Posted 19 August 2013 - 02:09 PM

I use the autoconf stuff only for libraries which have no other build solutions.  So while I have some familiarity with the abilities, syntax and how they work I'm far from an expert.  The primary reason I have never dug into them is that they are virtually useless on Windows which is unfortunately still my primary working environment.  Using cygwin, msys etc to supply the tools is just not a very useful option when working in VC for most purposes.  So, when I run into libraries such as those, I usually wrap them with CMake to do the actual build and call the './configure' from CMake on the platforms where it is required.  For instance, GLog is my logging library of choice and on OsX/Linux it uses './configure', so I detect if the 'config.hpp' has been generated on those platforms, if not I call the './configure' to prepare the code but then compile the files through CMake, the reason being that I want the libraries embedded in my code and don't want to have to rely on pre-built versions which may have compiler flag differences and other such problems.

 

With all that said, if there is a specific problem you are having, ask away.  I'm not very good with those tools but can often muddle through figuring them out.. :)



#3 Shannon Barber   Moderators   -  Reputation: 1362

Like
0Likes
Like

Posted 01 February 2014 - 11:52 AM

I have setup several GNU-based build systems primary via cygwin.

I don't see much of a need for autoconf or automake anymore. They are legacy tools designed to support a wide range of broken POSIX systems.

I presume targeting IRIX & HP-UX are not priorities for you.

 

GNU make v4.0 corrects a number of subtle defects in the way make has worked in the past and it can handle complex projects pretty easy now.

I make sub-makefiles to handle stuff I resuse over-and-over.

 

I have a program.mk that knows how to build the current directory as a program.

I break out the toolchains into their own sub-makefiles. I target embedded stuff so this will need a bit of work for it to make sense for PC toolchains.

 

This is an excerpt from my program.mk file

PROGRAM=$(strip $(notdir $(CURDIR)))

# Find the source
ifeq ($(SRC_DIRS),)
SRC_DIRS=src $(patsubst %/.,%,$(wilcard src/*/.))
endif

ifeq ($(INC_DIRS),)
INC_DIRS=inc $(SRC_DIRS)
endif


CC_SRCS=$(filter-out $(XSRC_LIST),$(foreach SRC_DIR,$(SRC_DIRS), $(wildcard $(SRC_DIR)/*.c)))
AS_SRCS=$(filter-out $(XSRC_LIST),$(foreach SRC_DIR,$(SRC_DIRS), $(wildcard $(SRC_DIR)/*.s)))


SRCS=$(AS_SRCS) $(CC_SRCS)
CC_OBJS=$(subst src/,obj/,$(patsubst %.c,%.o,$(CC_SRCS)))
AS_OBJS=$(subst src/,obj/,$(patsubst %.s,%.o,$(AS_SRCS)))
OBJS=$(AS_OBJS) $(CC_OBJS)
OBJ_DIRS=$(sort $(dir $(OBJS)))
DEPS=$(patsubst obj/%.o,dep/%.dep,$(OBJS))
DEP_DIRS=$(subst obj/,dep/,$(OBJ_DIRS))


# Compiler/Toolchain selection
ifeq ($(VENDOR),)
$(warning Vendor is not set, choose from VENDOR={demo, microsoft, gnu}
include ../../sweng/toolchain/demo.mk
else
include ../../sweng/toolchain/$(VENDOR)-$(ARCH).mk
endif

OUTPUTS += $(PROGRAM).$(BINEXT): $(OBJS) OUTPUTS: $(OBJS)PHONY+=clean
XDEPGOALS+=clean
clean:
@rm -rf out obj lst log lnt dep
@printf "Cleaned $(BRED)%s$(NORMAL)/$(BGREEN)%s$(NORMAL) $(OKSTRING)\n" "$(TARGET)" "$(PROGRAM)"

build: prep $(filter clean cleanall,$(MAKECMDGOALS)) @$(MAKE) --no-print-directory $(OUTPUTS) @printf "Built $(BRED)%s$(NORMAL)/$(BGREEN)%s$(NORMAL) $(OKSTRING)\n" "$(TARGET)" "$(PROGRAM)".PHONY: $(PHONY)
.PRECIOUS: $(PRECIOUS)vpath src/%.h $(INC_DIRS) vpath src/%.c $(SRC_DIRS) vpath src/%.s $(SRC_DIRS)

Getting dependencies working well took me a bit

 

# For some goals it is important that dependencies are not included
# For example, if a .dep has an error in it and a 'make clean' is issued the clean will fail


# If no goal is specified on the command line we default to 'build' so we need to include dependencies if
#  MAKECMDGOALS is blank!
ifeq ($(MAKECMDGOALS),)
INCDEP = build
else
INCDEP = $(filter-out $(XDEPGOALS),$(MAKECMDGOALS))
endif


# Only include dependency files that exist
ifneq ($(INCDEP),)
$(info Including dependencies)
DEPS_EXISTING = $(foreach DIR,$(DEP_DIRS),$(wildcard $(DIR)*.dep))
ifneq ($(DEPS_EXISTING),)
include $(DEPS_EXISTING)
endif #DEPS_EXISTING
endif #INCDEP

Edited by Shannon Barber, 01 February 2014 - 11:54 AM.

- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara





PARTNERS