%.o: %.c
$(CC) $(CFLAGS) -c $<
.o file, it will compile it with this rule)
% is a wildcard that means one .o file for each .c file of the same name
$< equates to the dependency list matched by the rule ( %.c )
$@ refers to the full target name
$* refers to the part that was matched by the "%" character
export CFLAGS="-O3 -march=<architecture>" && CXXFLAGS=$CFLAGSwherearchitecturecan equal things likei586,i686, etc. ...or (from the Linux From Scratch page)... Ed. note "Reboant" dropped a note about how using-Os(optimize for size) showed incredibly good results. So if you want is small binary size rather than fast execution time, you might want to take a look at this.
old_string to new_string
CPPFLAGS=-Dold_string=new_string
# finds the device node number for 'mem'
VER = $(shell cat /proc/devices | grep mem | awk '{print $$1}')
all: Test
Test:
echo $(VER)
-- MattWalsh - 21 Mar 2002