# En enkel make-fil
lfdia: lfdia.o support.o
gcc -Wall -o lfdia lfdia.o support.o -lm gd/libgd.a
cp lfdia /Home/staff/gunnar/public_html/lfdia.cgi
lfdia.o: lfdia.c lfdia.h
gcc -c lfdia.c
support.o: support.c lfdia.h
gcc -c support.c
# Samma make-fil med makron, \, $* och clean
CC=gcc
CFLAGS=-Wall -O
lfdia: lfdia.o support.o
$(CC) $(CFLAGS) -o lfdia lfdia.o support.o -lm \
gd/libgd.a
cp lfdia /Home/staff/gunnar/public_html/lfdia.cgi
lfdia.o support.o: lfdia.h
$(CC) $(CFLAGS) -c $*.c
clean:
rm -f lfdia *.o core
Varning: Kom ihåg att GNU make och den make som följer
med operativsystemet kan bete sig lite olika
när det gäller implicita beroenden.
Är du osäker, skriv ut alla beroenden uttryckligen.
% lint -Nlevel=4 knapsack3.c | & less
argument unused in function
(106) argc in main
include file is unnecessary
(5) /usr/include/time.h
include file may be unnecessary
(4) /usr/include/sys/types.h
function returns value which is always ignored
printf putchar
function returns value which is sometimes ignored
solve
declared global, could be static
gen_ks knapsack3.c(24)
print_ks knapsack3.c(37)
solve knapsack3.c(60)
cdecl> explain int *(*(*a(int, int ))[5])(char *)
declare a as function (int, int) returning pointer to array 5 of pointer to function (pointer to char) returning pointer to int
[an error occurred while processing this directive]