creddit: Add code to Makefile setup to check the running system

This commit adds the file common.mk, which runs various commands on the
target system and sets macros that can be used in other Makefiles to
compile with different settings on different machines.

Currently, the only setting is 'umake -r', which checks the running
Kernel (Currently just checked for 'Linux' or 'Drawin'). In creddit.mk,
this is used to decide which ncurses library to link against.
This commit is contained in:
Matt Kilgore 2013-10-09 10:36:47 -04:00
parent 8f3aabce5e
commit 2ad72431ef
3 changed files with 19 additions and 1 deletions

View File

@ -36,6 +36,8 @@ endif
all: real-all
include ./common.mk
# Set initial values for 'targets'
CLEAN_TARGETS:=
COMPILE_TARGETS:=

10
common.mk Normal file
View File

@ -0,0 +1,10 @@
# Makefile for registering info about the system we're compiling on.
UNAME=$(shell uname -r)
ifeq ('Darwin','$(UNAME)')
F_MACOSX=yes
endif
ifeq ('Linux','$(UNAME)')
F_LINUX=yes
endif

View File

@ -1,6 +1,12 @@
CREDDIT_CFLAGS:=$(PROJCFLAGS)
CREDDIT_LDFLAGS:=$(PROJLDFILES) -lncursesw -L$(BUILD_DIR) -lreddit
CREDDIT_LDFLAGS:=$(PROJLDFILES) -L$(BUILD_DIR) -lreddit
ifdef F_MACOSX
CREDDIT_LDFLAGS+=-lncurses
else
CREDDIT_LDFLAGS+=-lncursesw
endif
ifdef STATIC
CREDDIT_LDFLAGS+=`curl-config --cflags` `curl-config --libs`
endif