Mercurial > hg > nnchat
changeset 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 | 87ef546de419 |
children | 1b18551b25e7 |
files | Makefile Makefile.gen Makefile.openbsd Makefile.solaris Makefile.unix |
diffstat | 5 files changed, 59 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Fri Feb 12 03:03:51 2016 +0200 +++ b/Makefile Fri Feb 12 03:05:07 2016 +0200 @@ -4,20 +4,10 @@ # # C-compiler, flags and linker flags -CC=gcc -AR=ar -RANLIB=ranlib - -CFLAGS=-DHAVE_STRING_H -DHAVE_STDINT_H -DUSE_XDG=1 -LDFLAGS=-lncurses +CFLAGS = -DHAVE_STRING_H -DHAVE_STDINT_H -DUSE_XDG=1 +LDFLAGS = -lncurses #CFLAGS += -DHAVE_STDINT_H #CFLAGS += -DHAVE_SYS_TYPES_H -# Miscellaneous -BINPATH= -OBJPATH=obj/unix/ -EXEEXT= -DOC=README - -include Makefile.gen +include Makefile.unix
--- a/Makefile.gen Fri Feb 12 03:03:51 2016 +0200 +++ b/Makefile.gen Fri Feb 12 03:05:07 2016 +0200 @@ -1,6 +1,9 @@ -CFLAGS += -g -W -Wall -Wextra -DTH_NO_DEFAULTS +### +### Main makefile +### +CFLAGS += -g -W -Wall -Wextra -DTH_NO_DEFAULTS -I. CFLAGS += -O2 -#CFLAGS += -std=c99 -pedantic +CFLAGS += -std=c11 -pedantic -D_XOPEN_SOURCE=500 THLIBS=th-libs/ MKDIR ?= mkdir @@ -18,19 +21,20 @@ # Objects # THLIBS_A=$(OBJPATH)thlibs.a -THLIBS_OBJ=th_util.o th_string.o th_args.o th_ioctx.o th_config.o th_network.o +THLIBS_OBJ=th_util.o th_string.o th_args.o th_ioctx.o th_file.o th_config.o th_network.o NNCHAT_OBJ=main.o util.o ui.o NNCHAT_BIN=$(BINPATH)nnchat$(EXEEXT) -TARGETS+=$(THLIBS_A) $(NNCHAT_BIN) +TARGETS += $(NNCHAT_BIN) +NOBUILD_TARGETS += $(OBJPATH) $(BINPATH) +NOINST_TARGETS += $(THLIBS_A) -NONBUILD+=$(OBJPATH) $(BINPATH) # # Target rules # -all: $(NONBUILD) $(TARGETS) +all: $(NOBUILD_TARGETS) $(NOINST_TARGETS) $(TARGETS) $(OBJPATH): $(MKDIR_P) $@ @@ -69,7 +73,7 @@ # Special targets # clean: - $(RM) $(TARGETS) $(OBJPATH)*.o + $(RM) $(TARGETS) $(NOINST_TARGETS) $(OBJPATH)*.o srcclean: clean $(RM) *~
--- a/Makefile.openbsd Fri Feb 12 03:03:51 2016 +0200 +++ b/Makefile.openbsd Fri Feb 12 03:05:07 2016 +0200 @@ -1,6 +1,5 @@ # -# Configuration settings for Linux and generic UNIX -# See other Makefile.* files for more options. +# OpenBSD configuration settings # # C-compiler, flags and linker flags @@ -8,13 +7,5 @@ CFLAGS=-DHAVE_STRING_H -DHAVE_INT_TYPES -DHAVE_NETINET_IN_H -DHAVE_NCURSES_H LDFLAGS=-lncurses -#CFLAGS += -DHAVE_STDINT_H -#CFLAGS += -DHAVE_SYS_TYPES_H -# Miscellaneous -BINPATH= -OBJPATH= -EXEEXT= - - -include Makefile.gen +include Makefile.unix
--- a/Makefile.solaris Fri Feb 12 03:03:51 2016 +0200 +++ b/Makefile.solaris Fri Feb 12 03:05:07 2016 +0200 @@ -5,9 +5,4 @@ CFLAGS=-DHAVE_STRING_H -DHAVE_INT_TYPES -DHAVE_UINT_T LDFLAGS=-lncurses -lresolv -# Miscellaneous -BINPATH= -OBJPATH= -EXEEXT= - -include Makefile.gen +include Makefile.unix
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.unix Fri Feb 12 03:05:07 2016 +0200 @@ -0,0 +1,42 @@ +## +## Common UNIX style Makefile stuff +## +PREFIX ?= /usr/local +CC ?= cc +AR ?= ar +RANLIB ?= ranlib +INSTALL ?= install +DOC ?= README + +CFLAGS += -DHAVE_CONFIG_H + + +## +## Miscellaneous +## +BINPATH ?= ./ +OBJPATH ?= obj/unix/ +EXEEXT ?= + +ENDIANCHK_BIN = $(BINPATH)endianchk$(EXEEXT) +NOINST_TARGETS += $(ENDIANCHK_BIN) config.h + + +include Makefile.gen + + +## +## Generate endian check and config.h +## +$(ENDIANCHK_BIN): endianchk.c + $(CC) $(CFLAGS) -o $@ $+ + +config.h: $(ENDIANCHK_BIN) + $(ENDIANCHK_BIN) > $@ + + +## +## Install targets +## +install: all + @for fn in $(TARGETS); do echo " INSTALL $$fn $(PREFIX)/bin/"; $(INSTALL) -m 755 "$$fn" $(PREFIX)/bin/; done