Not yet working stack checking (symbol STACKCHECK)
[gnokii.git] / gnokii / Makefile
1
2 #
3 # Makefile for the GNOKII tool suite.
4 #
5
6 TOPDIR=..
7 include $(TOPDIR)/Makefile.global
8
9 STACKSIZE = 150000
10
11 CFLAGS  += $(PTHREAD_CFLAGS)
12 LDLIBS  += $(PTHREAD_LIBS)
13
14 ifdef XPM_LIBS
15     LDLIBS += $(XPM_LIBS)
16 endif
17
18 OBJS =  gnokii.o
19
20 ifdef OWN_GETOPT
21     OBJS += $(TOPDIR)/getopt/libgetopt.a
22 endif
23
24 all: gnokii
25
26 gnokii: $(OBJS) $(TOPDIR)/common/data.a $(TOPDIR)/common/common.a cleanup.o mcount.o # $(TOPDIR)/common/gsm-filetypes.o
27         $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ -o $@
28 ifneq "" "$(findstring -DUCCOMPAT,$(CPPFLAGS))"
29         /opt/uClinux/m68k-pic-coff/bin/coff2flt -o gnokii -s $(STACKSIZE) gnokii.coff
30 endif
31
32 hello: hello.o cleanup.o mcount.o
33         $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ -o $@
34
35 hello.o: hello.c
36         $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $^ -o $@
37
38 cleanup.o: cleanup.c
39         $(CC) $(filter-out -pg,$(CFLAGS)) $(CPPFLAGS) $(TARGET_ARCH) -c $^ -o $@
40
41 mcount.o: mcount.c
42         $(CC) $(filter-out -pg,$(CFLAGS)) $(CPPFLAGS) $(TARGET_ARCH) -c $^ -o $@
43
44 $(TOPDIR)/common/common.a: 
45         $(MAKE) -C $(TOPDIR)/common common.a
46
47 $(TOPDIR)/common/data.a:
48         $(MAKE) -C $(TOPDIR)/common data.a
49
50 $(TOPDIR)/common/gsm-filetypes.o: 
51         $(MAKE) -C $(TOPDIR)/common gsm-filetypes.o
52
53 $(TOPDIR)/getopt/libgetopt.a:
54         $(MAKE) -C $(TOPDIR)/getopt
55
56 $(TOPDIR)/common/libmygnokii.so:
57         $(MAKE) -C $(TOPDIR)/common makelib
58         
59 gnokiilib: $(OBJS) $(TOPDIR)/common/libmygnokii.so
60         $(CC) $(LDFLAGS) $(TARGET_ARCH) $(OBJS) -L$(TOPDIR)/common -lmygnokii $(LOADLIBES) $(LDLIBS) -o $@
61
62 makelib: gnokiilib
63
64 clean:
65         $(RM) $(OBJS) cleanup.o mcount.o *~ depend gnokii gnokiilib *.exe core *.bak
66
67 install: all
68         $(INSTALL) -d $(bindir)
69         $(INSTALL) gnokii $(bindir)
70         $(INSTALL) gnokiilib $(bindir)/gnokii
71
72 install-strip: all
73         $(INSTALL) -d $(bindir)
74         $(INSTALL) -s gnokii $(bindir)
75         $(INSTALL) -s gnokiilib $(bindir)/gnokii
76         @echo "done"
77
78 install-suid: all
79         @if [ -z "/bin/grep -e '^gnokii:' /etc/group" ]; then \
80                 /usr/sbin/groupadd gnokii; \
81         fi
82         $(INSTALL) -d $(bindir)
83         $(INSTALL) -o root -g gnokii -m 0750 gnokii $(bindir)
84         $(INSTALL) -o root -g gnokii -m 0750 gnokiilib $(bindir)/gnokii
85         @echo
86
87 install-ss: all
88         @if [ -z "/bin/grep -e '^gnokii:' /etc/group" ]; then \
89                 /usr/sbin/groupadd gnokii; \
90         fi
91         $(INSTALL) -d $(bindir)
92         $(INSTALL) -o root -g gnokii -m 0750 -s gnokii $(bindir)
93         $(INSTALL) -o root -g gnokii -m 0750 -s gnokiilib $(bindir)/gnokii
94         @echo
95
96 depend dep:
97         $(CC) $(CFLAGS) -MM *.c >depend
98
99 ifeq (depend,$(wildcard depend))
100 include depend
101 endif
102
103 .PHONY: all install clean dep depend