🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

linux commands

Started by
10 comments, last by Bregma 15 years, 3 months ago
Quote: Original post by Codeka
There are two ways (that I know of, there's probably more [wink]) to separate commands in the shell. ";" and "&&" so "cd foo ; cd bar" executes the "cd foo" command followed by the "cd bar" command. Using "&&" instead means "if the first command fails, don't execute the rest".


There is another one:

A ; B

-> Will execute commands in sequence.

A && B

-> Will execute command B if A was succesful.

A || B

-> Will execute command B if A was unsuccesful.
Advertisement
Quote: Original post by icecubeflower
What if I wasn't using a fancy IDE? What if I was using jpico? Suppose I had open like four terminal windows. In one I'm writing my program with jpico and hitting <ctrl>-O all the time to save. In another terminal I'm in the same directory typing "make" over and over. Say I've been making up my own simple makefile that works on my computer. But now my massive project is nearing completion and I want people on other systems to be able to do the whole ./configure, make, make install thing on their own computers where my makefile might not work.

How would I go about creating a configure.in? What do the pros do? Or do they all use a fancy IDE?

The pros use [g]vim and create configure.ac from scratch. Ok, some apostates use emacs. The source "configure.in" was deprecated some time ago.

Actually, I generally do the following when setting up a new project.

(1) Create a basic directory structure
$(top_srcdir)
$(top_srcdir)/src
$(top_srcdir)/config

(2) Add a basic src/main.cpp, just to get started
(3) Create a basic Makefile.am with just a SUBDIRS=src line and an empty src/Makefile.am
(4) Run "autoscan", rename configure.scan to configure.ac
(5) Edit configure.ac to add AM_INIT_AUTOMAKE and update to modern autoconf standards (different AC_INIT syntax etc.) -- something like this.
#                                               -*- Autoconf -*-# Process this file with autoconf to produce a configure script.## Copyright 2009 Stephen M. Webb  <stephen.webb@bregmasoft.com>#AC_PREREQ(2.61)AC_COPYRIGHT([Copyright 2009 Stephen M. Webb  <stephen.webb@bregmasoft.com>])AC_INIT(no-dice, 1.0, stephen.webb@bregmasoft.com)AC_CONFIG_AUX_DIR(config)AC_CONFIG_MACRO_DIR(config)AC_CANONICAL_TARGETAM_INIT_AUTOMAKE([gnu 1.9 -Wno-syntax -Wall])AC_CONFIG_HEADER([nodice_config.h])# ... the rest of the autogenerated configure.scan remains the same

(6) Create a shell script autogen.sh with the following contents
#!/bin/shautoreconf -i -f -v

(7) git init; git add *; git commit -sm "Initial checkin"
(8) ./autogen.sh && ./configure && make && lather-rinse-repeat

It gets a little more complicated if you want to use libtool. You need to add AC_PROG_LIBTOOL to configure.ac.

This is a start. You will probably want to expand your horizons by learning autoconf programming so you can create and use macros to autodetect the presence and location of dependant software (eg. SDL libs). That's a whole nother topic.

Stephen M. Webb
Professional Free Software Developer

This topic is closed to new replies.

Advertisement