summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorJosh Coalson <jcoalson@users.sourceforce.net>2000-12-10 04:09:52 +0000
committerJosh Coalson <jcoalson@users.sourceforce.net>2000-12-10 04:09:52 +0000
commitbb7f6b99d02e15e0ff98ff1d9d037098dc5dc4e9 (patch)
treee76e9be0f1736ac69cdaf084d413bdbcffd55425 /build
downloadflac-bb7f6b99d02e15e0ff98ff1d9d037098dc5dc4e9.tar.gz
Initial revision
Diffstat (limited to 'build')
-rw-r--r--build/exe.mk37
-rw-r--r--build/lib.mk39
2 files changed, 76 insertions, 0 deletions
diff --git a/build/exe.mk b/build/exe.mk
new file mode 100644
index 00000000..b4bd1a3f
--- /dev/null
+++ b/build/exe.mk
@@ -0,0 +1,37 @@
+#
+# 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
diff --git a/build/lib.mk b/build/lib.mk
new file mode 100644
index 00000000..62c4c73a
--- /dev/null
+++ b/build/lib.mk
@@ -0,0 +1,39 @@
+#
+# GNU makefile fragment for building a library
+#
+
+CC = gcc
+LINK = ar cru
+LINKD = ld -G
+LIBPATH = ../../obj/lib
+STATIC_LIB = $(LIBPATH)/$(LIB_NAME).a
+DYNAMIC_LIB = $(LIBPATH)/$(LIB_NAME).so
+
+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 : $(STATIC_LIB) $(DYNAMIC_LIB)
+release : $(STATIC_LIB) $(DYNAMIC_LIB)
+
+$(STATIC_LIB) : $(OBJS)
+ $(LINK) $@ $(OBJS)
+
+$(DYNAMIC_LIB) : $(OBJS)
+ $(LINKD) -o $@ $(OBJS) $(LFLAGS) $(LIBS)
+
+%.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+%.i : %.c
+ $(CC) $(CFLAGS) -E $< -o $@
+
+.PHONY : clean
+clean :
+ -rm -f $(OBJS) $(STATIC_LIB) $(DYNAMIC_LIB)
+
+.PHONY : depend
+depend:
+ makedepend -- $(CFLAGS) $(INCLUDES) -- *.c