summaryrefslogtreecommitdiffstats
path: root/.vim/c-support/codesnippets/Makefile.multi-target.template
blob: 75da8dd4b5d498ef1e51ce88fe65be7125d84e5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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)