summary refs log tree commit diff
path: root/src/Makefile.am
blob: 4e05be883d260aaace9b5097961f53b89872b65c (plain) (blame)
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
# $Id$

AM_YFLAGS = -d

COMMON_CFLAGS = -Wall
COMMON_CPPFLAGS = \
	-include $(top_builddir)/config.h \
	-DBSD=1 -DSMALL -DSHELL \
	-DGLOB_BROKEN -DFNMATCH_BROKEN -DIFS_BROKEN \
	-D__COPYRIGHT\(x\)= -D__RCSID\(x\)= -D_DIAGASSERT\(x\)=

AM_CFLAGS = $(COMMON_CFLAGS)
AM_CPPFLAGS = $(COMMON_CPPFLAGS)
AM_CFLAGS_FOR_BUILD = -g -O2 $(COMMON_CFLAGS) 
AM_CPPFLAGS_FOR_BUILD = $(COMMON_CPPFLAGS)

COMPILE_FOR_BUILD = \
	$(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) \
	$(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) 

bin_PROGRAMS = dash

dash_CFILES = \
	alias.c arith_yylex.c cd.c error.c eval.c exec.c expand.c \
	histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c \
	mystring.c options.c parser.c redir.c show.c trap.c output.c \
	bltin/printf.c system.c bltin/test.c bltin/times.c var.c
dash_SOURCES = \
	$(dash_CFILES) arith.y \
	alias.h bltin/bltin.h cd.h error.h eval.h exec.h expand.h hetio.h \
	init.h input.h jobs.h machdep.h mail.h main.h memalloc.h miscbltin.h \
	myhistedit.h mystring.h options.h output.h parser.h redir.h shell.h \
	show.h system.h trap.h var.h
dash_LDADD = builtins.o init.o nodes.o signames.o syntax.o

HELPERS = mkinit mksyntax mknodes mksignames

BUILT_SOURCES = arith.h builtins.h nodes.h syntax.h token.h
CLEANFILES = \
	$(BUILT_SOURCES) $(patsubst %.o,%.c,$(dash_LDADD)) \
	arith.c $(HELPERS)

man_MANS = dash.1
EXTRA_DIST = \
	$(man_MANS) \
	mktokens mkbuiltins builtins.def mkinit.c \
	mknodes.c nodetypes nodes.c.pat mksyntax.c mksignames.c

token.h: mktokens
	sh $^

builtins.c builtins.h: mkbuiltins shell.h builtins.def
	sh $^ . '$(CFLAGS)'

init.c: mkinit $(dash_CFILES)
	./$^

nodes.c nodes.h: mknodes nodetypes nodes.c.pat
	./$^

syntax.c syntax.h: mksyntax
	./$^

signames.c: mksignames
	./$^

$(HELPERS): %: %.c
	$(COMPILE_FOR_BUILD) -o $@ $<