-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
executable file
·69 lines (56 loc) · 2.13 KB
/
GNUmakefile
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
##########################################################
# GNUmakefile/Makefile
#
# Copyright 2004, Stefan Siegl <[email protected]>, Germany
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Publice License,
# version 2 or any later. The license is contained in the COPYING
# file that comes with the wspacegen distribution.
#
# Makefile for wspacegen project
#/
WSDBG_OBJS=fileio.o storage.o wsdbg.o interprt.o debug.o
WSGEN_OBJS=fileio.o storage.o wsgen_ui.o interprt.o debug.o
WSI_OBJS=fileio.o storage.o wsi.o interprt.o
TARGETS=wsdbg wspacegen wsi
OBJS=$(WSDBG_OBJS) $(WSGEN_OBJS) $(WSI_OBJS)
# Be careful when it comes to compiling with -ansi flag on POSIX-like systems!
#
# This might sound strange, but if you compile with '-ansi' you won't get the
# POSIX-dependant features of the whitespace interpreter, which aren't a
# must-have but at least a want-to-have! To make it more clear: wsi tries to
# set the terminal into non-canonical (aka read character by character) mode, so
# that the whitespace scripts gets the chars even before you hit return.
CFLAGS+=-Wall -W -ggdb #-ansi -pedantic-errors
LDFLAGS+=${CFLAGS} #-lefence
all: $(TARGETS) Makefile
wsdbg: ${WSDBG_OBJS}
$(CC) ${LDFLAGS} -o $@ ${WSDBG_OBJS}
wspacegen: ${WSGEN_OBJS}
$(CC) ${LDFLAGS} -o $@ ${WSGEN_OBJS}
wsi: ${WSI_OBJS}
$(CC) $(LDFLAGS) -o $@ $(WSI_OBJS)
.cxx.o:
$(CC) -I. $(CFLAGS) -c $<
clean:
rm -f *.[oad] core tags $(TARGETS)
# START OF GNUmakefile ...
#
# GNUmakefile, this Makefile is able to generate dependencies
# automatically. However this requires GNU-style make and
# a gcc, supporting -M flag.
#
# To generate the common Makefile everything from here on is chopped
# off and replaced by the contents of the *.d files.
#
%.d: %.c
$(CC) -MM -I. $(CFLAGS) $< >[email protected]
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < [email protected] > $@
rm -f [email protected]
Makefile: GNUmakefile $(OBJS:.o=.d)
grep -e "^# START OF GNUmakefile" -n $< > [email protected]
sed -e "`sed -e "s,:.*,," < [email protected]`,9999d" < $< > $@
cat $(OBJS:.o=.d) >> $@
rm -f [email protected]
-include $(OBJS:.o=.d)