Version bumped to 1.0.0 for the initial release.
[wllib.git] / GNUmakefile
1 empty=
2 space=$(empty) $(empty)
3
4 ## Operating system specification:
5 # linux - Linux (1.3.37)
6 # amiga - Amiga (customized 40.62)
7 OS_NAME=linux
8
9 ## C compiler specification:
10 # gcc  - GCC (2.7.0)
11 # sasc - SAS/C (6.55)
12 CC_NAME=gcc
13
14 ## Windowing system specification:
15 # x11   - X Window System, Version 11(tm) (Release 6, Implementation: XFree 3.1.2)
16 # amiga - Amiga native windowing system (customized 40.62)
17 # svga  - svgalib - low level gfx (1.2.8) - only for Linux, as far as I know
18 # none  - Without any graphics support
19 WS_NAME=x11
20
21 ###
22
23 ifndef WS_NAME
24 WS_NAME=none
25 endif
26
27 ###
28
29 ifeq "$(CC_NAME)" "gcc" # C compiler: GCC
30 CC_CFLAGS=-Wall -O6 -fomit-frame-pointer -finline-functions -fexpensive-optimizations #-ansi -pedantic
31 CC_LDFLAGS=-lm -s
32 DEFKWD=-D
33 LDTO=-o
34 LDTOO=-c -o
35 endif
36
37 ifeq "$(CC_NAME)" "sasc" # C compiler: SAS/C
38 CC_CFLAGS=
39 CC_LDFLAGS=LINK
40 DEFKWD=DEF$(space)
41 LDTO=PNAME
42 LDTOO=OBJNAME
43 endif
44
45 ###
46
47 ifeq "$(OS_NAME)" "linux" # Operating system: Linux
48 OS_CFLAGS=$(DEFKWD)_BSD_SOURCE $(DEFKWD)HAVE_RINT
49 OS_LDFLAGS=
50 CP=cp
51 RM=rm -f
52 endif
53
54 ifeq "$(OS_NAME)" "amiga" # Operating system: Amiga
55 OS_CFLAGS=
56 OS_LDFLAGS=
57 CP=copy
58 RM=delete >NIL:
59 endif
60
61 ###
62
63 ifeq "$(WS_NAME)" "x11" # Windowing system: X Window System, Version 11(tm)
64 WS_CFLAGS=$(DEFKWD)FOR_X11
65 WS_LDFLAGS=-L/usr/X11/lib -lX11 -lXext -lXpm
66 WS_LIBSUFF=X11
67 endif
68
69 ifeq "$(WS_NAME)" "amiga" # Windowing system: Amiga native windowing system
70 WS_CFLAGS=$(DEFKWD)FOR_AMIGA
71 WS_LDFLAGS=
72 WS_LIBSUFF=Amiga
73 endif
74
75 ifeq "$(WS_NAME)" "svga" # Windowing system: svgalib - low level gfx
76 WS_CFLAGS=$(DEFKWD)FOR_SVGA
77 WS_LDFLAGS=-lvga
78 WS_LIBSUFF=SVGA
79 endif
80
81 ifeq "$(WS_NAME)" "none" # Windowing system: Without any graphics support
82 WS_CFLAGS=$(DEFKWD)FOR_NONE
83 WS_LDFLAGS=
84 WS_LIBSUFF=none
85 endif
86
87 ###
88
89 CFLAGS=$(OS_CFLAGS) $(CC_CFLAGS) $(WS_CFLAGS)
90 LDFLAGS=$(OS_LDFLAGS) $(CC_LDFLAGS) $(WS_LDFLAGS)
91 WLLIB=wllib-$(WS_LIBSUFF).c
92
93 TARGETS=mop451 mop453  ## Examples-related
94
95 .PHONY: all clean
96 all: Makefile $(TARGETS)
97
98 clean: 
99         -$(RM) $(TARGETS) *.o *.lnk *.npg gmk2mk
100
101 distclean: clean
102         -$(RM) Makefile
103
104 # Compatibility-related
105 #######################
106 gmk2mk: gmk2mk.c
107         $(CC) $(CFLAGS) $(LDFLAGS) $(LDTO) $@ $<
108
109 Makefile: GNUmakefile gmk2mk
110         gmk2mk <GNUmakefile >Makefile
111
112 # Examples-related
113 ##################
114 mop451: mop451.o wllib.o
115         $(CC) $(LDFLAGS) $(LDTO) $@ $< wllib.o
116
117 mop451.o: mop451.c mop451.xpm dyna-add.c wllib.h
118         $(CC) $(CFLAGS) $(LDTOO) $@ $<
119
120 mop453: mop453.o wllib.o
121         $(CC) $(LDFLAGS) $(LDTO) $@ $< wllib.o
122
123 mop453.o: mop453.c mop453.xpm dyna-add.c wllib.h
124         $(CC) $(CFLAGS) $(LDTOO) $@ $<
125
126 wllib.o: $(WLLIB) wllib.h
127         $(CC) $(CFLAGS) $(LDTOO) $@ $<