-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.common
69 lines (52 loc) · 1.14 KB
/
Makefile.common
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
#
# (C) Copyright 1992, ..., 2007 the "DOSEMU-Development-Team".
#
# for details see file COPYING.DOSEMU in the DOSEMU distribution
#
LIBNAME := $(subst /,_,$(SUBDIR))
ifndef OBJS
ifdef CFILES
OBJS:=$(CFILES:.c=.o)
else
OBJS:=$($(notdir $(wildcard $(srcdir)/*.c)):.c=.o)
endif
endif
ifndef DEPENDS
DEPENDS:=$(OBJS:.o=.d)
endif
LIB:=$(top_builddir)/src/lib/lib$(LIBNAME).a
AR=ar
lib: $(LIB)
$(LIB): $(OBJS)
rm -f $@
$(AR) cr $@ $^
$(RANLIB) $@
.PHONY: clean realclean dist lib echo all install default
clean::
-rm -f $(OBJS) $(LIB) *~
realclean:: clean
rm -f *.d
dist:: $(ALL) Makefile
install -d $(DISTPATH)/$(SUBDIR)
cp -a $(ALL) Makefile $(DISTPATH)/$(SUBDIR)
%.o: %.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
%.d: %.c
$(CPP) -c $(CPPFLAGS) $< > /dev/null
ifndef CLEANING
ifneq "$(wildcard *.d)" ""
-include $(DEPENDS)
endif
endif
# this is mainly for debugging the makefile
echo::
@echo REALTOPDIR=$(REALTOPDIR)
@echo TOPDIR=$(TOPDIR)
@echo $(SHELL)
@echo $(shell pwd -P)
@echo LIB=$(LIB)
@echo DEPENDS=$(DEPENDS)
@echo OBJS=$(OBJS)
@echo CFILES = $(wildcard *.c)
@echo DEPENDS FOUND= $(wildcard *.d)
@echo MAKEFLAGS=$(MAKEFLAGS)