aboutsummaryrefslogtreecommitdiff
path: root/dot_vim/c-support/codesnippets/Makefile.multi-target.template
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@rak.ac>2021-12-13 16:55:42 -0500
committerRyan Kavanagh <rak@rak.ac>2021-12-13 16:58:10 -0500
commite5dfb045b994e1ab8fef9ef5d3f02ce20ea6b685 (patch)
treeba74287d80e46c70dab8c4311a1dc933fbfbdea1 /dot_vim/c-support/codesnippets/Makefile.multi-target.template
parentfix pager again (diff)
many more renames
Diffstat (limited to 'dot_vim/c-support/codesnippets/Makefile.multi-target.template')
-rw-r--r--dot_vim/c-support/codesnippets/Makefile.multi-target.template70
1 files changed, 70 insertions, 0 deletions
diff --git a/dot_vim/c-support/codesnippets/Makefile.multi-target.template b/dot_vim/c-support/codesnippets/Makefile.multi-target.template
new file mode 100644
index 0000000..75da8dd
--- /dev/null
+++ b/dot_vim/c-support/codesnippets/Makefile.multi-target.template
@@ -0,0 +1,70 @@
+#===============================================================================
+#
+# File: Makefile
+# Description:
+#
+# Usage: make (generate executable(s) )
+# make clean (remove objects, executables, prerequisits )
+# make tarball (generate compressed archive )
+# make zip (generate compressed archive )
+#
+# Author: Dr.-Ing. Fritz Mehner
+# Email: mehner@mfh-iserlohn.de
+# Created:
+#
+#===============================================================================
+
+
+CC = gcc
+CCP = g++
+CFLAGS = -c -g -Wall
+LFLAGS = -g
+SYS_LIBS = -lm
+TARBALL_EXCLUDE = "*.{o,gz,zip}"
+ZIP_EXCLUDE = *.o *.gz *.zip
+
+TARGETS = target_1 target_2
+
+#---------- targets --------------------------------------
+all: $(TARGETS)
+
+%.o: %.c
+ $(CC) $(CFLAGS) $*.c
+
+%.o: %.cc
+ $(CCP) $(CFLAGS) $*.cc
+
+#---------- target 1 -------------------------------------
+# C target
+target_1: target_1.o
+ $(CC) $(LFLAGS) -o $@ $@.o $(SYS_LIBS)
+
+#---------- target 2 -------------------------------------
+# C++ target
+target_2: target_2.o
+ $(CCP) $(LFLAGS) -o $@ $@.o $(SYS_LIBS)
+
+
+#---------- target 3 -------------------------------------
+
+
+
+#---------- tarball --------------------------------------
+tarball:
+ lokaldir=`pwd`; lokaldir=$${lokaldir##*/}; \
+ rm --force $$lokaldir.tar.gz; \
+ tar --exclude=$(TARBALL_EXCLUDE) \
+ --create \
+ --gzip \
+ --verbose \
+ --file $$lokaldir.tar.gz *
+
+#---------- zip ------------------------------------------
+zip:
+ lokaldir=`pwd`; lokaldir=$${lokaldir##*/}; \
+ zip -r $$lokaldir.zip * -x $(ZIP_EXCLUDE)
+
+#---------- clear up -------------------------------------
+clean:
+ rm --force $(EXECUTABLE) $(OBJECTS) $(PREREQUISITES)
+