Ok, well, I have been slowly evolving in my makefile ways, but I have yet to understand how to make those robust makefiles that only compile the files that have changed.
I have yet to find any makefile tutorials out there beyond simple
Code: Select all
default:
gcc -o name_of_binary -c name_of_source
does anyone have any experience with this kind of makefile?
(also, preferably this will work in both BSD make and GNU make)
edit:
Code: Select all
as-ebc: ${OBJS}
${CC} ${LDFLAGS} ${OBJS} -o as-ebc
.c.o: ${HDRS}
${CC} ${CFLAGS} -c $*.c
lint:
lint ${DFLAGS} ${SRCS}
clean:
rm -f ${OBJS} as-ebc core a.out errs
install:
install -s as ${DESTDIR}/bin
that is the best makefile I've seen that works with both bsd make and gnu make. My problem with it though is that I can't figure out a way to put output objs into a seperate ./objs directory and the binary in ./bin/ directory...