makefiles - compile all c files at once
LIBS = -lkernel32 -luser32 -lgdi32 -lopengl32
CFLAGS = -Wall
# Should be equivalent to your list of C files, if you don't build selectively
SRC=$(wildcard *.c)
test: $(SRC)
gcc -o $@ $^ $(CFLAGS) $(LIBS)
SRCS=$(wildcard *.c)
OBJS=$(SRCS:.c=.o)
all: $(OBJS)
You need to take out your suffix rule (%.o: %.c) in favour of a big-bang rule. Something like this:
LIBS = -lkernel32 -luser32 -lgdi32 -lopengl32
CFLAGS = -Wall
OBJ = 64bitmath.o \
monotone.o \
node_sort.o \
planesweep.o \
triangulate.o \
prim_combine.o \
welding.o \
test.o \
main.o
SRCS = $(OBJ:%.o=%.c)
test: $(SRCS)
gcc -o $@ $(CFLAGS) $(LIBS) $(SRCS)
If you're going to experiment with GCC's whole-program optimization, make sure that you add the appropriate flag to CFLAGS, above.
On reading through the docs for those flags, I see notes about link-time optimization as well; you should investigate those too.