summaryrefslogtreecommitdiff
path: root/src/Make.ccmd
blob: cb2b255123a13c401eadeb49b5b430c9b5a44100 (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
# Copyright 2010 The Go Authors.  All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

# Makefile for commands written in C.

ifeq (windows,$(findstring windows, $(shell uname | tr A-Z a-z | sed 's/mingw/windows/')))
TARG:=$(TARG).exe
endif

$(TARG): $(OFILES) $(LIB)
	$(HOST_LD) -o $(TARG) -L"$(GOROOT)"/lib $(OFILES) $(LIB) -lbio -l9 -lm $(HOST_LDFLAGS)

$(OFILES): $(HFILES)

CLEANFILES+=y.tab.[ch]

clean:
	rm -f *.$(HOST_O) $(TARG) $(CLEANFILES)

ifneq ($(NOINSTALL),1)
install: $(QUOTED_GOBIN)/$(TARG)
endif

$(QUOTED_GOBIN)/$(TARG): $(TARG)
	cp $(TARG) "$(GOBIN)"/$(TARG)

y.tab.h: $(YFILES)
	bison -y $(HOST_YFLAGS) $(YFILES)

y.tab.c: y.tab.h
	test -f y.tab.c && touch y.tab.c

all: $(TARG)

%.$(HOST_O): %.c
	$(HOST_CC) $(HOST_CFLAGS) -c "$(PWD)/$*.c"

# These are used by enough different Makefiles to be
# worth writing down in one place, even if they don't
# apply to every command that builds with Make.ccmd
../%l/enam.o:
	cd ../$*l; $(MAKE) enam.o