annotate Makefile.gen @ 665:23d16d9cdf96

Work on the build system, split generic UNIX things into Makefile.unix
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 12 Feb 2016 03:05:07 +0200
parents ff94100cfc7c
children 32c13602c091
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
665
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
1 ###
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
2 ### Main makefile
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
3 ###
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
4 CFLAGS += -g -W -Wall -Wextra -DTH_NO_DEFAULTS -I.
263
8c983c3b93eb CFLAGS changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 219
diff changeset
5 CFLAGS += -O2
665
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
6 CFLAGS += -std=c11 -pedantic -D_XOPEN_SOURCE=500
383
6d3ce7f28b65 Use a Makefile setting for th-libs location.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
7 THLIBS=th-libs/
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
626
904c359b1ced Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 623
diff changeset
9 MKDIR ?= mkdir
904c359b1ced Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 623
diff changeset
10 MKDIR_P ?= $(MKDIR) -p
904c359b1ced Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 623
diff changeset
11
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 #
213
78f47ae47c2a Fix Windows build.
Matti Hamalainen <ccr@tnsp.org>
parents: 199
diff changeset
13 # Version strings
78f47ae47c2a Fix Windows build.
Matti Hamalainen <ccr@tnsp.org>
parents: 199
diff changeset
14 #
78f47ae47c2a Fix Windows build.
Matti Hamalainen <ccr@tnsp.org>
parents: 199
diff changeset
15 NN_VERSION := $(shell cat VERSION)
78f47ae47c2a Fix Windows build.
Matti Hamalainen <ccr@tnsp.org>
parents: 199
diff changeset
16 comma:= ,
78f47ae47c2a Fix Windows build.
Matti Hamalainen <ccr@tnsp.org>
parents: 199
diff changeset
17 NN_VERSION_COM := $(subst .,$(comma),$(NN_VERSION))
465
c3b3b6d89084 Simplify buildsystem a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 413
diff changeset
18 CFLAGS += -DNN_VERSION=\"$(NN_VERSION)\"
213
78f47ae47c2a Fix Windows build.
Matti Hamalainen <ccr@tnsp.org>
parents: 199
diff changeset
19
78f47ae47c2a Fix Windows build.
Matti Hamalainen <ccr@tnsp.org>
parents: 199
diff changeset
20 #
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 # Objects
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 #
384
40b95d677f68 Fix build.
Matti Hamalainen <ccr@tnsp.org>
parents: 383
diff changeset
23 THLIBS_A=$(OBJPATH)thlibs.a
665
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
24 THLIBS_OBJ=th_util.o th_string.o th_args.o th_ioctx.o th_file.o th_config.o th_network.o
465
c3b3b6d89084 Simplify buildsystem a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 413
diff changeset
25
623
118276b60667 More work towards using th-libs th_network module.
Matti Hamalainen <ccr@tnsp.org>
parents: 622
diff changeset
26 NNCHAT_OBJ=main.o util.o ui.o
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 NNCHAT_BIN=$(BINPATH)nnchat$(EXEEXT)
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28
665
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
29 TARGETS += $(NNCHAT_BIN)
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
30 NOBUILD_TARGETS += $(OBJPATH) $(BINPATH)
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
31 NOINST_TARGETS += $(THLIBS_A)
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 #
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 # Target rules
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 #
665
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
37 all: $(NOBUILD_TARGETS) $(NOINST_TARGETS) $(TARGETS)
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38
626
904c359b1ced Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 623
diff changeset
39 $(OBJPATH):
904c359b1ced Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 623
diff changeset
40 $(MKDIR_P) $@
904c359b1ced Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 623
diff changeset
41
904c359b1ced Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 623
diff changeset
42 $(BINPATH):
904c359b1ced Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 623
diff changeset
43 $(MKDIR_P) $@
904c359b1ced Improve build system.
Matti Hamalainen <ccr@tnsp.org>
parents: 623
diff changeset
44
383
6d3ce7f28b65 Use a Makefile setting for th-libs location.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
45 $(OBJPATH)%.o: $(THLIBS)%.c $(THLIBS)%.h
219
477449911cb1 Makefile improvements, depend on VERSION etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 213
diff changeset
46 $(CC) $(CFLAGS) -c -o $@ $<
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47
381
7c28f38cb6dd Update to use new th-libs from the subrepo.
Matti Hamalainen <ccr@tnsp.org>
parents: 263
diff changeset
48 $(OBJPATH)%.o: %.c %.h
383
6d3ce7f28b65 Use a Makefile setting for th-libs location.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
49 $(CC) $(CFLAGS) -c -o $@ $< -I$(THLIBS)
381
7c28f38cb6dd Update to use new th-libs from the subrepo.
Matti Hamalainen <ccr@tnsp.org>
parents: 263
diff changeset
50
465
c3b3b6d89084 Simplify buildsystem a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 413
diff changeset
51 $(OBJPATH)%.o: %.c
c3b3b6d89084 Simplify buildsystem a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 413
diff changeset
52 $(CC) $(CFLAGS) -c -o $@ $< -I$(THLIBS)
c3b3b6d89084 Simplify buildsystem a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 413
diff changeset
53
384
40b95d677f68 Fix build.
Matti Hamalainen <ccr@tnsp.org>
parents: 383
diff changeset
54 $(THLIBS_A): $(addprefix $(OBJPATH),$(THLIBS_OBJ))
567
6261511ecc96 Object files were added to the thlibs.a archive twice. Fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 561
diff changeset
55 $(AR) cru $@ $(addprefix $(OBJPATH),$(THLIBS_OBJ))
533
52c56ada3816 Fix Win32/MinGW cross-compilation target to work with Debian's gcc-mingw-w64
Matti Hamalainen <ccr@tnsp.org>
parents: 466
diff changeset
56 $(RANLIB) $@
384
40b95d677f68 Fix build.
Matti Hamalainen <ccr@tnsp.org>
parents: 383
diff changeset
57
413
14b685cdbd2c Rename files.
Matti Hamalainen <ccr@tnsp.org>
parents: 412
diff changeset
58 main.c: VERSION
384
40b95d677f68 Fix build.
Matti Hamalainen <ccr@tnsp.org>
parents: 383
diff changeset
59
465
c3b3b6d89084 Simplify buildsystem a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 413
diff changeset
60 $(NNCHAT_BIN): $(addprefix $(OBJPATH),$(NNCHAT_OBJ)) $(THLIBS_A) $(EXTRAOBJS)
c3b3b6d89084 Simplify buildsystem a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 413
diff changeset
61 $(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS)
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 #
647
ff94100cfc7c Commonize README building.
Matti Hamalainen <ccr@tnsp.org>
parents: 632
diff changeset
64 # Documentation
ff94100cfc7c Commonize README building.
Matti Hamalainen <ccr@tnsp.org>
parents: 632
diff changeset
65 #
ff94100cfc7c Commonize README building.
Matti Hamalainen <ccr@tnsp.org>
parents: 632
diff changeset
66 $(DOC):
ff94100cfc7c Commonize README building.
Matti Hamalainen <ccr@tnsp.org>
parents: 632
diff changeset
67 @wget -qO- http://www.tnsp.org/~ccr/nnchat/ | tr '\n' '§' | \
ff94100cfc7c Commonize README building.
Matti Hamalainen <ccr@tnsp.org>
parents: 632
diff changeset
68 sed "s/<.-- BEGIN -->.*<.-- END -->//g;s/<script.*<\/script>//g" | tr '§' '\n' > "$@.tmp"
ff94100cfc7c Commonize README building.
Matti Hamalainen <ccr@tnsp.org>
parents: 632
diff changeset
69 @links -dump "$@.tmp" > $@
ff94100cfc7c Commonize README building.
Matti Hamalainen <ccr@tnsp.org>
parents: 632
diff changeset
70
ff94100cfc7c Commonize README building.
Matti Hamalainen <ccr@tnsp.org>
parents: 632
diff changeset
71
ff94100cfc7c Commonize README building.
Matti Hamalainen <ccr@tnsp.org>
parents: 632
diff changeset
72 #
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 # Special targets
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 #
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 clean:
665
23d16d9cdf96 Work on the build system, split generic UNIX things into Makefile.unix
Matti Hamalainen <ccr@tnsp.org>
parents: 647
diff changeset
76 $(RM) $(TARGETS) $(NOINST_TARGETS) $(OBJPATH)*.o
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 srcclean: clean
177
fdc771411795 Makefile $(RM) implies -f .. don't include the option in commands.
Matti Hamalainen <ccr@tnsp.org>
parents: 176
diff changeset
79 $(RM) *~
0
728243125263 Import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80