examples/c/decode/file/main.c : Add extra error handling.
[flac.git] / build / exe.mk
bloba44a9a9fe3c15df8c755d0dbc1b4a334f1fdb881
1 # FLAC - Free Lossless Audio Codec
2 # Copyright (C) 2001-2009 Josh Coalson
3 # Copyright (C) 2011-2013 Xiph.Org Foundation
5 # This file is part the FLAC project. FLAC is comprised of several
6 # components distributed under different licenses. The codec libraries
7 # are distributed under Xiph.Org's BSD-like license (see the file
8 # COPYING.Xiph in this distribution). All other programs, libraries, and
9 # plugins are distributed under the GPL (see COPYING.GPL). The documentation
10 # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
11 # FLAC distribution contains at the top the terms under which it may be
12 # distributed.
14 # Since this particular file is relevant to all components of FLAC,
15 # it may be distributed under the Xiph.Org license, which is the least
16 # restrictive of those mentioned above. See the file COPYING.Xiph in this
17 # distribution.
20 # GNU makefile fragment for building an executable
23 include $(topdir)/build/config.mk
25 ifeq ($(OS),Darwin)
26 CC = cc
27 CCC = c++
28 else
29 CC = gcc
30 CCC = g++
31 endif
32 NASM = nasm
33 LINK = $(CC) $(LINKAGE)
34 OBJPATH = $(topdir)/objs
35 BINPATH = $(OBJPATH)/$(BUILD)/bin
36 LIBPATH = $(OBJPATH)/$(BUILD)/lib
37 DEBUG_BINPATH = $(OBJPATH)/debug/bin
38 DEBUG_LIBPATH = $(OBJPATH)/debug/lib
39 RELEASE_BINPATH = $(OBJPATH)/release/bin
40 RELEASE_LIBPATH = $(OBJPATH)/release/lib
41 PROGRAM = $(BINPATH)/$(PROGRAM_NAME)
42 DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME)
43 RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME)
45 debug : CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -W -Wall -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
46 valgrind: CFLAGS = -g -O0 -DDEBUG $(CONFIG_CFLAGS) $(DEBUG_CFLAGS) -DFLAC__VALGRIND_TESTING -W -Wall -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
47 release : CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -finline-functions -DNDEBUG $(CONFIG_CFLAGS) $(RELEASE_CFLAGS) -W -Wall -Winline -DFLaC__INLINE=__inline__ -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES)
49 CFLAGS = $(CFLAGS) -Wmissing-prototypes -Wstrict-prototypes
50 CXXFLAGS = $(CFLAGS)
52 LFLAGS = -L$(LIBPATH)
54 DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o)
55 RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o)
56 ifeq ($(PROC),x86_64)
57 DEBUG_PIC_OBJS = $(SRCS_C:%.c=%.debug.pic.o) $(SRCS_CC:%.cc=%.debug.pic.o) $(SRCS_CPP:%.cpp=%.debug.pic.o) $(SRCS_NASM:%.nasm=%.debug.pic.o)
58 RELEASE_PIC_OBJS = $(SRCS_C:%.c=%.release.pic.o) $(SRCS_CC:%.cc=%.release.pic.o) $(SRCS_CPP:%.cpp=%.release.pic.o) $(SRCS_NASM:%.nasm=%.release.pic.o)
59 endif
61 debug : $(DEBUG_PROGRAM)
62 valgrind: $(DEBUG_PROGRAM)
63 release : $(RELEASE_PROGRAM)
65 # by default on OS X we link with static libs as much as possible
67 $(DEBUG_PROGRAM) : $(DEBUG_OBJS) $(DEBUG_PIC_OBJS)
68 ifeq ($(OS),Darwin)
69 $(LINK) -o $@ $(DEBUG_OBJS) $(EXPLICIT_LIBS)
70 else
71 $(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS)
72 endif
74 $(RELEASE_PROGRAM) : $(RELEASE_OBJS) $(RELEASE_PIC_OBJS)
75 ifeq ($(OS),Darwin)
76 $(LINK) -o $@ $(RELEASE_OBJS) $(EXPLICIT_LIBS)
77 else
78 $(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS)
79 endif
81 include $(topdir)/build/compile.mk
83 .PHONY : clean
84 clean :
85 -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(DEBUG_PIC_OBJS) $(RELEASE_PIC_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME)
87 .PHONY : depend
88 depend:
89 makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp