flac/build/exe.mk

38 lines
817 B
Makefile

#
# GNU makefile fragment for building an executable
#
CC = gcc
# LINKAGE can be forced to -static or -dynamic from invocation if desired, but it defaults to -static
LINKAGE = -static
LINK = gcc $(LINKAGE)
BINPATH = ../../obj/bin
LIBPATH = ../../obj/lib
PROGRAM = $(BINPATH)/$(PROGRAM_NAME)
all : release
debug : CFLAGS = -g -O0 -DDEBUG $(DEBUG_CFLAGS) -Wall -W $(INCLUDES)
release : CFLAGS = -O3 -DNDEBUG $(RELEASE_CFLAGS) -Wall -W $(INCLUDES)
LFLAGS = -L$(LIBPATH)
debug : $(PROGRAM)
release : $(PROGRAM)
$(PROGRAM) : $(OBJS)
$(LINK) -o $@ $(OBJS) $(LFLAGS) $(LIBS)
%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
%.i : %.c
$(CC) $(CFLAGS) -E $< -o $@
.PHONY : clean
clean :
-rm -f $(OBJS) $(PROGRAM)
.PHONY : depend
depend:
makedepend -- $(CFLAGS) $(INCLUDES) -- *.c